Class WFSStoredQueryFeatureSource
- Object
-
- ContentFeatureSource
-
- WFSStoredQueryFeatureSource
-
- All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>
,SimpleFeatureSource
public class WFSStoredQueryFeatureSource extends ContentFeatureSource
-
-
Field Summary
-
Fields inherited from class ContentFeatureSource
entry, hints, lock, query, queryCapabilities, schema, transaction
-
-
Constructor Summary
Constructors Constructor Description WFSStoredQueryFeatureSource(ContentEntry entry, WFSClient client, StoredQueryDescriptionType desc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FeatureReader<SimpleFeatureType,SimpleFeature>
applyReprojectionDecorator(FeatureReader<SimpleFeatureType,SimpleFeature> reader, Query query, GetFeatureRequest request)
protected SimpleFeatureType
buildFeatureType()
Creates the feature type or schema for the feature source.protected boolean
canFilter(Query query)
Determines if the datastore can natively perform a filtering.protected boolean
canLimit(Query query)
Determines if the datastore can natively limit the number of features returned in a query.protected boolean
canOffset(Query query)
Determines if the datastore can natively skip the firstoffset
number of features returned in a query.protected boolean
canReproject()
Determines if the datastore can natively perform reprojection.protected boolean
canRetype(Query query)
Determines if the datastore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributesprotected boolean
canSort(Query query)
Determines if the datastore can natively perform sorting.protected GetFeatureRequest
createGetFeature(Query query, GetFeatureRequest.ResultType resultType)
protected ReferencedEnvelope
getBoundsInternal(Query query)
Calculates the bounds of a specified query.protected int
getCountInternal(Query query)
Calculates the number of features of a specified query.WFSDataStore
getDataStore()
The datastore that this feature source originated from.ResourceInfo
getInfo()
A default ResourceInfo with a generic description.protected FeatureReader<SimpleFeatureType,SimpleFeature>
getReaderInternal(Query localQuery)
Subclass method for returning a native reader from the datastore.QName
getRemoteTypeName()
protected String
getSupportedSrsName(GetFeatureRequest request, Query query)
protected boolean
handleVisitor(Query query, FeatureVisitor visitor)
Subclass method which allows subclasses to natively handle a visitor.protected Query
resolvePropertyNames(Query query)
This method changes the query object so that all propertyName references are resolved to simple attribute names against the schema of the feature source.protected Filter
resolvePropertyNames(Filter filter)
Transform provided filter; resolving property names-
Methods inherited from class ContentFeatureSource
accepts, addFeatureListener, addHints, buildQueryCapabilities, canEvent, canFilter, canLimit, canLock, canOffset, canRetype, canSort, canTransact, doLockInternal, doUnlockInternal, getAbsoluteSchema, getBounds, getBounds, getCount, getEntry, getFeatures, getFeatures, getFeatures, getName, getQueryCapabilities, getReader, getReader, getReader, getSchema, getState, getSupportedHints, getTransaction, getView, getView, isView, joinQuery, lockFeatures, lockFeatures, lockFeatures, processLock, removeFeatureListener, setFeatureLock, setTransaction, unLockFeatures, unLockFeatures, unLockFeatures
-
-
-
-
Constructor Detail
-
WFSStoredQueryFeatureSource
public WFSStoredQueryFeatureSource(ContentEntry entry, WFSClient client, StoredQueryDescriptionType desc)
-
-
Method Detail
-
createGetFeature
protected GetFeatureRequest createGetFeature(Query query, GetFeatureRequest.ResultType resultType) throws IOException
- Throws:
IOException
-
handleVisitor
protected boolean handleVisitor(Query query, FeatureVisitor visitor) throws IOException
Description copied from class:ContentFeatureSource
Subclass method which allows subclasses to natively handle a visitor.Subclasses would override this method and return true in cases where the specific visitor could be handled without iterating over the entire result set of query. An example would be handling visitors that calculate aggregate values.
- Overrides:
handleVisitor
in classContentFeatureSource
- Parameters:
query
- The query being made.visitor
- The visitor to- Returns:
- true if the visitor can be handled natively, otherwise false.
- Throws:
IOException
-
canReproject
protected boolean canReproject()
Description copied from class:ContentFeatureSource
Determines if the datastore can natively perform reprojection.If the subclass can handle reprojection natively then it should override this method to return
true
. In this case it must do the reprojection or throw an exception.Not overriding this method or returning
false
will case the feature reader created by the subclass to be wrapped in a reprojecting decorator when the query specifies a coordinate system reproject (using crs and crsReproject)To handle reprojection an implementation should:
Query.getCoordinateSystem()
- optional override - if provided this is used instead of the native CRS provided by the data format (as a workaround for clients).- <@link
Query.getCoordinateSystemReproject()
- if this value is provided it is used to set up a transform from the origional CRS (native or from query).
- Overrides:
canReproject
in classContentFeatureSource
- See Also:
ReprojectFeatureReader
-
canOffset
protected boolean canOffset(Query query)
Description copied from class:ContentFeatureSource
Determines if the datastore can natively skip the firstoffset
number of features returned in a query.If the subclass can handle a map feature cap natively then it should override this method to return
true
. In this case it must do the cap or throw an exception.Not overriding this method or returning
false
will case the feature reader created by the subclass to be accessed offset times before being returned to the caller.- Overrides:
canOffset
in classContentFeatureSource
-
canSort
protected boolean canSort(Query query)
Description copied from class:ContentFeatureSource
Determines if the datastore can natively perform sorting.If the subclass can handle retyping natively it should override this method to return
true
. In this case it must do the retyping or throw an exception.Not overriding this method or returning
false
will cause an exception to be thrown when the query specifies sorting.- Overrides:
canSort
in classContentFeatureSource
- Returns:
true
- See Also:
ContentFeatureSource.canSort(Query)
-
canRetype
protected boolean canRetype(Query query)
Description copied from class:ContentFeatureSource
Determines if the datastore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributesIf the subclass can handle retyping natively it should override this method to return
true
. In this case it must do the retyping or throw an exception.Not overriding this method or returning
false
will cause the feature reader created by the subclass to be wrapped in a retyping feature reader when the query specifies a retype.- Overrides:
canRetype
in classContentFeatureSource
- Returns:
true
- See Also:
ContentFeatureSource.canRetype(Query)
-
canFilter
protected boolean canFilter(Query query)
Description copied from class:ContentFeatureSource
Determines if the datastore can natively perform a filtering.If the subclass can handle filtering natively it should override this method to return
true
. In this case it must do the filtering or throw an exception. This includes the case of partial native filtering where the datastore can only handle part of the filter natively. In these cases it is up to the subclass to apply a decorator to the reader it returns which will handle any part of the filter can was not applied natively. SeeFilteringFeatureReader
.Not overriding this method or returning
false
will cause the feature reader created by the subclass to be wrapped in a filtering feature reader when the query specifies a filter. SeeFilteringFeatureReader
.- Overrides:
canFilter
in classContentFeatureSource
- Returns:
true
- See Also:
ContentFeatureSource.canFilter(Query)
-
canLimit
protected boolean canLimit(Query query)
Description copied from class:ContentFeatureSource
Determines if the datastore can natively limit the number of features returned in a query.If the subclass can handle a map feature cap natively then it should override this method to return
true
. In this case it must do the cap or throw an exception.Not overriding this method or returning
false
will case the feature reader created by the subclass to be wrapped in a max feature capping decorator when the query specifies a max feature cap.- Overrides:
canLimit
in classContentFeatureSource
- Returns:
true
- See Also:
ContentFeatureSource.canLimit(Query)
-
getDataStore
public WFSDataStore getDataStore()
The datastore that this feature source originated from.Subclasses may wish to extend this method in order to type narrow its return type.
- Specified by:
getDataStore
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Overrides:
getDataStore
in classContentFeatureSource
- Returns:
- the data source providing this
FeatureSource
-
resolvePropertyNames
protected Query resolvePropertyNames(Query query)
This method changes the query object so that all propertyName references are resolved to simple attribute names against the schema of the feature source.For example, this method ensures that propertyName's such as "gml:name" are rewritten as simply "name".
- Overrides:
resolvePropertyNames
in classContentFeatureSource
-
resolvePropertyNames
protected Filter resolvePropertyNames(Filter filter)
Transform provided filter; resolving property names- Overrides:
resolvePropertyNames
in classContentFeatureSource
-
getBoundsInternal
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException
Description copied from class:ContentFeatureSource
Calculates the bounds of a specified query. Subclasses must implement this method. If the computation is not fast, subclasses can returnnull
.- Specified by:
getBoundsInternal
in classContentFeatureSource
- Returns:
- the WFS advertised bounds of the feature type if
Filter.INCLUDE == query.getFilter()
, reprojected to the Query's crs, ornull
otherwise as it would be too expensive to calculate. - Throws:
IOException
- See Also:
FeatureSource.getBounds(Query)
,ContentFeatureSource.getBoundsInternal(Query)
-
getCountInternal
protected int getCountInternal(Query query) throws IOException
Description copied from class:ContentFeatureSource
Calculates the number of features of a specified query. Subclasses must implement this method. If the computation is not fast, it's possible to return -1.- Specified by:
getCountInternal
in classContentFeatureSource
- Returns:
- the remote WFS advertised number of features for the given query only if the query
filter is fully supported AND the wfs returns that information in as an attribute of the
FeatureCollection (since the request is performed with resultType=hits), otherwise
-1
as it would be too expensive to calculate. - Throws:
IOException
- See Also:
FeatureSource.getCount(Query)
,ContentFeatureSource.getCountInternal(Query)
-
getReaderInternal
protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query localQuery) throws IOException
Description copied from class:ContentFeatureSource
Subclass method for returning a native reader from the datastore.It is important to note that if the native reader intends to handle any of the following natively:
- reprojection
- filtering
- max feature limiting
- sorting
- locking
- transactions
true
:ContentFeatureSource.canReproject()
- handlesQuery.getCoordinateSystemReproject()
internally. Example would be PostGIS using Proj to handle reproejction internallyContentFeatureSource.canFilter(Query)
- handlesinternally.
- {@link #canLimit(Query)} - handles {@link Query#getMaxFeatures()} and {@link Query#getStartIndex()} internally.
- {@link #canSort(Query)} - handles {@link Query#getSortBy()} natively.
- {@link #canRetype(Query)} - handles {@link Query#getProperties()} natively. Example would be only parsing the properties the user asks for from an XML file
- {@link #canLock()} - handles read-locks natively
- {@link #canTransact()} - handles transactions natively
- Specified by:
getReaderInternal
in classContentFeatureSource
- Throws:
IOException
- See Also:
FeatureSource.getFeatures(Query)
,ContentFeatureSource.getReaderInternal(Query)
-
getSupportedSrsName
protected String getSupportedSrsName(GetFeatureRequest request, Query query)
-
applyReprojectionDecorator
protected FeatureReader<SimpleFeatureType,SimpleFeature> applyReprojectionDecorator(FeatureReader<SimpleFeatureType,SimpleFeature> reader, Query query, GetFeatureRequest request)
-
buildFeatureType
protected SimpleFeatureType buildFeatureType() throws IOException
Description copied from class:ContentFeatureSource
Creates the feature type or schema for the feature source.Implementations should use
SimpleFeatureTypeBuilder
to build the feature type. Also, the builder should be injected with the feature factory which has been set on the DataStore (seeContentDataStore.getFeatureFactory()
. Example:SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setFeatureTypeFactory( getDataStore().getFeatureTypeFactory() ); //build the feature type ...
- Specified by:
buildFeatureType
in classContentFeatureSource
- Throws:
IOException
-
getRemoteTypeName
public QName getRemoteTypeName() throws IOException
- Throws:
IOException
-
getInfo
public ResourceInfo getInfo()
Description copied from class:ContentFeatureSource
A default ResourceInfo with a generic description.Subclasses should override to provide an explicit ResourceInfo object for their content.
- Specified by:
getInfo
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Overrides:
getInfo
in classContentFeatureSource
- Returns:
- description of features contents
-
-