/** * Takes a config object and creates a set of mappings. * * <p>In the process will parse xml schemas to geotools' Feature Model types and descriptors, * connect to source datastores and build the mapping objects from source FeatureTypes to the * target ones. * * @param config DOCUMENT ME! * @return a Set of {@link org.geotools.data.complex.FeatureTypeMapping} source to target * FeatureType mapping definitions * @throws IOException if any error occurs while creating the mappings */ public static Set<FeatureTypeMapping> buildMappings(AppSchemaDataAccessDTO config) throws IOException { return buildMappings(config, new DataAccessMap()); }
public DataAccess<FeatureType, Feature> createDataStore( Map params, boolean hidden, DataAccessMap sourceDataStoreMap) throws IOException { Set<FeatureTypeMapping> mappings; AppSchemaDataAccess dataStore; URL configFileUrl = (URL) AppSchemaDataAccessFactory.URL.lookUp(params); XMLConfigDigester configReader = new XMLConfigDigester(); AppSchemaDataAccessDTO config = configReader.parse(configFileUrl); // load related types that are mapped separately, and not visible on their own // this is when the related types are not feature types, so they don't appear // on getCapabilities, and getFeature also shouldn't return anything etc. List<String> includes = config.getIncludes(); for (Iterator<String> it = includes.iterator(); it.hasNext(); ) { params.put("url", buildIncludeUrl(configFileUrl, it.next())); // this will register the related data access, to enable feature chaining; // sourceDataStoreMap is passed on to keep track of the already created source data // stores // and avoid creating the same data store twice (this enables feature iterators sharing // the same transaction to re-use the connection instead of opening a new one for each // joined type) createDataStore(params, true, sourceDataStoreMap); } mappings = AppSchemaDataAccessConfigurator.buildMappings(config, sourceDataStoreMap); dataStore = new AppSchemaDataAccess(mappings, hidden); return dataStore; }