Package org.geotools.data

Examples of org.geotools.data.DataStoreFactorySpi


    @Test
    public void testIsAvailable() {
        Iterator list = DataStoreFinder.getAvailableDataStores();
        boolean found = false;
        while (list.hasNext()) {
            DataStoreFactorySpi fac = (DataStoreFactorySpi) list.next();
            if (fac instanceof ShapefileDataStoreFactory) {
                found = true;
                assertNotNull(fac.getDescription());
                break;
            }
        }
        assertTrue("ShapefileDataSourceFactory not registered", found);
    }
View Full Code Here


        java.net.URL url = DataUtilities.fileToURL(file);
        Iterator<DataStoreFactorySpi> it = DataStoreFinder.getAvailableDataStores();
        int count = 0;
        while (it.hasNext()) {
            count++;
            final DataStoreFactorySpi next = it.next();
            System.out.println(next + " " + next.getDisplayName() + " " + next.isAvailable());
        }

        HashMap<String, Serializable> params = new HashMap<String, Serializable>();
        params.put("type", "excel");
        params.put("url", url);
View Full Code Here

        List<FactoryAdapter> adapters = new ArrayList<FactoryAdapter>();

        // look for factories that do accept a file/url and a namespace
        Iterator<DataStoreFactorySpi> it = DataStoreFinder.getAllDataStores();
        while(it.hasNext()) {
            DataStoreFactorySpi factory = it.next();
            Param[] params = factory.getParametersInfo();
           
            if(params == null) {
                LOGGER.fine("DataStore factory " + factory + " returns null from getParametersInfo!");
                continue;
            }
View Full Code Here

        viewer.addSelectionChangedListener(this);
        viewer.setContentProvider(new ArrayContentProvider());
        viewer.setLabelProvider(new LabelProvider(){
            public String getText( Object element ) {
                if (element instanceof DataStoreFactorySpi) {
                    DataStoreFactorySpi factory = (DataStoreFactorySpi) element;
                    return factory.getDisplayName();
                }
                return super.getText(element);
            }
        });
View Full Code Here

        ListCellRenderer cellRenderer = new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index,
                    boolean isSelected, boolean cellHasFocus) {
                super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                DataStoreFactorySpi factory = (DataStoreFactorySpi) value;
                setText( factory.getDisplayName() );
                setToolTipText( factory.getDescription() );
               
                return this;
            }
        };
        list.setCellRenderer(cellRenderer);
View Full Code Here

     */
    public void testSPI() throws MalformedURLException, IOException {

        DataStoreFinder.scanForPlugins();
        final Iterator<DataStoreFactorySpi> it = DataStoreFinder.getAvailableDataStores();
        DataStoreFactorySpi spi = null;

        while (it.hasNext()) {
          spi=it.next();
            if ( spi instanceof SFSDataStoreFactory) {
                break;
            }
        }
        /* we did not find it? */
        assertNotNull(spi);

        /* try with params */
        assertTrue(spi.canProcess(createParams()));
   
    }
View Full Code Here

    String typeName = catalogConfigurationBean.getTypeName();
    if(typeName!=null){
      params.put(Utils.Prop.TYPENAME, catalogConfigurationBean.getTypeName());
    }   
    // SPI
    DataStoreFactorySpi spi=null;
   
    // Now format specific code
    if(extension.equalsIgnoreCase("shp"))
    {
      //
View Full Code Here

      if(!destination.delete())
        throw new IOException("The provided destination maps to an existing file that cannot be deleted:"+destination);
    }
   
    // real work
    final DataStoreFactorySpi dataStoreFactory = new ShapefileDataStoreFactory();
    Map<String, Serializable> params = new HashMap<String, Serializable>();
    params.put("url", destination.toURI().toURL());
    params.put("create spatial index", Boolean.TRUE);
 
    ShapefileDataStore store=null;
    Transaction transaction=null;
    try{
      store = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params);
      store.createSchema(fc.getSchema());
     
      final SimpleFeatureStore featureStore =(SimpleFeatureStore) store.getFeatureSource(fc.getSchema().getName());
      transaction=featureStore.getTransaction();
     
View Full Code Here

            getDataStore(data, task).getFeatureSource(task.getOriginalLayerName());
        return featureSource.getCount(Query.ALL);
    }
   
    public DataStore createDataStore(ImportData data) throws IOException {
        DataStoreFactorySpi dataStoreFactory = factory();

        Map<String,Serializable> params = createConnectionParameters(data);
        if (params != null && dataStoreFactory.canProcess(params)) {
            DataStore dataStore = dataStoreFactory.createDataStore(params);
            if (dataStore != null) {
                return dataStore;
            }
        }
View Full Code Here

        LayerInfo layer = null;
        boolean success = false;
        try {
            store = builder.buildDataStore(layerName);

            DataStoreFactorySpi dataStoreFactory = getOutlineDataStoreFactory(dir);

            Map<String, Serializable> parameters = getOutlineDataStoreParameters(dir,
                    dataStoreFactory);
            NamespaceInfo ns = catalog.getNamespaceByPrefix(ws.getName());
            parameters.put("namespace", ns.getURI());

            store.setType(dataStoreFactory.getDisplayName());
            store.setWorkspace(ws);
            store.getConnectionParameters().putAll(parameters);
            catalog.add(store);

            builder.setStore(store);
View Full Code Here

TOP

Related Classes of org.geotools.data.DataStoreFactorySpi

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.