org.geotools.data
Class AbstractFeatureSource

java.lang.Object
  extended byorg.geotools.data.AbstractFeatureSource
All Implemented Interfaces:
FeatureSource
Direct Known Subclasses:
AbstractFeatureStore, WFSFeatureSource

public abstract class AbstractFeatureSource
extends java.lang.Object
implements FeatureSource

This is a starting point for providing your own FeatureSource implementation.

Subclasses must implement:

You may find a FeatureSource implementations that is more specific to your needs - such as JDBCFeatureSource.

For an example of this class customized for use please see MemoryDataStore.

Author:
Jody Garnett, Refractions Research Inc

Constructor Summary
AbstractFeatureSource()
           
 
Method Summary
 com.vividsolutions.jts.geom.Envelope getBounds()
          Retrieve Bounds of all Features.
 com.vividsolutions.jts.geom.Envelope getBounds(Query query)
          Retrieve Bounds of Query results.
 int getCount(Query query)
          Retrieve total number of Query results.
 FeatureCollection getFeatures()
          Retrieve all Features.
 FeatureCollection getFeatures(Filter filter)
          Retrieve all Feature matching the Filter.
 FeatureCollection getFeatures(Query query)
          Provides an interface to for the Resutls of a Query.
 Transaction getTransaction()
          Retrieve the Transaction this FeatureSource is opperating against.
protected  Query namedQuery(Query query)
          Ensure query modified with typeName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.data.FeatureSource
addFeatureListener, getDataStore, getSchema, removeFeatureListener
 

Constructor Detail

AbstractFeatureSource

public AbstractFeatureSource()
Method Detail

getTransaction

public Transaction getTransaction()
Retrieve the Transaction this FeatureSource is opperating against.

For a plain FeatureSource that cannot modify this will always be Transaction.AUTO_COMMIT.

Returns:
Transacstion FeatureSource is opperating against

getFeatures

public FeatureCollection getFeatures(Query query)
Provides an interface to for the Resutls of a Query.

Various queries can be made against the results, the most basic being to retrieve Features.

Specified by:
getFeatures in interface FeatureSource
Parameters:
query -
Returns:
See Also:
FeatureSource.getFeatures(org.geotools.data.Query)

getFeatures

public FeatureCollection getFeatures(Filter filter)
                              throws java.io.IOException
Retrieve all Feature matching the Filter.

Specified by:
getFeatures in interface FeatureSource
Parameters:
filter - Indicates features to retrieve
Returns:
FeatureResults indicating features matching filter
Throws:
java.io.IOException - If results could not be obtained

getFeatures

public FeatureCollection getFeatures()
                              throws java.io.IOException
Retrieve all Features.

Specified by:
getFeatures in interface FeatureSource
Returns:
FeatureResults of all Features in FeatureSource
Throws:
java.io.IOException - If features could not be obtained

getBounds

public com.vividsolutions.jts.geom.Envelope getBounds()
                                               throws java.io.IOException
Retrieve Bounds of all Features.

Currently returns null, consider getFeatures().getBounds() instead.

Subclasses may override this method to perform the appropriate optimization for this result.

Specified by:
getBounds in interface FeatureSource
Returns:
null representing the lack of an optimization
Throws:
java.io.IOException - DOCUMENT ME!

getBounds

public com.vividsolutions.jts.geom.Envelope getBounds(Query query)
                                               throws java.io.IOException
Retrieve Bounds of Query results.

Currently returns null, consider getFeatures( query ).getBounds() instead.

Subclasses may override this method to perform the appropriate optimization for this result.

Specified by:
getBounds in interface FeatureSource
Parameters:
query - Query we are requesting the bounds of
Returns:
null representing the lack of an optimization
Throws:
java.io.IOException - DOCUMENT ME!

namedQuery

protected Query namedQuery(Query query)
Ensure query modified with typeName.

This method will make copy of the provided query, using DefaultQuery, if query.getTypeName is not equal to getSchema().getTypeName().

Parameters:
query - Origional query
Returns:
Query with getTypeName() equal to getSchema().getTypeName()

getCount

public int getCount(Query query)
             throws java.io.IOException
Retrieve total number of Query results.

Currently returns -1, consider getFeatures( query ).getCount() instead.

Subclasses may override this method to perform the appropriate optimization for this result.

Specified by:
getCount in interface FeatureSource
Parameters:
query - Query we are requesting the count of
Returns:
-1 representing the lack of an optimization
Throws:
java.io.IOException - if there are errors getting the count


Copyright © GeoTools. All Rights Reserved.