Examples of ICatalog


Examples of org.locationtech.udig.catalog.ICatalog

            }
        }
        if (!mapsetMembers.contains(resource)) {
            mapsetMembers.add(resource);

            ICatalog catalog = parent(null);
            if (catalog instanceof CatalogImpl) {
                IResolveDelta delta = new ResolveDelta(resource, Kind.ADDED);
                IResolveChangeEvent event = new ResolveChangeEvent(this, Type.POST_CHANGE, delta);
                ((CatalogImpl) catalog).fire(event);
            }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

    /**
       * Creates a MemoryDatastore service from an array of features.  Does not add to catalog.
       * @param deleteService
       */
      public static IService getService(SimpleFeature[] features, boolean deleteService) throws IOException {
        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        List<IResolve> services = catalog.find(MemoryServiceExtensionImpl.URL, new NullProgressMonitor());
        IService service=null;
        if( services.isEmpty() ){
          service = createService(catalog);
        }else{
          IResolve resolve=services.get(0);
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

      final SimpleFeatureType featureType) {

    assert featureType != null;

    // new resourece is required because new layer was selected
    final ICatalog catalog = AppGISAdapter.getCatalog();
    assert catalog != null;

    IGeoResource resource = catalog.createTemporaryResource(featureType);

    return resource;
  }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

            }
        }
        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

Examples of org.locationtech.udig.catalog.ICatalog

        }
        return ds;
    }

    private void fire( ResolveChangeEvent event ) {
        ICatalog catalog = parent(new NullProgressMonitor());
        if (catalog instanceof CatalogImpl) {
            ((CatalogImpl) catalog).fire(event);
        }
    }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

        if( !services.isEmpty() ){
            return true;
        }
       
        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        List<IService> availableServices;
       
        monitor.beginTask(Messages.ConnectionState_task, IProgressMonitor.UNKNOWN);
       
        errors = null;
        try {
                // use the context object to try to build connection info
            Object context = getWorkflow().getContext();
   
            if( context instanceof IService ){
                services.add((IService)context);
                //services = Collections.singleton((IService)context);
            }else if (context instanceof IGeoResource){
                IService service = ((IGeoResource) context).service(monitor);
                services.add((IService)context);
                services.add(service);
            }else{
           
                Map<String, Serializable> params = factory.createConnectionParameters(context);
               
                URL url = factory.createConnectionURL(context)
       
                if (params == null && url == null)
                    return false; // could not build connection info
               
                if(url != null){
                    availableServices = catalog.constructServices(url, monitor);
                    if(!availableServices.isEmpty()){
                        services.add(availableServices.iterator().next());
                        return true;
                    }
                }
               
                if(params != null && !params.isEmpty()){
                    availableServices = catalog.constructServices(params, monitor);
                    if(!availableServices.isEmpty()){
                        services.add(availableServices.iterator().next());
                    }
                }
            }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

        }       
        return services;
    }

    private static Collection<IService> searchLocalCatalog( URL url, IProgressMonitor monitor ) {
        ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
       
        List<IResolve> resolves = localCatalog.find(url, monitor);
        ArrayList<IService> services = new ArrayList<IService>();
        for( IResolve iResolve : resolves ) {
            if (iResolve instanceof IService) {
                IService service = (IService) iResolve;
                services.add(service);
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

    public static synchronized void addServiceToCatalog( String serviceFile, IProgressMonitor progressMonitor ) {
        try {
            URL fileUrl = new File(serviceFile).toURI().toURL();
            // add the service to the catalog and map
            IServiceFactory sFactory = CatalogPlugin.getDefault().getServiceFactory();
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            List<IService> services = sFactory.createService(fileUrl);
            for( IService service : services ) {
                catalog.add(service);
            }
        } catch (Exception e) {
            JGrassPlugin.log(
                    "JGrassPlugin problem: eu.hydrologis.udig.catalog.utils#JGrassCatalogUtilities#addServiceToCatalog", e); //$NON-NLS-1$
            e.printStackTrace();
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

                return;
            }
            /*
             * test code to make the catalog understand that the map should be added
             */
            final ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            final JGrassService originalJGrassService = catalog.getById(JGrassService.class, id, monitor);

            /*
             * create the same service
             */
            if (originalJGrassService == null)
                return;
            final URL ID = originalJGrassService.getIdentifier();
            Map<String, Serializable> connectionParams = originalJGrassService.getConnectionParams();
            IServiceFactory locator = CatalogPlugin.getDefault().getServiceFactory();
            final List<IService> rereadService = locator.acquire(ID, connectionParams);

            /*
             * replace the service
             */
            if (rereadService.size() > 0) {
                Runnable refreshCatalogRunner = new Runnable(){
                    public void run() {
                        final IService newJGrassService = rereadService.get(0);
                        catalog.remove(originalJGrassService);
                        catalog.add(newJGrassService);
                    }
                };

                new Thread(refreshCatalogRunner).start();
            }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

     * @param map the map to which to add the resource to
     */
    public static void addResourceFromUrlToMap( URL url, IProgressMonitor progressMonitor, int addPosition, IMap map ) {

        synchronized (url) {
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            // first search the local catalog.
            List<IResolve> matches = catalog.find(url, new SubProgressMonitor(progressMonitor, 2));

            for( IResolve resolve : matches ) {
                List<IResolve> members = null;
                try {
                    List<IGeoResource> geoResources = new ArrayList<IGeoResource>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.