public List<Name> getNames() throws IOException { return delegate.getNames(); }
public FeatureSource<T, F> getFeatureSource(Name typeName) throws IOException { return delegate.getFeatureSource(typeName); }
public void dispose() { delegate.dispose(); }
FeatureType featureType = dataAccess.getSchema(typeName); assertNotNull(featureType); FeatureSource fSource = (FeatureSource) dataAccess.getFeatureSource(typeName); FeatureCollection features = (FeatureCollection) fSource.getFeatures(); assertNotNull(dataAccess); typeName = Types.typeName("http://example.com", "SecondParentFeature"); featureType = dataAccess.getSchema(typeName); assertNotNull(featureType); fSource = (FeatureSource) dataAccess.getFeatureSource(typeName); features = (FeatureCollection) fSource.getFeatures(); dataAccess.dispose();
/** * Load all the data accesses. * * @return * @throws Exception */ private static void loadDataAccesses() throws Exception { /** Load mapped feature data access */ Map dsParams = new HashMap(); URL url = PolymorphicChainingTest.class.getResource(schemaBase + "artifact_mapping.xml"); assertNotNull(url); dsParams.put("dbtype", "app-schema"); dsParams.put("url", url.toExternalForm()); DataAccess<FeatureType, Feature> mfDataAccess = DataAccessFinder.getDataStore(dsParams); assertNotNull(mfDataAccess); FeatureType mappedFeatureType = mfDataAccess.getSchema(ARTIFACT); assertNotNull(mappedFeatureType); artifactSource = (FeatureSource) mfDataAccess.getFeatureSource(ARTIFACT); }
List<Name> featureTypeNames = source.getNames(); for (int i = 0; i < featureTypeNames.size(); i++) { FeatureSource fs = ds.getFeatureSource(featureTypeNames.get(i)); FeatureTypeInfo ftinfo = featureTypesByNativeName.get(featureTypeNames.get(i).getLocalPart()); source.dispose();
/** * Get a feature source for built features with supplied feature type name. * * @param featureTypeName * @return feature source * @throws IOException */ public synchronized FeatureSource<FeatureType, Feature> featureSource(Name name) throws IOException { for (DataAccess<FeatureType, Feature> dataAccess : registry) { if (dataAccess.getNames().contains(name)) { if (dataAccess instanceof AppSchemaDataAccess) { return ((AppSchemaDataAccess) dataAccess).getFeatureSourceByName(name); } else { return dataAccess.getFeatureSource(name); } } } throwDataSourceException(name); return null; }
/** @throws IOException */ @Test public void testFactoryLookup() throws IOException { DataAccess<FeatureType, Feature> ds = DataAccessFinder.getDataStore(params); assertNotNull(ds); assertTrue(ds instanceof AppSchemaDataAccess); FeatureSource<FeatureType, Feature> mappedSource = ds.getFeatureSource(mappedTypeName); assertNotNull(mappedSource); ds.dispose(); }
public T getSchema(Name name) throws IOException { return delegate.getSchema(name); }
public ServiceInfo getInfo() { return delegate.getInfo(); }
public void createSchema(T featureType) throws IOException { delegate.createSchema(featureType); }
dataAccess = DataAccessFinder.getDataStore(params); Assert.assertNotNull(dataAccess); FeatureType mappedFeatureType = dataAccess.getSchema(MAPPED_FEATURE); Assert.assertNotNull(mappedFeatureType); FeatureSource<FeatureType, Feature> source = dataAccess.getFeatureSource(MAPPED_FEATURE); FeatureCollection<FeatureType, Feature> features = source.getFeatures(); FeatureIterator<Feature> iterator = features.features(); dataAccess.dispose();
/** * Load all the data accesses. * * @return * @throws Exception */ private static void loadDataAccesses() throws Exception { /** Load observation data access */ Map dsParams = new HashMap(); URL url = SweValuesTest.class.getResource(SWE_VALUES_MAPPING); assertNotNull(url); dsParams.put("dbtype", "app-schema"); dsParams.put("url", url.toExternalForm()); DataAccess<FeatureType, Feature> omsoDataAccess = DataAccessFinder.getDataStore(dsParams); assertNotNull(omsoDataAccess); FeatureType observationFeatureType = omsoDataAccess.getSchema(OBSERVATION_FEATURE); assertNotNull(observationFeatureType); obsSource = (FeatureSource) omsoDataAccess.getFeatureSource(OBSERVATION_FEATURE); obsFeatures = (FeatureCollection) obsSource.getFeatures(); assertEquals(2, size(obsFeatures)); }
/** * Tests that a {@link FeatureSource} can be obtained for all names returned by {@link * AppSchemaDataAccess#getNames()}. * * @throws Exception */ @Test public void testGetNamesAndFeatureSources() throws Exception { /* * Initiate data accesses and make sure they have the mappings */ final Map<String, Serializable> dsParams = new HashMap<String, Serializable>(); URL url = getClass().getResource(schemaBase + "GeologicUnit.xml"); assertNotNull(url); dsParams.put("dbtype", "app-schema"); dsParams.put("url", url.toExternalForm()); DataAccess<?, ?> guDataStore = DataAccessFinder.getDataStore(dsParams); assertNotNull(guDataStore); for (Name name : guDataStore.getNames()) { FeatureSource<?, ?> fs = guDataStore.getFeatureSource(name); assertNotNull(fs); } }
/** @throws IOException */ @Test public void testCreateDataStore() throws IOException { DataAccess<FeatureType, Feature> ds = factory.createDataStore(params); assertNotNull(ds); FeatureSource<FeatureType, Feature> mappedSource = ds.getFeatureSource(mappedTypeName); assertNotNull(mappedSource); assertSame(ds, mappedSource.getDataStore()); ds.dispose(); }
FeatureType getCacheableFeatureType(FeatureTypeInfo info, boolean handleProjectionPolicy) throws IOException { String key = getFeatureTypeInfoKey(info, handleProjectionPolicy); FeatureType ft = featureTypeCache.get(key); if (ft == null) { synchronized (featureTypeCache) { ft = featureTypeCache.get(key); if (ft == null) { // grab the underlying feature type DataAccess<? extends FeatureType, ? extends Feature> dataAccess = getDataStore(info.getStore()); FeatureTypeCallback initializer = getFeatureTypeInitializer(info, dataAccess); if (initializer != null) { initializer.initialize(info, dataAccess, null); } // ft = jstore.getSchema(vt.getName()); ft = dataAccess.getSchema(info.getQualifiedNativeName()); ft = buildFeatureType(info, handleProjectionPolicy, ft); featureTypeCache.put(key, ft); } } } return ft; }
@Test public void testPropertyDataStoreRelativeUrl() throws IOException { // create dir File testDS = new File(testData.getDataDirectoryRoot(), "testDS").getCanonicalFile(); testDS.mkdir(); HashMap params = new HashMap(); params.put(PropertyDataStoreFactory.DIRECTORY.key, "file:./testDS"); params.put(PropertyDataStoreFactory.NAMESPACE.key, "http://www.geotools.org/test"); DataStoreInfoImpl info = new DataStoreInfoImpl(getGeoServer().getCatalog()); info.setConnectionParameters(params); DataAccessFactory f = getGeoServer().getCatalog().getResourcePool().getDataStoreFactory(info); assertNotNull(f); assertTrue(f instanceof PropertyDataStoreFactory); DataAccess store = getGeoServer().getCatalog().getResourcePool().getDataStore(info); assertEquals( testDS.toURI().toString().toLowerCase(), store.getInfo().getSource().toString().replace("/./", "/").toLowerCase()); } }
public void createSchema(SimpleFeatureType featureType) throws IOException { delegate.createSchema(featureType); }