Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.IServiceInfo


        class IServiceComparator implements Comparator<IService> {
           
            public int compare( IService o1, IService o2 ) {
                try {
                    IServiceInfo info1 = o1.getInfo(new SubProgressMonitor(monitor2, 1));
                    IServiceInfo info2 = o2.getInfo(new SubProgressMonitor(monitor2, 1));
                    double metric1 = info1.getMetric();
                    double metric2 = info2.getMetric();
                   
                    if (metric1 > metric2) {
                        return 1;
                    }else if(metric1 < metric2){
                       return -1;
View Full Code Here


                if (service == null) continue;

                monitor3.subTask("connect " + service.getID());
                try {
                    // try connecting
                    IServiceInfo info = service.getInfo(new SubProgressMonitor(monitor3, 10));

                    if (info == null) {
                        CatalogPlugin.trace("unable to connect to " + service.getID(), null);
                        continue; // skip unable to connect
                    }
View Full Code Here

                if( results.isEmpty() ){
                    return createdServices; // nothing was willing to try connecting!
                }
                for( IService service : results ) {
                    try {
                        IServiceInfo info = service.getInfo(new SubProgressMonitor(monitor, 10));
                        if (info == null) {
                            CatalogPlugin.trace("unable to connect to " + service.getID(), null);
                            continue; // skip unable to connect
                        }
                        availableServices.add(service);
View Full Code Here

                    return null;
                }
            }
            protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
                try {
                    return new IServiceInfo("Testing 1", "", "", getIdentifier().toURI(), (URI) null, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                            (URI) null, (new String[]{"Test"}), (ImageDescriptor) null); //$NON-NLS-1$
                } catch (URISyntaxException e) {
                    throw (RuntimeException) new RuntimeException( ).initCause( e );
                }                
            }
        });
        instance.add(new IService(){

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

            public List< ? extends IGeoResource> resources( IProgressMonitor monitor )
                    throws IOException {
              ArrayList<IGeoResource> list = new ArrayList<IGeoResource>();
              list.add( new IGeoResource(){

          @Override
          public <T> T resolve(Class<T> adaptee, IProgressMonitor monitor) throws IOException {
            return super.resolve(adaptee, monitor);
          }
                    protected IGeoResourceInfo createInfo( IProgressMonitor monitor ) throws IOException {
                        return new IGeoResourceInfo("Test Title", "Test Name", "description", null,  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                new Envelope(20,30,0,40), DefaultGeographicCRS.WGS84, new String[0],
                                null);
                    }
                    public <T> boolean canResolve(Class<T> adaptee) {
            return super.canResolve(adaptee);
          }

          public Status getStatus() {
            return null;
          }

          public Throwable getMessage() {
            return null;
          }

          public URL getIdentifier() {
            return null;
          }
               
              });
                return list;
            }

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

            public URL getIdentifier() {
                try {
                    return new URL("http://localhost:1234/testing/2"); //$NON-NLS-1$
                } catch (MalformedURLException e) {
                    return null;
                }
            }
            protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
                try {
                    return new IServiceInfo("Testing 2", "", "", getIdentifier().toURI(), (URI) null, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                            (URI) null, (new String[]{"Test"}), (ImageDescriptor) null); //$NON-NLS-1$
                } catch (URISyntaxException e) {
                    throw (RuntimeException) new RuntimeException( ).initCause( e );
                }
            }
View Full Code Here

   
    protected abstract IService getResolve();

    @Test
    public void testInfo() throws IOException {
        IServiceInfo info = getInfo(getResolve(), null);
        assertNotNull("Info is required", info); //$NON-NLS-1$
    }
View Full Code Here

    }

    @Test
    public void testInfoMonitor() throws IOException {
        FakeProgress monitor = new FakeProgress();
        IServiceInfo info = getInfo(getResolve(), monitor);
        assertNotNull("Info is required", info); //$NON-NLS-1$
    }
View Full Code Here

        assertTrue("Must resolve IServiceInfo.class", getResolve().canResolve(IServiceInfo.class)); //$NON-NLS-1$
    }

    @Test
    public void testResolve() throws IOException {
        IServiceInfo info = resolve(getResolve(), IServiceInfo.class, null);
        if (!isLeaf())
            assertTrue("May not have null info", info != null); //$NON-NLS-1$
    }
View Full Code Here

    }

    @Test
    public void testResolveMonitor() throws IOException {
        FakeProgress monitor = new FakeProgress();
        IServiceInfo info = resolve(getResolve(), IServiceInfo.class, monitor);
        if (!isLeaf())
            assertTrue("May not have null info", info != null); //$NON-NLS-1$
    }
View Full Code Here

                return info.getTitle();
            }
        };
    }
    static public IServiceInfo info( final ServiceInfo info ){
        return new IServiceInfo(){
            public String getAbstract() {
                return info.getDescription();
            }
            public String getDescription() {
                return info.getDescription();
View Full Code Here

TOP

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

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.