Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.IServiceFactory


 
  @Before
  public void setUp() throws Exception {
    //get a georesource
    ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
    IServiceFactory sFactory
      = CatalogPlugin.getDefault().getServiceFactory();
   
    HashMap params = new HashMap();
    params.put("dummy", DummyService.url);
   
    List<IService> services = sFactory.createService(params);
    service = services.get(0);
   
    CreateMapCommand cmCommand =
      new CreateMapCommand(null,(List<IGeoResource>) service.resources(null),null);
    ProjectPlugin.getPlugin().getProjectRegistry().getDefaultProject()
View Full Code Here


   */
  public static void addFileToCatalogLong() throws Exception {
    File file = new File( "C:\\data\\cities.shp" );
    URL url = file.toURI().toURL();
   
    IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
    List<IService> created = serviceFactory.createService( url );
   
    IRepository local = CatalogPlugin.getDefault().getLocal();
    for( IService service : created ){
        IService registered = local.add(service);
        //...
View Full Code Here

       
        URL fileUrl = FileLocator.toFileURL( url );
        System.out.println("Bundle URL"+ fileUrl );
       
        //get the service factory
        IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();
       
        //create the service
       
        List<IService> services = factory.createService( fileUrl );
       
        //ensure the service was created
        assertNotNull(services);
        assertEquals(1, services.size() );
       
View Full Code Here

     *
     * @param destination
     * @throws MalformedURLException
     */
  private void addToCatalog(File destination) throws MalformedURLException {
    IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
    URL url = DataUtilities.fileToURL( destination );
        List<IService> services = serviceFactory.createService(url);
    ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();;
    for (IService service : services) {
      localCatalog.add(service);
    }
  }
View Full Code Here

        }
        Activator instance = Activator.getDefault();
        assertNotNull("Run as a JUnit Plug-in Test", instance);

        // get the service factory
        IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();

        // create the service
        URL url = new URL( getCapabilities );
        List<IService> services = factory.createService(url);

        // ensure the service was created
        assertNotNull(services);
        assertEquals(1, services.size());
View Full Code Here

    }

    @Override
    public boolean performDrop( Object data ) {

        IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
        IRepository local = CatalogPlugin.getDefault().getLocal();
       
        if (data instanceof URL) {
            URL url = (URL) data;
            try {
                local.acquire( url, null )// add to catalog if needed
               
            } catch (IOException e) {
                CatalogUIPlugin.log( "Drag and Drop "+url, e);
            }
            //List<IService> candidates = serviceFactory.createService((URL) data);
        } else if (data instanceof java.util.Map) {
            java.util.Map<String, Serializable> connectionParams = (java.util.Map<String, Serializable>) data;
            try {
                local.acquire(connectionParams, null);
            } catch (IOException e) {
                CatalogUIPlugin.log( "Drag and Drop "+connectionParams, e);
            }
            //List<IService> candidates = serviceFactory.createService( connectionParams );           
        } else if (data instanceof String || data instanceof String[]) {
            List<URL> urls = null;
            if (data instanceof String) {
                urls = CorePlugin.stringsToURLs((String) data);
            } else {
                urls = CorePlugin.stringsToURLs((String[]) data);
            }
            for( URL url : urls ) {
                List<IService> services = serviceFactory
                        .createService(url);
                for( IService service : services ) {
                    CatalogPlugin.getDefault().getLocalCatalog().add(service);
                }
            }
View Full Code Here

    public void addServiceToCatalogAndMap( String outputFile, boolean addToCatalog, boolean addToActiveMap,
            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();
View Full Code Here

      ApplicationGIS.addLayersToMap(map, Collections.singletonList(tiffResource), -1);
    }
  }

  private IGeoResource getTiffResource(URL url) {
    IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();
    List<IService> services = factory.createService(url);

    if (services.isEmpty()) {
      return null;
    }
    for (IService service : services) {
View Full Code Here

     * up each time) will be in trouble.
     * @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$
View Full Code Here

        for( IResolve service : services ) {
            if (service.canResolve(type)) {
                return service.getIdentifier();
            }
        }
        IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
        List<IService> candidates = serviceFactory.createService(url);
        try {
            for( Iterator<IService> i=candidates.iterator(); i.hasNext();){
                IService service = i.next();
                if (service.canResolve(type)) {
                    IService registered = local.add(service);
                    i.remove(); // don't clean this one up
                    return registered.getIdentifier();
                }
            }
        }
        finally {
            serviceFactory.dispose( candidates, null );
        }
        // It is okay if we don't find anything, the user interface
        // will let the user know - tempting to force a broken WMS
        // handle onto the catalog though
        return url;
View Full Code Here

TOP

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

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.