Class DefaultView
- All Implemented Interfaces:
FeatureSource<SimpleFeatureType,
,SimpleFeature> SimpleFeatureSource
Support SimpleFeatureSource decorator that takes care of mapping a Query & SimpleFeatureSource with the schema and definition query configured for it.
Because GeoServer requires that attributes always be returned in the same order we need a way to smoothly inforce this. Could we use this class to do so?
WARNING: this class is a placeholder for ideas right now - it may not always impement FeatureSource.
- Author:
- Gabriel Rold�n
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SimpleFeatureSource
SimpleFeatureSource being served up -
Constructor Summary
ConstructorsConstructorDescriptionDefaultView
(SimpleFeatureSource source, Query query) Creates a new GeoServerFeatureSource object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFeatureListener
(FeatureListener listener) Implement addFeatureListener.static SimpleFeatureSource
create
(SimpleFeatureSource source, Query query) Factory that make the correct decorator for the provided featureSource.Retrieves the total extent of this FeatureSource.Retrive the extent of the Query.int
Adjust query and forward to source.Implement getDataStore.Implement getFeatures.getFeatures
(Query query) Implement getFeatures.getFeatures
(Filter filter) Implement getFeatures.getInfo()
Returns information describing thisFeatureSource
which may include title, description and spatial parameters.getName()
Returns the name of the features (strictly, the name of theAttributeDescriptor
for the features) accessible through thisFeatureSource
.Enquire what what query capabilities thisFeatureSource
natively supports.Implement getSchema.Returns the set of hints that thisFeatureSource
supports viaQuery
requests.protected Filter
makeDefinitionFilter
(Filter filter) If a definition query has been configured for the FeatureTypeInfo, makes and return a new Filter that contains both the query's filter and the layer's definition one, by logic AND'ing them.protected Query
makeDefinitionQuery
(Query query) Takes a query and adapts it to match re definitionQuery filter configured for a feature type.void
removeFeatureListener
(FeatureListener listener) Implement removeFeatureListener.
-
Field Details
-
source
SimpleFeatureSource being served up
-
-
Constructor Details
-
DefaultView
Creates a new GeoServerFeatureSource object.Grabs the following from query:
- typeName - only used if client does not supply
- cs - only used if client does not supply
- csForce - only used if client does not supply
- filter - combined with client filter
- propertyNames - combined with client filter (indicate property names that *must* be included)
- Parameters:
source
- a FeatureSourcequery
- Filter used to limit results- Throws:
SchemaException
-
-
Method Details
-
getName
Description copied from interface:FeatureSource
Returns the name of the features (strictly, the name of theAttributeDescriptor
for the features) accessible through thisFeatureSource
.The value returned by this method can be different to that returned by
featureSource.getSchema().getType().getName()
. This is because there is a distinction between the name applied to features and the name of a feature type. When working withSimpleFeature
andSimpleFeatureType
, for example with a shapefile data source, it is common practice for feature and feature type names to be the same. However, this is not the case more generally. For instance, a database can contain two tables with the same structure. The feature name will refer to the table while the feature type name refers to the schema (table structure).- Specified by:
getName
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Returns:
- the name of the features accessible through this
FeatureSource
- Since:
- 2.5
- See Also:
-
create
public static SimpleFeatureSource create(SimpleFeatureSource source, Query query) throws SchemaException Factory that make the correct decorator for the provided featureSource.This factory method is public and will be used to create all required subclasses. By comparison the constructors for this class have package visibiliy. TODO: revisit this - I am not sure I want write access to views (especially if they do reprojection).
- Throws:
SchemaException
-
makeDefinitionQuery
Takes a query and adapts it to match re definitionQuery filter configured for a feature type. It won't handle coordinate system changesGrabs the following from query:
- typeName - only used if client does not supply
- filter - combined with client filter
- propertyNames - combined with client filter (indicate property names that *must* be included)
- Parameters:
query
- Query against this DataStore- Returns:
- Query restricted to the limits of definitionQuery
- Throws:
IOException
- See DataSourceExceptionDataSourceException
- If query could not meet the restrictions of definitionQuery
-
makeDefinitionFilter
If a definition query has been configured for the FeatureTypeInfo, makes and return a new Filter that contains both the query's filter and the layer's definition one, by logic AND'ing them.- Parameters:
filter
- Origional user supplied Filter- Returns:
- Filter adjusted to the limitations of definitionQuery
- Throws:
DataSourceException
- If the filter could not meet the limitations of definitionQuery
-
getDataStore
Implement getDataStore.Description ...
- Specified by:
getDataStore
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Returns:
- See Also:
-
org.geotools.data.FeatureSource#getDataStore()
-
addFeatureListener
Implement addFeatureListener.Description ...
- Specified by:
addFeatureListener
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Parameters:
listener
- the new listener- See Also:
-
org.geotools.data.FeatureSource#addFeatureListener(org.geotools.data.FeatureListener)
-
removeFeatureListener
Implement removeFeatureListener.Description ...
- Specified by:
removeFeatureListener
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Parameters:
listener
- the listener to remove- See Also:
-
org.geotools.data.FeatureSource#removeFeatureListener(org.geotools.data.FeatureListener)
-
getFeatures
Implement getFeatures.Description ...
- Specified by:
getFeatures
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Specified by:
getFeatures
in interfaceSimpleFeatureSource
- Parameters:
query
- DataAccess query for requested information, such as typeName, maxFeatures and filter.- Returns:
- features retrieved by the
Query
- Throws:
IOException
- if the underlying data source cannot be accessed.- See Also:
-
org.geotools.data.FeatureSource#getFeatures(org.geotools.data.Query)
-
getFeatures
Implement getFeatures.Description ...
- Specified by:
getFeatures
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Specified by:
getFeatures
in interfaceSimpleFeatureSource
- Parameters:
filter
- the filter to select features; must not benull
(use Filter.INCLUDE instead)- Returns:
- features retrieved by the
Filter
- Throws:
IOException
- if the underlying data source cannot be accessed.- See Also:
-
getFeatures
Implement getFeatures.Description ...
- Specified by:
getFeatures
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Specified by:
getFeatures
in interfaceSimpleFeatureSource
- Returns:
- features retrieved by the
Query
- Throws:
IOException
- if the underlying data source cannot be accessed.- See Also:
-
org.geotools.data.FeatureSource#getFeatures()
-
getSchema
Implement getSchema.Description ...
- Specified by:
getSchema
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Returns:
- See Also:
-
org.geotools.data.FeatureSource#getSchema()
-
getInfo
Description copied from interface:FeatureSource
Returns information describing thisFeatureSource
which may include title, description and spatial parameters. Note that in the returnedResourceInfo
object, the distinction between feature name and schema (feature type) name applies as discussed for FeatureSource.getName().- Specified by:
getInfo
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature>
-
getBounds
Retrieves the total extent of this FeatureSource.Please note this extent will reflect the provided definitionQuery.
- Specified by:
getBounds
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Returns:
- Extent of this FeatureSource, or
null
if no optimizations exist. - Throws:
IOException
- If bounds of definitionQuery
-
getBounds
Retrive the extent of the Query.This method provides access to an optimized getBounds opperation. If no optimized opperation is available
null
will be returned.You may still make use of getFeatures( Query ).getCount() which will return the correct answer (even if it has to itterate through all the results to do so.
- Specified by:
getBounds
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Parameters:
query
- User's query- Returns:
- Extend of Query or
null
if no optimization is available - Throws:
IOException
- If a problem is encountered with source
-
getCount
Adjust query and forward to source.This method provides access to an optimized getCount opperation. If no optimized opperation is available
-1
will be returned.You may still make use of getFeatures( Query ).getCount() which will return the correct answer (even if it has to itterate through all the results to do so).
- Specified by:
getCount
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Parameters:
query
- User's query.- Returns:
- Number of Features for Query, or -1 if no optimization is available.
-
getSupportedHints
Description copied from interface:FeatureSource
Returns the set of hints that thisFeatureSource
supports viaQuery
requests.Note: the existence of a specific hint does not guarantee that it will always be honored by the implementing class.
- Specified by:
getSupportedHints
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Returns:
- a set of
RenderingHints#Key
objects; may be empty but nevernull
- See Also:
-
getQueryCapabilities
Description copied from interface:FeatureSource
Enquire what what query capabilities thisFeatureSource
natively supports. For example, whether queries can return sorted results.- Specified by:
getQueryCapabilities
in interfaceFeatureSource<SimpleFeatureType,
SimpleFeature> - Returns:
- the native query capabilities of this
FeatureSource
-