Package org.geotools.data

Examples of org.geotools.data.DataAccessFactory$Param


        final IModel model = storeEditForm.getModel();
        final DataStoreInfo info = (DataStoreInfo) model.getObject();
        final Catalog catalog = getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();
        DataAccessFactory dsFactory;
        try {
            dsFactory = resourcePool.getDataStoreFactory(info);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        final Map<String, ParamInfo> paramsMetadata = new LinkedHashMap<String, ParamInfo>();

        {
            final boolean isNew = null == info.getId();
            final Param[] dsParams = dsFactory.getParametersInfo();
            for (Param p : dsParams) {
                ParamInfo paramInfo = new ParamInfo(p);
                paramsMetadata.put(p.key, paramInfo);

                if (isNew) {
View Full Code Here


        Catalog catalog = storeInfo.getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();

        if (storeInfo instanceof DataStoreInfo) {
            DataAccessFactory dataStoreFactory = null;
            try {
                dataStoreFactory = resourcePool.getDataStoreFactory((DataStoreInfo) storeInfo);
            } catch (IOException e) {
                LOGGER.log(Level.INFO, "factory class for storeInfo " + storeInfo.getName()
                        + " not found", e);
            }
           
            if(dataStoreFactory != null){
                return getStoreIcon(dataStoreFactory.getClass());
            }
           
        } else if (storeInfo instanceof CoverageStoreInfo) {
            AbstractGridFormat format = resourcePool
                    .getGridCoverageFormat((CoverageStoreInfo) storeInfo);
View Full Code Here

    public void testDataStoreFactoryInitialized() {
        HashMap params = new HashMap();
        params.put( H2DataStoreFactory.DBTYPE.key, "h2");
        params.put( H2DataStoreFactory.DATABASE.key, "test" );
       
        DataAccessFactory f = DataStoreUtils.aquireFactory( params );
        assertNotNull( f );
        assertTrue( f instanceof H2DataStoreFactory );
       
        assertEquals( testData.getDataDirectoryRoot(), ((H2DataStoreFactory)f).getBaseDirectory() );
       
View Full Code Here

     * is not available.
     *
     * @throws IOException Any I/O errors.
     */
    public DataAccessFactory getDataStoreFactory( DataStoreInfo info ) throws IOException {
        DataAccessFactory factory = null;
   
        if ( info.getType() != null ) {
            factory = DataStoreUtils.aquireFactory( info.getType() );   
        }
   
View Full Code Here

                        // urls which are relative to the data directory
                        // TODO: find a better way to do this
                        connectionParameters = ResourcePool.getParams(connectionParameters, catalog.getResourceLoader() );
                       
                        // obtain the factory
                        DataAccessFactory factory = null;
                        try {
                            factory = getDataStoreFactory(info);
                        } catch(IOException e) {
                            throw new IOException("Failed to find the datastore factory for " + info.getName()
                                    + ", did you forget to install the store extension jar?");
                        }
                        Param[] params = factory.getParametersInfo();
                       
                        //ensure that the namespace parameter is set for the datastore
                        if (!connectionParameters.containsKey( "namespace") && params != null) {
                            //if we grabbed the factory, check that the factory actually supports
                            // a namespace parameter, if we could not get the factory, assume that
View Full Code Here

        expect(dataAccessFactory.getFileExtensions()).andReturn(new String[] { ".CUSTOM" }).anyTimes();
        replay(dataAccessFactory);

        factoryProvider.setDataStoreFactories(Collections.singletonList(dataAccessFactory));

        DataAccessFactory factory = DataStoreFileResource.lookupDataStoreFactory("custom");
        assertSame("REST API did not find custom data store", dataAccessFactory, factory);
    }
View Full Code Here

            //only datastores supposed at this time, TODO: fix this
            return Collections.emptySet();
        }

        //find this store object data access factory
        DataAccessFactory factory;
        try {
            factory = getCatalog().getResourcePool().getDataStoreFactory((DataStoreInfo) info);
        } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Error looking up factory for store : " + info + ". Unable to " +
                "encrypt connection parameters.", e);
            return Collections.emptySet();
        }

        if (factory == null) {
            LOGGER.warning("Could not find factory for store : " + info + ". Unable to encrypt " +
                "connection parameters.");
            return Collections.emptySet();
        }

        //if factory returns no info no need to continue
        if (factory.getParametersInfo() == null) {
            return Collections.emptySet();
        }

        Set<String> toEncrypt = CACHE.get(factory.getClass());
        if (toEncrypt!=null) {
            return toEncrypt;
        }

        synchronized (CACHE) {
            toEncrypt = CACHE.get(info.getClass());
            if (toEncrypt!=null) {
                return toEncrypt;
            }
           
            toEncrypt = Collections.emptySet();
            if (info != null && info.getConnectionParameters() != null) {
                toEncrypt = new HashSet<String>(3);
                for (Param p : factory.getParametersInfo()) {
                    if (p.isPassword()) {
                        toEncrypt.add(p.getName());
                    }
                }
            }
            CACHE.put(factory.getClass(), toEncrypt);
        }
        return toEncrypt;
    }
View Full Code Here

        Catalog catalog = storeInfo.getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();

        if (storeInfo instanceof DataStoreInfo) {
            DataAccessFactory dataStoreFactory = null;
            try {
                dataStoreFactory = resourcePool.getDataStoreFactory((DataStoreInfo) storeInfo);
            } catch (IOException e) {
                LOGGER.log(Level.INFO, "factory class for storeInfo " + storeInfo.getName()
                        + " not found", e);
            }
           
            if(dataStoreFactory != null){
                return getStoreIcon(dataStoreFactory.getClass());
            }
           
        } else if (storeInfo instanceof CoverageStoreInfo) {
            AbstractGridFormat format = resourcePool
                    .getGridCoverageFormat((CoverageStoreInfo) storeInfo);
View Full Code Here

        final CatalogIconFactory icons = CatalogIconFactory.get();
        final ListView dataStoreLinks = new ListView("vectorResources", sortedDsNames) {
            @Override
            protected void populateItem(ListItem item) {
                final String dataStoreFactoryName = item.getDefaultModelObjectAsString();
                final DataAccessFactory factory = getAvailableDataStores()
                        .get(dataStoreFactoryName);
                final String description = factory.getDescription();
                SubmitLink link;
                link = new SubmitLink("resourcelink") {
                    @Override
                    public void onSubmit() {
                        setResponsePage(new DataAccessNewPage(dataStoreFactoryName));
                    }
                };
                link.setEnabled(thereAreWorkspaces);
                link.add(new Label("resourcelabel", dataStoreFactoryName));
                item.add(link);
                item.add(new Label("resourceDescription", description));
                Image icon = new Image("storeIcon", icons.getStoreIcon(factory.getClass()));
                // TODO: icons could provide a description too to be used in alt=...
                icon.add(new AttributeModifier("alt", true, new Model("")));
                item.add(icon);
            }
        };
View Full Code Here

            availableDataStores = DataStoreUtils.getAvailableDataStoreFactories().iterator();

            Map<String, DataAccessFactory> storeNames = new HashMap<String, DataAccessFactory>();

            while (availableDataStores.hasNext()) {
                DataAccessFactory factory = availableDataStores.next();
                if(factory.getDisplayName() != null) {
                    storeNames.put(factory.getDisplayName(), factory);
                }
            }
            dataStores = storeNames;
        }
        return dataStores;
View Full Code Here

TOP

Related Classes of org.geotools.data.DataAccessFactory$Param

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.