Examples of ICatalog


Examples of org.locationtech.udig.catalog.ICatalog

            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

Examples of org.locationtech.udig.catalog.ICatalog

        prop.addListener(l);
        // to test that a listener is only added once
        prop.addListener(l);
       
        URL id = layer.getID();
        ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
        IGeoResource resource = localCatalog.getById(IGeoResource.class, new ID(id), new NullProgressMonitor());
        IService parent = resource.service(new NullProgressMonitor());
        localCatalog.replace(parent.getID(), parent);
       
        assertEquals(0, changed[0]);
       
        assertTrue(prop.isTrue(layer, "Polygon")); //$NON-NLS-1$
        assertTrue(prop.isTrue(layer, "Polygon")); //$NON-NLS-1$
        assertTrue(prop.isTrue(layer, "Polygon")); //$NON-NLS-1$
        assertTrue(prop.isTrue(layer, "Polygon")); //$NON-NLS-1$

        localCatalog.replace(parent.getID(), parent);
       
        assertEquals(1, changed[0]);
       
        parent=CatalogTests.createResource(null, "ResolveTo").service(new NullProgressMonitor()); //$NON-NLS-1$

        localCatalog.replace(parent.getID(), parent);
        changed[0]=0;
        assertEquals(0, changed[0]);
    }
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

        if (!(selection instanceof IResolve)) {
            return;
        }
        IResolve record = (IResolve) selection;
        if (record instanceof ICatalog) {
            ICatalog catalog = (ICatalog) record;
            try {
                ICatalogInfo info = catalog.getInfo(searchMonitor);
                showInfo(new Info(catalog.getIdentifier(), info));
            } catch (IOException e) {
                CatalogUIPlugin.log("No information for catalog", e); //$NON-NLS-1$
            }
        } else if (record instanceof IService) {
            IService service = (IService) record;
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

            IProgressMonitor progressMonitor ) {
        try {
            URL fileUrl = new File(outputFile).toURI().toURL();
            if (addToCatalog) {
                IServiceFactory sFactory = CatalogPlugin.getDefault().getServiceFactory();
                ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
                List<IService> services = sFactory.createService(fileUrl);
                for( IService service : services ) {
                    catalog.add(service);
                    if (addToActiveMap) {
                        IMap activeMap = ApplicationGIS.getActiveMap();
                        int layerNum = activeMap.getMapLayers().size();
                        List<IResolve> members = service.members(progressMonitor);
                        for( IResolve iRes : members ) {
View Full Code Here

Examples of org.locationtech.udig.catalog.ICatalog

    @Override
    public Collection<IService> getServices() {
        resourceIds.clear();

        final ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
        final Collection<IService> services = new ArrayList<IService>();

        IRunnableWithProgress runnable = new IRunnableWithProgress(){

            public void run( IProgressMonitor monitor ) throws InvocationTargetException,
                    InterruptedException {

                List<IService> availableServices = null;

                if (!list.isEmpty()) {
                    for( Iterator<URL> URLIterator = list.iterator(); URLIterator.hasNext(); ) {
                        URL url = URLIterator.next();

                        try {
                            availableServices = catalog.constructServices(url, monitor);
                            if (!availableServices.isEmpty()) {
                                IService service = availableServices.iterator().next();
                                resourceIds.add(service.getIdentifier());
                                services.add(service);// add the first service
                            }
                        } catch (IOException e) {
                            throw (RuntimeException) new RuntimeException().initCause(e);
                        } finally {
                            List<IService> members = catalog.checkMembers(availableServices);

                            for( Iterator<IService> iterator = members.iterator(); iterator
                                    .hasNext(); ) {
                                IService service = iterator.next();
View Full Code Here

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

Examples of org.locationtech.udig.catalog.ICatalog

        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

Examples of org.locationtech.udig.catalog.ICatalog

     * @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

Examples of org.locationtech.udig.catalog.ICatalog

    /**
     * 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

Examples of org.locationtech.udig.catalog.ICatalog

         * @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
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.