org.geotools.data.store
Class AbstractFeatureSource2

Object
  extended by AbstractFeatureSource2
All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>

public abstract class AbstractFeatureSource2
extends Object
implements FeatureSource<SimpleFeatureType,SimpleFeature>


Field Summary
protected  ActiveTypeEntry entry
          the type entry
protected static Logger LOGGER
          The logger for the data module.
 
Constructor Summary
AbstractFeatureSource2(ActiveTypeEntry entry)
           
 
Method Summary
 void addFeatureListener(FeatureListener listener)
          Adds a listener to the list that's notified each time a change to the FeatureStore occurs.
 ReferencedEnvelope getBounds()
          Gets the bounding box of this datasource.
 ReferencedEnvelope getBounds(Query query)
          Gets the bounding box of the features that would be returned by this query.
 int getCount(Query query)
          Gets the number of the features that would be returned by this query.
 DataStore getDataStore()
          Access to the DataStore implementing this FeatureStore.
 FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Filter filter)
          Loads features from the datasource into the returned FeatureResults, based on the passed filter.
 FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Query query)
          Loads features from the datasource into the returned FeatureResults, based on the passed query.
 SimpleFeatureType getSchema()
          Retrieves the featureType that features extracted from this datasource will be created with.
 Set getSupportedHints()
          By default, no Hints are supported
 void removeFeatureListener(FeatureListener listener)
          Removes a listener from the list that's notified each time a change to the FeatureStore occurs.
protected  FeatureCollection<SimpleFeatureType,SimpleFeature> reproject(FeatureCollection<SimpleFeatureType,SimpleFeature> features, CoordinateReferenceSystem source, CoordinateReferenceSystem target)
          Template method for reprojecting a feature collection from a source crs to a target crs.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface FeatureSource
getFeatures, getInfo, getName, getQueryCapabilities
 

Field Detail

LOGGER

protected static final Logger LOGGER
The logger for the data module.


entry

protected ActiveTypeEntry entry
the type entry

Constructor Detail

AbstractFeatureSource2

public AbstractFeatureSource2(ActiveTypeEntry entry)
Method Detail

getDataStore

public DataStore getDataStore()
Description copied from interface: FeatureSource
Access to the DataStore implementing this FeatureStore.

Specified by:
getDataStore in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
DataStore implementing this FeatureStore

addFeatureListener

public void addFeatureListener(FeatureListener listener)
Description copied from interface: FeatureSource
Adds a listener to the list that's notified each time a change to the FeatureStore occurs.

Specified by:
addFeatureListener in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
listener - FeatureListener

removeFeatureListener

public void removeFeatureListener(FeatureListener listener)
Description copied from interface: FeatureSource
Removes a listener from the list that's notified each time a change to the FeatureStore occurs.

Specified by:
removeFeatureListener in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
listener - FeatureListener

getFeatures

public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Query query)
                                                               throws IOException
Description copied from interface: FeatureSource
Loads features from the datasource into the returned FeatureResults, based on the passed query.

Specified by:
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
query - a datasource query object. It encapsulates requested information, such as typeName, maxFeatures and filter.
Returns:
Collection The collection to put the features into.
Throws:
IOException - For all data source errors.
See Also:
Query

getFeatures

public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Filter filter)
                                                               throws IOException
Description copied from interface: FeatureSource
Loads features from the datasource into the returned FeatureResults, based on the passed filter.

Specified by:
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
filter - An OpenGIS filter; specifies which features to retrieve. null is not allowed, use Filter.INCLUDE instead.
Returns:
Collection The collection to put the features into.
Throws:
IOException - For all data source errors.

getSchema

public SimpleFeatureType getSchema()
Description copied from interface: FeatureSource
Retrieves the featureType that features extracted from this datasource will be created with.

The schema returned is the LCD supported by all available Features. In the common case of shapfiles and database table this schema will match that of every feature available. In the degenerate GML case this will simply reflect the gml:AbstractFeatureType.

Specified by:
getSchema in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
the schema of features created by this datasource.

getBounds

public ReferencedEnvelope getBounds()
                             throws IOException
Description copied from interface: FeatureSource
Gets the bounding box of this datasource.

With getBounds(Query) this becomes a convenience method for getBounds(Query.ALL), that is the bounds for all features contained here.

If getBounds() returns null due to expense consider using getFeatures().getBounds() as a an alternative.

Specified by:
getBounds in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
The bounding box of the datasource or null if unknown and too expensive for the method to calculate.
Throws:
IOException - if there are errors getting the bounding box.

getBounds

public ReferencedEnvelope getBounds(Query query)
                             throws IOException
Description copied from interface: FeatureSource
Gets the bounding box of the features that would be returned by this query.

To retrieve the bounds of the DataSource please use getBounds( Query.ALL ).

This method is needed if we are to stream features to a gml out, since a FeatureCollection must have a boundedBy element.

If getBounds(Query) returns null due to expense consider using getFeatures(Query).getBounds() as a an alternative.

Specified by:
getBounds in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
query - Contains the Filter, and optionally MaxFeatures and StartIndex to find the bounds for.
Returns:
The bounding box of the datasource or null if unknown and too expensive for the method to calculate or any errors occur.
Throws:
IOException - DOCUMENT ME!

getCount

public int getCount(Query query)
             throws IOException
Description copied from interface: FeatureSource
Gets the number of the features that would be returned by this query.

If getBounds(Query) returns -1 due to expense consider using getFeatures(Query).getCount() as a an alternative.

This method should take into account the Query's maxFeatures and startIndex, if present, in order to consistently return the number of features the query would return.

Specified by:
getCount in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
query - Contains the Filter, and optionally MaxFeatures and StartIndex to find the count for.
Returns:
The number of Features provided by the Query or -1 if count is too expensive to calculate or any errors or occur.
Throws:
IOException - if there are errors getting the count

reproject

protected FeatureCollection<SimpleFeatureType,SimpleFeature> reproject(FeatureCollection<SimpleFeatureType,SimpleFeature> features,
                                                                       CoordinateReferenceSystem source,
                                                                       CoordinateReferenceSystem target)
Template method for reprojecting a feature collection from a source crs to a target crs.

Subclasses may override, the default implementation wraps features in a ReprojectingFeatureCollection.

Parameters:
features - The feature collection to be reprojected.
Returns:
the reprojected feature collection.

getSupportedHints

public Set getSupportedHints()
By default, no Hints are supported

Specified by:
getSupportedHints in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
a set of RenderingHints#Key objects (eventually empty, never null).


Copyright © 1996-2010 Geotools. All Rights Reserved.