Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.ICatalog


    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);
            data.addNewResources( contents );
        }
    }
View Full Code Here


        final Collection<IService> services = connState.getServices();
        if (services == null || services.isEmpty())
            return false;

        // add the services to the catalog
        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        catalog.add(services.iterator().next());// add the first service to catalog

        // for (IService service : services) {
        // catalog.add(service);
        // }
View Full Code Here

     * @param servers List of IService handles to reset
     * @param monitor Progress Monitor used to interrupt the command if needed
     */
    public static void reset( List<IService> servers, IProgressMonitor monitor ) {
        IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();

        for( IService original : servers ) {
            try {
                final ID id = original.getID();
                CatalogUIPlugin.trace("Reset service " + original.getIdentifier()); //$NON-NLS-1$

                Map<java.lang.String, java.io.Serializable>
                    connectionParams = original.getConnectionParams();

                IService replacement = null; // unknown
                TEST: for( IService candidate : serviceFactory.createService(connectionParams) ) {
                    try {
                        CatalogUIPlugin.trace(id + " : connecting"); //$NON-NLS-1$
                        IServiceInfo info = candidate.getInfo(monitor);
                       
                        CatalogUIPlugin.trace(id + " : found " + info.getTitle()); //$NON-NLS-1$
                        replacement = candidate;
                       
                        break TEST;
                    } catch (Throwable t) {
                        CatalogUIPlugin.trace(id + " : ... " + t.getLocalizedMessage()); //$NON-NLS-1$
                    }
                }
                if (replacement == null) {
                    CatalogUIPlugin.log("Could not reset "+id+" - as we could not connect!",null); //$NON-NLS-1$ //$NON-NLS-2$
                    continue; // skip - too bad we cannot update status the original
                }
                catalog.replace(id, replacement);               
            } catch (Throwable failed) {
                CatalogUIPlugin.log("Reset failed", failed); //$NON-NLS-1$
            }
        }
    }
View Full Code Here

    /**
     * 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);
View Full Code Here

         * @param arg0 the input data
         * @return Object[]
         */
        public Object[] getElements( Object arg0 ) {
            // add the service to the catalog
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            ArrayList<IResolve> neededCatalogMembers = null;
            try {
                List< ? extends IResolve> allCatalogMembers = catalog.members(null);
                // for jgrass locations we extract the mapset out of the
                // locations = from
                // JGrassService
                neededCatalogMembers = new ArrayList<IResolve>();
                for( IResolve catalogMember : allCatalogMembers ) {
View Full Code Here

         * @param arg0 the input data
         * @return Object[]
         */
        public Object[] getElements( Object arg0 ) {
            // add the service to the catalog
            ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
            ArrayList<IResolve> neededCatalogMembers = null;
            try {
                List< ? extends IResolve> allCatalogMembers = catalog.members(null);
                // for jgrass locations add the service
                neededCatalogMembers = new ArrayList<IResolve>();
                for( IResolve catalogMember : allCatalogMembers ) {
                    if (catalogMember.canResolve(DataStore.class)) {
                        neededCatalogMembers.add(catalogMember);
View Full Code Here

    @Ignore
    @Test
    public void testNormal() throws Exception {
        Object context = getContext();
       
        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
       
        List members = catalog.members(new DummyMonitor());
        if (!members.isEmpty()) {
            //clear the catalog
            for (Iterator itr = members.iterator(); itr.hasNext();) {
                IService service = (IService)itr.next();
                catalog.remove(service);
            }
        }
        members = catalog.members(new DummyMonitor());
        assertTrue(members.isEmpty());

        runMapImport(context);
       
        IMap map = ApplicationGIS.getActiveMap();
View Full Code Here

    @Ignore
    @Test
    public void testMultiResource() throws Exception {
        Object context = DummyMultiResourceService.url;
       
        ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
       
        List members = catalog.members(new DummyMonitor());
        if (!members.isEmpty()) {
            //clear the catalog
            for (Iterator itr = members.iterator(); itr.hasNext();) {
                IService service = (IService)itr.next();
                catalog.remove(service);
            }
        }
        members = catalog.members(new DummyMonitor());
        assertTrue(members.isEmpty());
       

        final WorkflowWizard workflowWizard = mapImport.getDialog().getWorkflowWizard();
    workflowWizard.getWorkflow()
View Full Code Here

          if (result != null) {
            for (ShapefileDataStore ds : allDatastores) {
              CoordinateReferenceSystem crs = ds.getSchema().getCoordinateReferenceSystem();
              if (!CRS.equalsIgnoreMetadata(result, crs))
                ds.forceSchemaCRS(result);
              ICatalog catalog = CatalogPlugin.getDefault()
                  .getLocalCatalog();
              List<IResolve> members = catalog
                  .members(new NullProgressMonitor());
              for (IResolve resolve : members) {
                ShapefileDataStore store = resolve.resolve(
                    ShapefileDataStore.class,
                    new NullProgressMonitor());
                if (store != null) {
                  if (ds.getSchema().getTypeName().equals(
                      store.getSchema().getTypeName())) {
                    ShpServiceExtension fac = new ShpServiceExtension();
                    Map<String, Serializable> params = fac
                        .createParams(resolve
                            .getIdentifier());
                    IService replacement = fac
                        .createService(resolve
                            .getIdentifier(),
                            params);
                    catalog.replace(
                        resolve.getID(),
                        replacement);
                  }
                }
              }
View Full Code Here

        for( Resource r : resources ) {
            File file=new File(r.getURI().toFileString());
            deleteFile(file);
        }
       
        ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
        List< ? extends IResolve> services = localCatalog.members(null);
        for( IResolve resolve : services ) {
            localCatalog.remove((IService) resolve);
        }
       
       
    }
View Full Code Here

TOP

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

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.