Examples of IServiceInfo


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

Examples of org.locationtech.udig.catalog.IServiceInfo

    /* check the fields we catre about */
    protected static boolean check( IService service, AST pattern ) {
        if (pattern == null) {
            return false;
        }
        IServiceInfo info;
        try {
            info = service == null ? null : service.getInfo(null);
        } catch (IOException e) {
            info = null;
            CatalogPlugin.log(null, e);
        }
        boolean t = false;
        if (info != null) {
            if (info.getTitle() != null)
                t = pattern.accept(info.getTitle());
            if (!t && info.getKeywords() != null) {
                String[] keys = info.getKeywords().toArray(new String[0]);
                for( int i = 0; !t && i < keys.length; i++ )
                    if (keys[i] != null)
                        t = pattern.accept(keys[i]);
            }
            if (!t && info.getSchema() != null)
                t = pattern.accept(info.getSchema().toString());
            if (!t && info.getAbstract() != null)
                t = pattern.accept(info.getAbstract());
            if (!t && info.getDescription() != null)
                t = pattern.accept(info.getDescription());
        }
        return t;
    }
View Full Code Here

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

Examples of org.locationtech.udig.catalog.IServiceInfo

                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

Examples of org.locationtech.udig.catalog.IServiceInfo

                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

Examples of org.locationtech.udig.catalog.IServiceInfo

                    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

Examples of org.locationtech.udig.catalog.IServiceInfo

   
    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

Examples of org.locationtech.udig.catalog.IServiceInfo

    }

    @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

Examples of org.locationtech.udig.catalog.IServiceInfo

        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

Examples of org.locationtech.udig.catalog.IServiceInfo

    }

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