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; }
public DataAccess<FeatureType, Feature> createDataStore(Map params) 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();) { String parentLocation; parentLocation = DataUtilities.urlToFile(configFileUrl).getParent(); File includedConfig = new File(parentLocation, it.next()); if (!includedConfig.exists()) { throw new RuntimeException( "Please check that the includedTypes location is correct: \n '" + includedConfig.getPath() + "' doesn't exist!"); } URL relatedConfigURL = DataUtilities.fileToURL(includedConfig); params.put("url", relatedConfigURL); // this will register the related data access, to enable feature chaining createDataStore(params); } mappings = AppSchemaDataAccessConfigurator.buildMappings(config); dataStore = new AppSchemaDataAccess(mappings); return dataStore; }