Package org.geotools.data

Examples of org.geotools.data.DataAccess


        if( catalog.getResourcePool().getFeatureTypeAttributeCache().containsKey( featureTypeId ) ){
             List<AttributeTypeInfo> attributesList = catalog.getResourcePool().getFeatureTypeAttributeCache().get( featureTypeId );
             assertNull( "attributes cleared", attributesList );
        }
        if( catalog.getResourcePool().getDataStoreCache().containsKey( dataStoreId ) ){
            DataAccess dataStore = catalog.getResourcePool().getDataStoreCache().get( dataStoreId );
            List<String> names = dataStore.getNames();
            assertTrue( names.contains("PrimativeGeoFeature"));
        }
    }
View Full Code Here


        }
        featureType.setEnabled(true);
       
        // now, does the feature type exist? If not, create it
        DataStoreInfo ds = catalog.getDataStoreByName( workspace, dataStore );
        DataAccess gtda = ds.getDataStore(null);
        if (gtda instanceof DataStore) {
            String typeName = featureType.getName();
            if(featureType.getNativeName() != null) {
                typeName = featureType.getNativeName();
            }
            boolean typeExists = false;
            DataStore gtds = (DataStore) gtda;
            for(String name : gtds.getTypeNames()) {
                if(name.equals(typeName)) {
                    typeExists = true;
                    break;
                }
            }

            //check to see if this is a virtual JDBC feature type
            MetadataMap mdm = featureType.getMetadata();
            boolean virtual = mdm != null && mdm.containsKey(FeatureTypeInfo.JDBC_VIRTUAL_TABLE);

            if(!virtual && !typeExists) {
                gtds.createSchema(buildFeatureType(featureType));
                // the attributes created might not match up 1-1 with the actual spec due to
                // limitations of the data store, have it re-compute them
                featureType.getAttributes().clear();
                List<String> typeNames = Arrays.asList(gtds.getTypeNames());
                // handle Oracle oddities
                // TODO: use the incoming store capabilites API to better handle the name transformation
                if(!typeNames.contains(typeName) && typeNames.contains(typeName.toUpperCase())) {
                    featureType.setNativeName(featureType.getName().toLowerCase());
                }
            }
        }
       
        CatalogBuilder cb = new CatalogBuilder(catalog);
        cb.initFeatureType( featureType );

        //attempt to fill in metadata from underlying feature source
        try {
            FeatureSource featureSource =
                    gtda.getFeatureSource(new NameImpl(featureType.getNativeName()));
            if (featureSource != null) {
                cb.setupMetadata(featureType, featureSource);
            }
        }
        catch(Exception e) {
View Full Code Here

    public CatalogRepository(Catalog catalog) {
        this.catalog = catalog;
    }

    public DataStore dataStore(Name name) {
        DataAccess da = access(name);
        if ( da instanceof DataStore ) {
            return (DataStore) da;
        }
       
        LOGGER.severe( name + " is not a data store.");
View Full Code Here

            if ( !ds.isEnabled() ) {
                continue;
            }
           
            try {
                DataAccess da = ds.getDataStore( null );
                if ( da instanceof DataStore ) {
                    dataStores.add( (DataStore) da );
                }
            }
            catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.geotools.data.DataAccess

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.