AppSchemaDataAccess implements DataAccess<FeatureType, Feature> { public FeatureSource<FeatureType, Feature> getFeatureSource(Name typeName) throws IOException { return new MappingFeatureSource(this, getMappingByElement(typeName)); } AppSchemaDataAccess(Set<FeatureTypeMapping> mappings); Name[] getTypeNames(); FeatureType getSchema(Name typeName); FeatureTypeMapping getMappingByName(Name typeName); FeatureTypeMapping getMappingByElement(Name typeName); boolean hasName(Name name); boolean hasElement(Name typeName); @SuppressWarnings("unchecked") Query unrollQuery(Query query, FeatureTypeMapping mapping); static Filter unrollFilter(Filter complexFilter, FeatureTypeMapping mapping); void dispose(); ServiceInfo getInfo(); List<Name> getNames(); void createSchema(FeatureType featureType); FeatureSource<FeatureType, Feature> getFeatureSource(Name typeName); void updateSchema(Name typeName, FeatureType featureType); void removeSchema(Name typeName); FeatureSource<FeatureType, Feature> getFeatureSourceByName(Name typeName); Feature findFeature(FeatureId id, Hints hints);  }
@Test public void testGetFeatureSource() throws IOException { FeatureSource<FeatureType, Feature> complexSource = dataStore.getFeatureSource(targetName); assertNotNull(complexSource); assertEquals(targetType, complexSource.getSchema()); }
@Test public void testGetFeatureReaderQuery() throws Exception { FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); PropertyName property = ff.property("sample/measurement[1]/parameter"); Literal literal = ff.literal("ph"); Filter filterParameter = ff.equals(property, literal); property = ff.property("sample/measurement[1]/value"); literal = ff.literal(new Integer(3)); Filter filterValue = ff.equals(property, literal); Filter filter = ff.and(filterParameter, filterValue); FeatureSource<FeatureType, Feature> complexSource = dataStore.getFeatureSource(targetName); FeatureCollection<FeatureType, Feature> features = complexSource.getFeatures(filter); FeatureIterator<Feature> reader = features.features(); PropertyIsEqualTo equivalentSourceFilter = ff.equals(ff.property("ph"), ff .literal(new Integer(3))); FeatureCollection<?,?> collection = mapping.getSource() .getFeatures(equivalentSourceFilter); int count = 0; int expectedCount = collection.size(); Filter badFilter = ff.greater(ff.property("sample/measurement[1]/value"), ff .literal(new Integer(3))); while (reader.hasNext()) { Feature f = (Feature) reader.next(); assertNotNull(f); assertTrue(filter.evaluate(f)); assertFalse(badFilter.evaluate(f)); count++; } reader.close(); assertEquals(expectedCount, count); }