Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.ID


        assertNotNull("Title available", info.getTitle());
        assertNotNull("Description available", info.getDescription());
       
        List<? extends IGeoResource> m = service.resources(new NullProgressMonitor());
        for(IGeoResource resource: m) {
            ID id = resource.getID();
            assertNotNull(id);
            //IGeoResourceInfo grinfo = resource.getInfo(new NullProgressMonitor());
            IGeoResourceInfo grinfo = getInfo(resource, new NullProgressMonitor());
            assertNotNull(grinfo);
            assertEquals("GeoResource title matches filename", "sample data", grinfo.getTitle());
View Full Code Here


    public IService getService( IProgressMonitor monitor ) {
        return parent;
    }

    public ID getID() {
        ID id = new ID(getIdentifier());
        return id;
    }
View Full Code Here

        assertNotNull(service);

        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        catalog.add(service); // we can now find this service!

        ID id = new ID(new ID(url), "tasmania");

        IGeoResource resource = (IGeoResource) catalog.getById(IGeoResource.class, id, null);

        /*
         * setup the properties so this adapter is enabled
View Full Code Here

    public void testAquire() throws Exception {
        IRepository local = CatalogPlugin.getDefault().getLocal();
        local.acquire(MapGraphicService.SERVICE_URL, null);
       
        // Test ScaleBar
        final ID SCALE_BAR = new ID("mapgraphic:/localhost/mapgraphic#scalebar", null); //$NON-NLS-1$
        IGeoResource scalebarResource = local.getById(IGeoResource.class, SCALE_BAR,
                new NullProgressMonitor());
        assertNotNull(scalebarResource);
       
        // Test Graticule
        final ID GRATICULE = new ID("mapgraphic:/localhost/mapgraphic#graticule", null); //$NON-NLS-1$
        IGeoResource graticuleResource = local.getById(IGeoResource.class, GRATICULE,
                new NullProgressMonitor());
        assertNotNull(graticuleResource);
       
    }
View Full Code Here

        exportButton.setImage(exportImg);
        exportButton.setToolTipText(Messages.PolygonPropertiesEditor_23);
        exportButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected( SelectionEvent e ) {
                IGeoResource geoResource = layer.getGeoResource();
                ID id = geoResource.getID();
                if (id.isFile()) {
                    try {
                        File file = id.toFile();
                        polygonStyleManager.exportStyle(styleWrapper, file);
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }
                } else {
View Full Code Here

        Job addToCatalog = new Job("Add "+file.getName() ){
            @Override
            protected IStatus run(IProgressMonitor monitor) {
                ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
                URL url = new ID( file, null ).toURL();
                IService service = null;
                try {
                    service = localCatalog.acquire( url, monitor );
                }
                catch( IOException unepected ){
View Full Code Here

     *
     * @param localCatalog
     * @param service
     */
    private void addToCatalog( ICatalog localCatalog, IService service ) {
        ID id = service.getID();
        IService found = localCatalog.getById(IService.class, id, new NullProgressMonitor());
        if (found != null) {
            // existing catalog entry to replace
            // (if this is only being done for a "refresh" we may be able to take less
            // drastic action)
View Full Code Here

        exportButton.setImage(exportImg);
        exportButton.setToolTipText(Messages.PointPropertiesEditor_24);
        exportButton.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected( SelectionEvent e ) {
                IGeoResource geoResource = layer.getGeoResource();
                ID id = geoResource.getID();
                if (id.isFile()) {
                    try {
                        File file = id.toFile();
                        pointStyleManager.exportStyle(styleWrapper, file);
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }
                } else {
View Full Code Here

        String[] parts = rid.split(DIVIDER);
        String qualifier = null;
        if (parts.length == 2) {
            qualifier = parts[1];
        }
        ID id;
        if (parts[0].startsWith("file")) { //$NON-NLS-1$
            String[] fileParts = parts[0].split("#", 2); //$NON-NLS-1$
            File file = URLUtils.urlToFile(CorePlugin.createSafeURL(fileParts[0]));
            URL url = CorePlugin.createSafeURL(parts[0]);
            URI uri = CorePlugin.createSafeURI(parts[0]);
            id = new ID(file.getPath() + "#" + fileParts[1], url, file, uri, qualifier); //$NON-NLS-1$
        } else {
            id = new ID(CorePlugin.createSafeURL(parts[0]));
        }

        return id;
    }
View Full Code Here

        geoResourceLock.lock();
        gettingResources.set(true);
        try {

            final ID id = getResourceID();
            if (id == null) {
                return NULL;
            }

            if (geoResources != null && geoResources != NULL)
                return geoResources;

            if (!catalogRef.isLoaded()) {
                catalogRef.load();
            }
            final List<IGeoResource> resourceList = new ArrayList<IGeoResource>();

            final ICatalog connections = CatalogPlugin.getDefault().getLocalCatalog();

            try {
                IProgressMonitor monitor = new NullProgressMonitor();

                IRunnableWithProgress object = new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor) throws InvocationTargetException {
                        try {
                            List<IResolve> resources = connections.find(id.toURL(), monitor);
                            for (IResolve resolve : resources) {
                                if (resolve.getStatus() == Status.BROKEN
                                        || resolve.getStatus() == Status.BROKEN)
                                    continue;
                                if (resolve instanceof IGeoResource) {
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.ID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.