public class DefaultView extends Object implements 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.
Modifier and Type | Field and Description |
---|---|
protected SimpleFeatureSource |
source
SimpleFeatureSource being served up
|
Constructor and Description |
---|
DefaultView(SimpleFeatureSource source,
Query query)
Creates a new GeoServerFeatureSource object.
|
Modifier and Type | Method and Description |
---|---|
void |
addFeatureListener(FeatureListener listener)
Implement addFeatureListener.
|
static SimpleFeatureSource |
create(SimpleFeatureSource source,
Query query)
Factory that make the correct decorator for the provided featureSource.
|
ReferencedEnvelope |
getBounds()
Retrieves the total extent of this FeatureSource.
|
ReferencedEnvelope |
getBounds(Query query)
Retrive the extent of the Query.
|
int |
getCount(Query query)
Adjust query and forward to source.
|
DataStore |
getDataStore()
Implement getDataStore.
|
SimpleFeatureCollection |
getFeatures()
Implement getFeatures.
|
SimpleFeatureCollection |
getFeatures(Filter filter)
Implement getFeatures.
|
SimpleFeatureCollection |
getFeatures(Query query)
Implement getFeatures.
|
ResourceInfo |
getInfo()
Returns information describing this
FeatureSource which may include title,
description and spatial parameters. |
Name |
getName()
Returns the name of the features (strictly, the name of the
AttributeDescriptor for
the features) accessible through this FeatureSource . |
QueryCapabilities |
getQueryCapabilities()
Enquire what what query capabilities this
FeatureSource natively supports. |
SimpleFeatureType |
getSchema()
Implement getSchema.
|
Set |
getSupportedHints()
Returns the set of hints that this
FeatureSource supports via Query 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 DefaultQuery |
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.
|
protected SimpleFeatureSource source
public DefaultView(SimpleFeatureSource source, Query query) throws SchemaException
Grabs the following from query:
source
- a FeatureSourcequery
- Filter used to limit resultsSchemaException
public Name getName()
FeatureSource
AttributeDescriptor
for
the features) accessible through this FeatureSource
.
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 with SimpleFeature
and SimpleFeatureType
, 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).
getName
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
FeatureSource
FeatureSource.getName()
public static SimpleFeatureSource create(SimpleFeatureSource source, Query query) throws SchemaException
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).
source
- query
- SchemaException
protected DefaultQuery makeDefinitionQuery(Query query) throws IOException
Grabs the following from query:
query
- Query against this DataStoreIOException
- See DataSourceExceptionDataSourceException
- If query could not meet the restrictions of definitionQueryprotected Filter makeDefinitionFilter(Filter filter) throws DataSourceException
filter
- Origional user supplied FilterDataSourceException
- If the filter could not meet the limitations of definitionQuerypublic DataStore getDataStore()
Description ...
getDataStore
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
public void addFeatureListener(FeatureListener listener)
Description ...
addFeatureListener
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
listener
- FeatureSource.addFeatureListener(org.geotools.data.FeatureListener)
public void removeFeatureListener(FeatureListener listener)
Description ...
removeFeatureListener
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
listener
- FeatureSource.removeFeatureListener(org.geotools.data.FeatureListener)
public SimpleFeatureCollection getFeatures(Query query) throws IOException
Description ...
getFeatures
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
getFeatures
in interface SimpleFeatureSource
query
- IOException
- if the underlying data source cannot be accessed.FeatureSource.getFeatures(org.geotools.data.Query)
public SimpleFeatureCollection getFeatures(Filter filter) throws IOException
Description ...
getFeatures
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
getFeatures
in interface SimpleFeatureSource
filter
- IOException
- if the underlying data source cannot be accessed.Filter
public SimpleFeatureCollection getFeatures() throws IOException
Description ...
getFeatures
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
getFeatures
in interface SimpleFeatureSource
IOException
- if the underlying data source cannot be accessed.FeatureSource.getFeatures()
public SimpleFeatureType getSchema()
Description ...
getSchema
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
public ResourceInfo getInfo()
FeatureSource
FeatureSource
which may include title,
description and spatial parameters. Note that in the returned ResourceInfo
object,
the distinction between feature name and schema (feature type) name applies as discussed for
FeatureSource.getName().getInfo
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
public ReferencedEnvelope getBounds() throws IOException
Please note this extent will reflect the provided definitionQuery.
getBounds
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
null
if no optimizations exist.IOException
- If bounds of definitionQuerypublic ReferencedEnvelope getBounds(Query query) throws IOException
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.
getBounds
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
query
- User's querynull
if no optimization is availableIOException
- If a problem is encountered with sourcepublic int getCount(Query query)
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).
getCount
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
query
- User's query.public Set getSupportedHints()
FeatureSource
FeatureSource
supports via Query
requests.
Note: the existence of a specific hint does not guarantee that it will always be honored by the implementing class.
getSupportedHints
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
RenderingHints#Key
objects; may be empty but never null
Hints.FEATURE_DETACHED
,
Hints.JTS_GEOMETRY_FACTORY
,
Hints.JTS_COORDINATE_SEQUENCE_FACTORY
,
Hints.JTS_PRECISION_MODEL
,
Hints.JTS_SRID
,
Hints.GEOMETRY_DISTANCE
,
Hints.FEATURE_2D
public QueryCapabilities getQueryCapabilities()
FeatureSource
FeatureSource
natively supports. For
example, whether queries can return sorted results.getQueryCapabilities
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
FeatureSource
Copyright © 1996–2019 Geotools. All rights reserved.