Examples of IServiceFactory


Examples of org.locationtech.udig.catalog.IServiceFactory

     * Adds the required services into the catalog.
     */
    public void load() {

        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
        synchronized (connectionParams) {
            for( Map.Entry<ID, Map<String, Serializable>> entry : connectionParams.entrySet() ) {
                Map<String, Serializable> params = entry.getValue();
                boolean couldResolve = resolveURLs(params);
                if (!couldResolve) {
                    // if couldn't resolve log the warning and continue. There is no way we can load
                    // the resource
                    ProjectPlugin
                            .log(
                                    "Warning: couldn't find the layer's resources in the catalog and can't construct it because the current map" //$NON-NLS-1$
                                            + " does not have a Resource:" + layer.getID(), //$NON-NLS-1$
                                    new Exception("Failure loading layer")); //$NON-NLS-1$
                    continue;
                }

                List<IService> createdServices = serviceFactory.createService(params);
                updateLayerID(createdServices);
                if (serviceExistsInCatalog(createdServices, catalog)) {
                    continue;
                } else {
                    addServicesToCatalog(createdServices, catalog);
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

       
        int urlProcessCount = 0;
       
        List<IService> availableServices = new ArrayList<IService>();//services already in catalog

        IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();

        monitor.beginTask("Check", 1);
        monitor.subTask("Check available services");

        try {
            List<IService> possible = factory.createService(url);
            monitor.worked(urlProcessCount);

            IProgressMonitor monitor3 = new SubProgressMonitor(monitor, 60);
            monitor3.beginTask("connect", possible.size() * 10);

 
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

        if (monitor == null)
            monitor = new NullProgressMonitor();

        List<IService> availableServices = new ArrayList<IService>();//services already in catalog

        IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();
       
        // IOException used to report a problem connecting; usually we only have one
        // Service willing to try with a given set of parameters so this works out okay
        //
        IOException eek = null;
        try {

            if (params != null && !params.isEmpty()) {
                List<IService> createdServices = factory.createService(params);
                Set<IService> results = new HashSet<IService>(createdServices);
                if( results.isEmpty() ){
                    return createdServices; // nothing was willing to try connecting!
                }
                for( IService service : results ) {
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

        File file = new File("data/point.shp");
        Map<String, Serializable> map = new HashMap<String, Serializable>();
        map.put( "url", file.toURI().toURL() );
        map.put( "fstype", "shape" );
              
        IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
        List<IService> test = serviceFactory.createService(map);
        assertFalse( "Able to connect to shapefile", test.isEmpty() );
       
        boolean found = checkForInstanceOf( test, ShpServiceImpl.class);
        assertTrue( "ShpServiceImpl", found );
    }
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

        File file = new File("data/point.shp");
        Map<String, Serializable> map = new HashMap<String, Serializable>();
        map.put( "url", file.toURI().toURL() );
        map.put( "fstype", "shape-ng" );
       
        IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
        List<IService> test = serviceFactory.createService(map);
       
        boolean found = checkForInstanceOf( test, ShpServiceImpl.class );
        assertTrue( "ShpServiceImpl", !found );
       
        found = checkForInstanceOf( test, DataStoreService.class );
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

        }
    }
    private void loadFileInMap( File file ) throws Exception {
        URL fileUrl = file.toURI().toURL();
        CatalogPlugin cp = CatalogPlugin.getDefault();
        IServiceFactory sf = cp.getServiceFactory();
        List<IService> services = sf.createService(fileUrl);
        List<IGeoResource> resources = new ArrayList<IGeoResource>();
        for( IService service : services ) {
            List< ? extends IGeoResource> geoResource = service.resources(new NullProgressMonitor());
            if (geoResource != null) {
                if (service instanceof JGrassService) {
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

    public MapGraphicWizardPage() {
        super(Messages.MapGraphic_title);
    }

    public List<IService> getResources( IProgressMonitor monitor ) throws Exception {
        IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();
        List<IService> services = factory.createService(MapGraphicService.SERVICE_URL);

        return services;
    }
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

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

     * @throws IOException
     */
    List<IService> acquireGoodServices( URL url, IProgressMonitor monitor ) throws IOException {
        if (url == null)
            return Collections.<IService>emptyList();
        IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();
        List<IService> result = factory.createService(url);
        if (result.isEmpty()) {
            throw new IOException("Could not acquire a working service for " + url); //$NON-NLS-1$
        }
        List<IService> good = new ArrayList<IService>();
        IOException notGood = null;
View Full Code Here

Examples of org.locationtech.udig.catalog.IServiceFactory

    @SuppressWarnings("unchecked")
    private void addToCatalog( File file, Data data ) throws IOException {
        IProgressMonitor monitor = ProgressManager.instance().get();

        // add the service to the catalog
        IServiceFactory sFactory = CatalogPlugin.getDefault().getServiceFactory();
        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        URL url = URLUtils.fileToURL(file);
        List<IService> services = sFactory.createService(url);
        monitor.beginTask("add to catalog", services.size() * 10);
        for( IService service : services ) {
            IService registeredService = catalog.add(service);
            SubProgressMonitor monitor2 = new SubProgressMonitor(monitor, 10);
            List<IGeoResource> contents = (List<IGeoResource>) registeredService.resources(monitor2);
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.