Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.IService


        if(service == null){

          List<IService> services = CatalogPlugin.getDefault().getServiceFactory().createService(url);
          Iterator<IService> srv = services.iterator();
          while(srv.hasNext()){
            IService s = srv.next();
            if(s.canResolve(WFSDataStore.class)){
              service = s;
            }
          }

            if(service == null){
View Full Code Here


                }
            }
        }
        ID id = shapefile.getID();
    IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
    IService newService = serviceFactory.createService(parametersMap).iterator().next();
    ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
    localCatalog.replace(id, newService );
        return null;
    }
View Full Code Here

    protected abstract boolean mutable();

    @Test(timeout = BLOCK)
    public void testAddService() {
        if (mutable()) {
            IService service = new IService(){

                public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public List< ? extends IGeoResource> resources( IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public Map<String, Serializable> getConnectionParams() {
                    return null;
                }

                public <T> boolean canResolve( Class<T> adaptee ) {
                    return false;
                }

                public Status getStatus() {
                    return null;
                }

                public Throwable getMessage() {
                    return null;
                }

                protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
                    return null;
                }
                public URL getIdentifier() {
                    try {
                        return new URL("http://localhost/udig-tests"); //$NON-NLS-1$
                    } catch (MalformedURLException e) {
                        fail(e.toString());
                        return null;
                    }
                }

            };
            getResolve().add(service);
            List<IResolve> services = getResolve().find(service.getIdentifier(), null);
            assertNotNull("should return a value", services); //$NON-NLS-1$
            assertEquals("Should only return one value", 1, services.size()); //$NON-NLS-1$
            assertTrue("The Service returned is not my service :(", services.contains(service)); //$NON-NLS-1$
        }
    }
View Full Code Here

    }

    @Test(timeout = BLOCK)
    public void testRemoveService() {
        if (mutable()) {
            IService service = new IService(){

                public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public List< ? extends IGeoResource> resources( IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public Map<String, Serializable> getConnectionParams() {
                    return null;
                }

                public <T> boolean canResolve( Class<T> adaptee ) {
                    return false;
                }

                public Status getStatus() {
                    return null;
                }

                protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
                    return null;
                }
                public Throwable getMessage() {
                    return null;
                }

                public URL getIdentifier() {
                    try {
                        return new URL("http://localhost/udig-tests"); //$NON-NLS-1$
                    } catch (MalformedURLException e) {
                        fail(e.toString());
                        return null;
                    }
                }

            };
            List<IResolve> services = getResolve().find(service.getIdentifier(), null);
            if (!services.contains(service))
                getResolve().add(service);

            getResolve().remove(service);
            services = getResolve().find(service.getIdentifier(), null);
            assertFalse("Shouldn't contain the service", services.contains(service)); //$NON-NLS-1$
        }
    }
View Full Code Here

    }

    @Test(timeout = BLOCK)
    public void testReplaceService() {
        if (mutable()) {
            IService service1 = new IService(){

                public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public List< ? extends IGeoResource> resources( IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public Map<String, Serializable> getConnectionParams() {
                    return null;
                }

                public <T> boolean canResolve( Class<T> adaptee ) {
                    return false;
                }

                protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
                    return null;
                }
                public Status getStatus() {
                    return null;
                }

                public Throwable getMessage() {
                    return null;
                }

                public URL getIdentifier() {
                    try {
                        return new URL("http://localhost/udig-tests/1"); //$NON-NLS-1$
                    } catch (MalformedURLException e) {
                        fail(e.toString());
                        return null;
                    }
                }

            };
            IService service2 = new IService(){

                public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public List< ? extends IGeoResource> resources( IProgressMonitor monitor )
                        throws IOException {
                    return null;
                }

                public Map<String, Serializable> getConnectionParams() {
                    return null;
                }

                protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
                    return null;
                }
                public <T> boolean canResolve( Class<T> adaptee ) {
                    return false;
                }

                public Status getStatus() {
                    return null;
                }

                public Throwable getMessage() {
                    return null;
                }

                public URL getIdentifier() {
                    try {
                        return new URL("http://localhost/udig-tests/2"); //$NON-NLS-1$
                    } catch (MalformedURLException e) {
                        fail(e.toString());
                        return null;
                    }
                }

            };
            getResolve().add(service1);
            getResolve().replace(service1.getID(), service2);
            List<IResolve> services = getResolve().find(service2.getIdentifier(), null);
            assertFalse("Shouldn't contain the service", services.contains(service1)); //$NON-NLS-1$
            assertTrue("Should contain the service", services.contains(service2)); //$NON-NLS-1$
        }
    }
View Full Code Here

   
    addShpService(url,resources,monitor);
  }
  private void addAlertsMapgraphic(IProgressMonitor monitor,
      List<IGeoResource> resources) throws IOException {
    IService service = CatalogPlugin.getDefault().getLocalCatalog().acquire(MapGraphicService.SERVICE_URL,monitor);
    String desiredIdString = MapGraphicService.SERVICE_URL+"#"+ShowAlertsMapGraphic.EXTENSION_ID;
    for (IGeoResource resource : service.resources(null)) {
      String idString = resource.getID().toString();
      if(idString.equals(desiredIdString)) {
        resources.add(resource);
        return;
      }
View Full Code Here

    }
    throw new IllegalStateException("Unable to find " + desiredIdString + " mapgraphic");
  }
 
  private void addShpService(URL url,List<IGeoResource> resources, IProgressMonitor monitor) throws IOException {
    IService service = CatalogPlugin.getDefault().getLocalCatalog().acquire(url,monitor);
   
    resources.addAll(service.resources(monitor));
  }
View Full Code Here

            }

        };
        getResolve().addCatalogListener(listner);

        IService service = new IService(){

            public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor ) throws IOException {
                return null;
            }
View Full Code Here

                    if (monitor.isCanceled()) {
                        return Status.CANCEL_STATUS;
                    }

                    try {
                        IService service = resource.service(monitor);
                        CatalogPlugin.getDefault().getLocalCatalog().add(service);

                        Layer layer = factory.createLayer(resource);
                        if (layer != null) {
                            layers.add(layer);
View Full Code Here

    }

    private List<IGeoResource> handleResolve( IResolve resolve, IProgressMonitor monitor )
            throws IOException {
        if( resolve instanceof IService ){
            IService service = (IService) resolve;
            resources(service.resources(monitor));
        }
        return Collections.emptyList();
    }
View Full Code Here

TOP

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

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.