public T getSchema(Name name) throws IOException { return delegate.getSchema(name); }
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; }
private FeatureType getNonCacheableFeatureType( FeatureTypeInfo info, boolean handleProjectionPolicy) throws IOException { FeatureType ft = null; // grab the underlying feature type DataAccess<? extends FeatureType, ? extends Feature> dataAccess = getDataStore(info.getStore()); FeatureTypeCallback initializer = getFeatureTypeInitializer(info, dataAccess); Name temporaryName = null; if (initializer != null) { temporaryName = getTemporaryName(info, dataAccess, initializer); } ft = dataAccess.getSchema( temporaryName != null ? temporaryName : info.getQualifiedNativeName()); ft = buildFeatureType(info, handleProjectionPolicy, ft); // Remove layer configuration from datastore if (initializer != null && temporaryName != null) { initializer.dispose(info, dataAccess, temporaryName); } return ft; }
public SimpleFeatureType getSchema(Name name) throws IOException { FeatureType schema = delegate.getSchema(name); if (schema instanceof SimpleFeatureType) { return (SimpleFeatureType) schema; } else { return null; } }
try { FeatureType ft = ds.getSchema(featureType.getQualifiedNativeName()); featureType.setNativeCRS(ft.getCoordinateReferenceSystem()); } catch (Exception e) {
@Override public SimpleFeatureType getSchema(String typeName) throws IOException { Name name = getNameFromLocal(typeName); FeatureType schema = delegate.getSchema(name); if (schema instanceof SimpleFeatureType) { return (SimpleFeatureType) schema; } else { return null; } }
@Test public void testGetDataStore() throws Exception { assertNotNull(mappingDataStore.getSchema(typeName)); }
/** * 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); }
/** * 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)); }
/** * Load all the data accesses. * * @return * @throws Exception */ @Before public void loadDataAccess() 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); assertNotNull(obsSource); FeatureCollection obsFeatures = (FeatureCollection) obsSource.getFeatures(); assertEquals(2, size(obsFeatures)); }
FeatureType geologicUnitType = guDataStore.getSchema(FeatureChainingTest.GEOLOGIC_UNIT); assertNotNull(geologicUnitType);
dataAccess = DataAccessFinder.getDataStore(params); Assert.assertNotNull(dataAccess); FeatureType mappedFeatureType = dataAccess.getSchema(MAPPED_FEATURE); Assert.assertNotNull(mappedFeatureType); FeatureSource<FeatureType, Feature> source =
@Test public void testDataStore() throws Exception { try { final Name typeName = Types.typeName(GSMLNS, "MappedFeature"); FeatureType boreholeType = mappingDataStore.getSchema(typeName); assertNotNull(boreholeType); FeatureSource fSource = (FeatureSource) mappingDataStore.getFeatureSource(typeName); final int EXPECTED_RESULT_COUNT = 2; FeatureCollection features = (FeatureCollection) fSource.getFeatures(); int resultCount = getCount(features); assertEquals(EXPECTED_RESULT_COUNT, resultCount); Feature feature; int count = 0; FeatureIterator it = features.features(); for (; it.hasNext(); ) { feature = (Feature) it.next(); count++; } it.close(); assertEquals(EXPECTED_RESULT_COUNT, count); } catch (Exception e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); throw e; } }
FeatureSource<FeatureType, Feature> fSource; FeatureType fType = mappingDataStore.getSchema(typeName); assertNotNull(fType); fSource = mappingDataStore.getFeatureSource(typeName);
@Test public void testGetDataStore() throws Exception { assertNotNull(mappingDataStore.getSchema(typeName)); }
/** * Returns the GML version used in the feature type's definition. * * <p>The method recursively climbs up the type hierarchy of the provided feature type, until it * finds AbstractFeatureType. Then, the GML version is determined by looking at the namespace * URI. * * <p>Please note that this method does not differentiate between GML 2 and GML 3.1.1, but * assumes that "http://www.opengis.net/gml" namespace always refers to GML 3.1.1. * * @param ftInfo the feature type info * @return the GML version used in the feature type definition * @throws IOException if the underlying datastore instance cannot be retrieved */ String findGmlVersion(FeatureTypeInfo ftInfo) throws IOException { ProgressListener listener = new NullProgressListener(); Name qName = ftInfo.getQualifiedName(); FeatureType fType = ftInfo.getStore().getDataStore(listener).getSchema(qName); return findFeatureTypeGmlVersion(fType); }
/** * 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); }
@Test public void testDataStore() throws Exception { try { final Name typeName = Types.typeName(GSMLNS, "MappedFeature"); FeatureType boreholeType = mappingDataStore.getSchema(typeName); assertNotNull(boreholeType); FeatureSource fSource = (FeatureSource) mappingDataStore.getFeatureSource(typeName); final int EXPECTED_RESULT_COUNT = 2; FeatureCollection features = (FeatureCollection) fSource.getFeatures(); int resultCount = getCount(features); assertEquals(EXPECTED_RESULT_COUNT, resultCount); Feature feature; int count = 0; FeatureIterator it = features.features(); for (; it.hasNext();) { feature = (Feature) it.next(); count++; } it.close(); assertEquals(EXPECTED_RESULT_COUNT, count); } catch (Exception e) { e.printStackTrace(); throw e; } }