Package org.geotools.data

Examples of org.geotools.data.DataAccessFactory$Param


    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


        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){
                factoryClass = dataStoreFactory.getClass();
            }
           
        } else if (storeInfo instanceof CoverageStoreInfo) {
            AbstractGridFormat format = resourcePool
                    .getGridCoverageFormat((CoverageStoreInfo) storeInfo);
View Full Code Here

     * @param params
     * @return
     */
    public static DataAccess<? extends FeatureType, ? extends Feature> getDataAccess(Map params)
            throws IOException {
        DataAccessFactory factory = aquireFactory(params);
        if (factory == null) {
            return null;
        }

        DataAccess<? extends FeatureType, ? extends Feature> store = factory
                .createDataStore(params);
        if (store == null) {
            return null;
        }

View Full Code Here

     *
     * @return
     */
    public static DataAccessFactory aquireFactory(Map params) {
        for (Iterator i = DataAccessFinder.getAvailableDataStores(); i.hasNext();) {
            DataAccessFactory factory = (DataAccessFactory) i.next();
            initializeDataStoreFactory( factory );
           
            if (factory.canProcess(params)) {
                return factory;
            }
        }

        return null;
View Full Code Here

     *
     * @return
     */
    public static DataAccessFactory aquireFactory(String displayName) {
        for (Iterator i = DataAccessFinder.getAvailableDataStores(); i.hasNext();) {
            DataAccessFactory factory = (DataAccessFactory) i.next();
            initializeDataStoreFactory( factory );
           
            if (factory.getDisplayName().equals(displayName)) {
                return factory;
            }

            if (factory.getClass().toString().equals(displayName)) {
                return factory;
            }
        }

        return null;
View Full Code Here

     */
    public static List listDataStoresDescriptions() {
        List list = new ArrayList();

        for (Iterator i = DataAccessFinder.getAvailableDataStores(); i.hasNext();) {
            DataAccessFactory factory = (DataAccessFactory) i.next();
            initializeDataStoreFactory(factory);
           
            list.add(factory.getDisplayName());
        }

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

                        connectionParameters = DataStoreUtils.getParams(connectionParameters,null);
                       
                        //ensure that the namespace parameter is set for the datastore
                        if (!connectionParameters.containsKey( "namespace")) {
                            //obtain the factory
                            DataAccessFactory factory = null;
                            try {
                                factory = getDataStoreFactory(info);
                            }
                            catch(Exception e ) {
                                //ignore, it will fail later
                            }
                           
                            //if we grabbed the factory, check that the factory actually supports
                            // a namespace parameter, if we could not get the factory, assume that
                            // it does
                            boolean supportsNamespace = true;
                            if ( factory != null ) {
                                supportsNamespace = false;
                                Param[] params = factory.getParametersInfo();
                                for ( Param p : params ) {
                                    if ( "namespace".equalsIgnoreCase( p.key ) ) {
                                        supportsNamespace = true;
                                        break;
                                    }
View Full Code Here

            throw new IllegalArgumentException("Workspace not provided");
        }

        final Catalog catalog = getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();
        DataAccessFactory dsFactory;
        try {
            dsFactory = resourcePool.getDataStoreFactory(storeInfo);
        } catch (IOException e) {
            String msg = (String) new ResourceModel(
                    "AbstractDataAccessPage.cantGetDataStoreFactory").getObject();
            msg += ": " + e.getMessage();
            throw new IllegalArgumentException(msg);
        }
        if (dsFactory == null) {
            String msg = (String) new ResourceModel(
                    "AbstractDataAccessPage.cantGetDataStoreFactory").getObject();
            throw new IllegalArgumentException(msg);
        }

        final IModel model = new CompoundPropertyModel(storeInfo);

        final Form paramsForm = new Form("dataStoreForm", model);
        add(paramsForm);

        paramsForm.add(new Label("storeType", dsFactory.getDisplayName()));
        paramsForm.add(new Label("storeTypeDescription", dsFactory.getDescription()));

        {
            final IModel wsModel = new PropertyModel(model, "workspace");
            final IModel wsLabelModel = new ResourceModel("AbstractDataAccessPage.workspace");
            workspacePanel = new WorkspacePanel("workspacePanel", wsModel, wsLabelModel, true);
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.getModelObjectAsString();
                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

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.