AppSchemaDataAccessDTO configDto = new AppSchemaDataAccessDTO(); configDto.setBaseSchemasUrl(dataStoreConfigUrl.toExternalForm());
/** Build the catalog for this data access. */ private SchemaCatalog buildCatalog() { String catalogLocation = config.getCatalog(); if (catalogLocation == null) { return null; } else { URL baseUrl; try { baseUrl = new URL(config.getBaseSchemasUrl()); URL resolvedCatalogLocation = resolveResourceLocation(baseUrl, catalogLocation); return SchemaCatalog.build(resolvedCatalogLocation); } catch (MalformedURLException e) { LOGGER.warning( "Malformed URL encountered while setting OASIS catalog location. " + "Mapping file URL: " + config.getBaseSchemasUrl() + " Catalog location: " + config.getCatalog() + " Detail: " + e.getMessage()); return null; } } }
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; }
AppSchemaDataAccessConfigurator.LOGGER.finer("about to parse target schemas"); final URL baseUrl = new URL(config.getBaseSchemasUrl()); final List schemaFiles = config.getTargetSchemasUris();
config = new AppSchemaDataAccessDTO(); config.setSourceDataStores( new ArrayList() { config.setBaseSchemasUrl(url.toExternalForm()); config.setNamespaces( new HashMap<String, String>() { config.setTargetSchemasUris( new ArrayList<String>() { config.setCatalog("mappedPolygons.oasis.xml");
mappings.add(dtoMappingName); mappings.add(duplicate); config.setTypeMappings(mappings); AppSchemaDataAccess da = new AppSchemaDataAccess(AppSchemaDataAccessConfigurator.buildMappings(config)); mappings.add(dtoMappingName); mappings.add(dtoNoMappingName); config.setTypeMappings(mappings); assertTrue(config.getTypeMappings().containsAll(mappings)); da = new AppSchemaDataAccess(AppSchemaDataAccessConfigurator.buildMappings(config)); assertNotNull(da);
private Set<FeatureTypeMapping> createFeatureTypeMappings( Map<String, DataAccess<FeatureType, Feature>> sourceDataStores) throws IOException { Set mappingsConfigs = config.getTypeMappings();
/** Build the cache for this data access. */ private SchemaCache buildCache() { try { return SchemaCache.buildAutomaticallyConfiguredUsingFileUrl( new URL(config.getBaseSchemasUrl())); } catch (MalformedURLException e) { LOGGER.warning( "Malformed mapping file URL: " + config.getBaseSchemasUrl() + " Detail: " + e.getMessage()); return null; } }
/** * Creates a new ComplexDataStoreConfigurator object. * * @param config DOCUMENT ME! */ private AppSchemaDataAccessConfigurator( AppSchemaDataAccessDTO config, DataAccessMap dataStoreMap) { this.config = config; this.dataStoreMap = dataStoreMap; namespaces = new NamespaceSupport(); Map nsMap = config.getNamespaces(); for (Iterator it = nsMap.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Entry) it.next(); String prefix = (String) entry.getKey(); String namespace = (String) entry.getValue(); namespaces.declarePrefix(prefix, namespace); } }
new LinkedHashMap<String, DataAccess<FeatureType, Feature>>(); @SuppressWarnings("unchecked") final List<SourceDataStore> dsParams = config.getSourceDataStores(); String id;
config = new AppSchemaDataAccessDTO(); config.setSourceDataStores(new ArrayList() { config.setBaseSchemasUrl(url.toExternalForm()); config.setNamespaces(new HashMap<String, String>() { config.setTargetSchemasUris(new ArrayList<String>() { config.setCatalog("mappedPolygons.oasis.xml");
mappings.add(dtoMappingName); mappings.add(duplicate); config.setTypeMappings(mappings); try { AppSchemaDataAccess da = mappings.add(duplicate); mappings.add(dtoNoMappingName); config.setTypeMappings(mappings); assertTrue(config.getTypeMappings().containsAll(mappings)); try { AppSchemaDataAccess da = mappings.add(duplicate); mappings.add(dtoNoMappingName); config.setTypeMappings(mappings); assertTrue(config.getTypeMappings().containsAll(mappings)); try { AppSchemaDataAccess da =
private Set<FeatureTypeMapping> createFeatureTypeMappings( Map<String, DataAccess<FeatureType, Feature>> sourceDataStores) throws IOException { Set mappingsConfigs = config.getTypeMappings();
AppSchemaDataAccessConfigurator.LOGGER.finer("about to parse target schemas"); final URL baseUrl = new URL(config.getBaseSchemasUrl()); final List schemaFiles = config.getTargetSchemasUris();
URL mappingFileUrl = new URL(config.getBaseSchemasUrl()); AppSchemaDataAccessConfigurator.LOGGER.finer( "mapping file URL is " + mappingFileUrl.toString());
/** * Creates a new ComplexDataStoreConfigurator object. * * @param config * DOCUMENT ME! */ private AppSchemaDataAccessConfigurator(AppSchemaDataAccessDTO config) { this.config = config; namespaces = new NamespaceSupport(); Map nsMap = config.getNamespaces(); for (Iterator it = nsMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Entry) it.next(); String prefix = (String) entry.getKey(); String namespace = (String) entry.getValue(); namespaces.declarePrefix(prefix, namespace); } }
final List<SourceDataStore> dsParams = config.getSourceDataStores(); String id;
mappings.add(dtoMappingName); mappings.add(duplicate); config.setTypeMappings(mappings); AppSchemaDataAccess da = new AppSchemaDataAccess(AppSchemaDataAccessConfigurator .buildMappings(config)); mappings.add(dtoMappingName); mappings.add(dtoNoMappingName); config.setTypeMappings(mappings); assertTrue(config.getTypeMappings().containsAll(mappings)); da = new AppSchemaDataAccess(AppSchemaDataAccessConfigurator.buildMappings(config)); assertNotNull(da);
AppSchemaDataAccessDTO configDto = new AppSchemaDataAccessDTO(); configDto.setBaseSchemasUrl(dataStoreConfigUrl.toExternalForm());
@Override @SuppressWarnings("unchecked") public DataAccess<? extends FeatureType, ? extends Feature> buildDataStore( SourceDataStore dataStoreConfig, AppSchemaDataAccessDTO appSchemaConfig) { if (!(dataStoreConfig instanceof ComplexDataStoreConfig)) { // not an Apache Solr feature type mapping return null; } ComplexDataStoreConfig complexDataStoreConfig = (ComplexDataStoreConfig) dataStoreConfig; IndexesConfig indexesConfig = complexDataStoreConfig.getIndexesConfig(); // specify the index attributes we are interested in based on the App-Schema mappings file for (TypeMapping mapping : (Set<TypeMapping>) appSchemaConfig.getTypeMappings()) { // get all the attributes names used in the feature type mapping Set<String> attributes = extractAttributesNames(mapping); indexesConfig.addAttributes(mapping.getSourceTypeName(), attributes); if (isDenormalizedIndexMode(mapping, dataStoreConfig)) { // set as denormalizedIndexMode indexesConfig .getIndexConfig(getTypeName(mapping, dataStoreConfig)) .setDenormalizedIndexMode(true); } } // build the Apache Solr store return new SolrDataStore( complexDataStoreConfig.getUrl(), new SingleLayerMapper(), indexesConfig); }