public class AppSchemaDataAccess extends Object implements DataAccess<FeatureType,Feature>
DataAccess that maps a "simple" source DataStore into a source of full Feature
features conforming to an application schema.| Constructor and Description |
|---|
AppSchemaDataAccess(Set<FeatureTypeMapping> mappings)
Constructor.
|
AppSchemaDataAccess(Set<FeatureTypeMapping> mappings,
boolean hidden)
Two args constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createSchema(FeatureType featureType)
Not a supported operation.
|
void |
dispose()
Disposes of this data store and releases any resource that it is using.
|
Feature |
findFeature(FeatureId id,
Hints hints) |
protected ReferencedEnvelope |
getBounds(Query query)
Computes the bounds of the features for the specified feature type that satisfy the query
provided that there is a fast way to get that result.
|
protected int |
getCount(Query targetQuery)
Gets the number of the features that would be returned by this query for the specified
feature type.
|
FeatureSource<FeatureType,Feature> |
getFeatureSource(Name typeName)
Return a feature source that can be used to obtain features of a particular type.
|
FeatureSource<FeatureType,Feature> |
getFeatureSourceByName(Name typeName)
Return a feature source that can be used to obtain features of a particular name.
|
ServiceInfo |
getInfo()
Not a supported operation.
|
FeatureTypeMapping |
getMappingByName(Name typeName)
Returns the mapping suite for the given targetElement name or mappingName.
|
FeatureTypeMapping |
getMappingByNameOrElement(Name typeName)
Returns the mapping suite for the given target type name.
|
List<Name> |
getNames()
Return the names of the target features.
|
FeatureType |
getSchema(Name typeName)
Finds the target FeatureType named
typeName in this ComplexDatastore's internal
list of FeatureType mappings and returns it. |
Name[] |
getTypeNames()
Returns the set of target type names this DataAccess holds, where the term 'target type name'
refers to the name of one of the types this DataAccess produces by mapping another ones
through the definitions stored in its FeatureTypeMappings
|
protected Filter |
getUnsupportedFilter(String typeName,
Filter filter)
Returns
Filter.INCLUDE, as the whole filter is unrolled and passed back to the
underlying DataStore to be treated. |
boolean |
hasElement(Name typeName) |
boolean |
hasName(Name name) |
static boolean |
matchProperty(String requestedProperty,
XPathUtil.StepList target)
Helper method for getSurrogatePropertyNames to match a requested single step property with a
target x-path, ignoring namespaces
|
static boolean |
matchProperty(XPathUtil.StepList requestedProperty,
XPathUtil.StepList target)
Helper method for getSurrogatePropertyNames to match a requested x-path property with a
target x-path
|
protected void |
register()
Registers this data access to the registry so the mappings can be retrieved globally
|
void |
removeSchema(Name typeName)
Not a supported operation.
|
static Filter |
unrollFilter(Filter complexFilter,
FeatureTypeMapping mapping)
Takes a filter that operates against a FeatureTypeMapping's target FeatureType,
and unrolls it creating a new Filter that operates against the mapping's source FeatureType.
|
Query |
unrollQuery(Query query,
FeatureTypeMapping mapping)
Creates a
org.geotools.data.Query that operates over the surrogate DataStore, by
unrolling the org.geotools.filter.Filter contained in the passed query
, and replacing the list of required attributes by the ones of the mapped FeatureType. |
void |
updateSchema(Name typeName,
FeatureType featureType)
Not a supported operation.
|
public AppSchemaDataAccess(Set<FeatureTypeMapping> mappings) throws IOException
mappings - a Set containing a FeatureTypeMapping for each FeatureType this
DataAccess is going to produce.IOExceptionpublic AppSchemaDataAccess(Set<FeatureTypeMapping> mappings, boolean hidden) throws IOException
mappings - a Set containing a FeatureTypeMapping for each FeatureType this
DataAccess is going to produce.hidden - marks this data access as non-accessible, which makes it a candidate for
automatic disposalIOExceptionprotected void register()
public Name[] getTypeNames() throws IOException
IOExceptionpublic FeatureType getSchema(Name typeName) throws IOException
typeName in this ComplexDatastore's internal
list of FeatureType mappings and returns it.getSchema in interface DataAccess<FeatureType,Feature>typeName - Type name a the resource from getNames()IOExceptionpublic FeatureTypeMapping getMappingByName(Name typeName) throws IOException
Note this method is public just for unit testing purposes
typeName - IOExceptionpublic FeatureTypeMapping getMappingByNameOrElement(Name typeName) throws IOException
Note this method is public just for unit testing purposes
typeName - IOExceptionpublic boolean hasName(Name name)
name - mappingName or targetElementpublic boolean hasElement(Name typeName)
typeName - targetElement nameprotected ReferencedEnvelope getBounds(Query query) throws IOException
Will return null if there is not fast way to compute the bounds. Since it's based on some kind of header/cached information, it's not guaranteed to be real bound of the features
query - SchemaNotFoundExceptionIOExceptionprotected int getCount(Query targetQuery) throws IOException
If getBounds(Query) returns -1 due to expense consider using
getFeatures(Query).getCount() as a an alternative.
targetQuery - Contains the Filter and MaxFeatures to find the bounds for.-1 if count is too
expensive to calculate or any errors or occur.IOExceptionIOException - if there are errors getting the countprotected Filter getUnsupportedFilter(String typeName, Filter filter)
Filter.INCLUDE, as the whole filter is unrolled and passed back to the
underlying DataStore to be treated.Filter.INLCUDEpublic Query unrollQuery(Query query, FeatureTypeMapping mapping)
org.geotools.data.Query that operates over the surrogate DataStore, by
unrolling the org.geotools.filter.Filter contained in the passed query
, and replacing the list of required attributes by the ones of the mapped FeatureType.query - mapping - public static boolean matchProperty(XPathUtil.StepList requestedProperty, XPathUtil.StepList target)
requestedProperty - requested property x-pathtargetXPath - target x-pathpublic static boolean matchProperty(String requestedProperty, XPathUtil.StepList target)
requestedProperty - requested property x-pathtargetXPath - target x-pathpublic static Filter unrollFilter(Filter complexFilter, FeatureTypeMapping mapping)
complexFilter - public void dispose()
DataAccessA DataStore cannot be used after dispose has been called,
neither can any data access object it helped create, such as FeatureReader, FeatureSource or FeatureCollection.
This operation can be called more than once without side effects.
There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.
dispose in interface DataAccess<FeatureType,Feature>public ServiceInfo getInfo()
getInfo in interface DataAccess<FeatureType,Feature>DataAccess.getInfo()public List<Name> getNames()
getNames in interface DataAccess<FeatureType,Feature>DataAccess.getNames()public void createSchema(FeatureType featureType) throws IOException
createSchema in interface DataAccess<FeatureType,Feature>featureType - FetureType to add to DataStoreIOException - If featureType cannot be createdDataAccess.createSchema(org.opengis.feature.type.FeatureType)public FeatureSource<FeatureType,Feature> getFeatureSource(Name typeName) throws IOException
getFeatureSource in interface DataAccess<FeatureType,Feature>IOExceptionDataAccess.getFeatureSource(org.opengis.feature.type.Name)public void updateSchema(Name typeName, FeatureType featureType) throws IOException
updateSchema in interface DataAccess<FeatureType,Feature>IOException - if the operation failedDataAccess.updateSchema(org.opengis.feature.type.Name,
org.opengis.feature.type.FeatureType)public void removeSchema(Name typeName) throws IOException
removeSchema in interface DataAccess<FeatureType,Feature>IOException - if the operation failedDataAccess.removeSchema(org.opengis.feature.type.Name)public FeatureSource<FeatureType,Feature> getFeatureSourceByName(Name typeName) throws IOException
typeName - mappingName or targetElementIOExceptionpublic Feature findFeature(FeatureId id, Hints hints) throws IOException
IOExceptionCopyright © 1996–2019 Geotools. All rights reserved.