org.geotools.data.collection
Class CollectionDataStore

java.lang.Object
  extended byorg.geotools.data.AbstractDataStore
      extended byorg.geotools.data.collection.CollectionDataStore
All Implemented Interfaces:
DataStore

public class CollectionDataStore
extends AbstractDataStore

Simple data store wrapper for feature collections. Allows to use feature collections in the user interface layer and everything else where a data store or a feature source is needed.


Field Summary
 
Fields inherited from class org.geotools.data.AbstractDataStore
isWriteable, listenerManager, LOGGER
 
Constructor Summary
CollectionDataStore(FeatureCollection collection)
          Builds a data store wrapper on top of a feature collection
 
Method Summary
protected  com.vividsolutions.jts.geom.Envelope getBounds(Query query)
          Computes the bounds of the features for the specified feature type that satisfy the query provided that there is a fast way to get that result.
protected  com.vividsolutions.jts.geom.Envelope getBoundsInternal(Query query)
           
 FeatureCollection getCollection()
          Returns the feature collection held by this data store
protected  int getCount(Query query)
          Gets the number of the features that would be returned by this query for the specified feature type.
 FeatureReader getFeatureReader(java.lang.String typeName)
          Provides FeatureReader over the entire contents of typeName.
 FeatureType getSchema(java.lang.String typeName)
          Retrive schema information for typeName
 java.lang.String[] getTypeNames()
          Convience method for retriving all the names from the Catalog Entires
 
Methods inherited from class org.geotools.data.AbstractDataStore
createFeatureWriter, createLockingManager, createMetadata, createSchema, getFeatureReader, getFeatureReader, getFeatureSource, getFeatureWriter, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getUnsupportedFilter, getView, updateSchema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionDataStore

public CollectionDataStore(FeatureCollection collection)
Builds a data store wrapper on top of a feature collection

Parameters:
collection -
Method Detail

getTypeNames

public java.lang.String[] getTypeNames()
Description copied from class: AbstractDataStore
Convience method for retriving all the names from the Catalog Entires

Specified by:
getTypeNames in interface DataStore
Specified by:
getTypeNames in class AbstractDataStore
See Also:
DataStore.getTypeNames()

getSchema

public FeatureType getSchema(java.lang.String typeName)
                      throws java.io.IOException
Description copied from class: AbstractDataStore
Retrive schema information for typeName

Specified by:
getSchema in interface DataStore
Specified by:
getSchema in class AbstractDataStore
Throws:
java.io.IOException
See Also:
DataStore.getSchema(java.lang.String)

getFeatureReader

public FeatureReader getFeatureReader(java.lang.String typeName)
                               throws java.io.IOException
Provides FeatureReader over the entire contents of typeName.

Implements getFeatureReader contract for AbstractDataStore.

Specified by:
getFeatureReader in class AbstractDataStore
Parameters:
typeName -
Returns:
Throws:
java.io.IOException - If typeName could not be found
DataSourceException - See IOException
See Also:
AbstractDataStore.getFeatureSource(java.lang.String)

getCollection

public FeatureCollection getCollection()
Returns the feature collection held by this data store

Returns:

getBounds

protected com.vividsolutions.jts.geom.Envelope getBounds(Query query)
                                                  throws SchemaNotFoundException
Description copied from class: AbstractDataStore
Computes the bounds of the features for the specified feature type that satisfy the query provided that there is a fast way to get that result.

Will return null if there is not fast way to compute the bounds. Since it's based on some kind of header/cached information, it's not guaranteed to be real bound of the features

Overrides:
getBounds in class AbstractDataStore
Parameters:
query -
Returns:
the bounds, or null if too expensive
Throws:
SchemaNotFoundException
See Also:
org.geotools.data.AbstractDataStore#getBounds(java.lang.String, org.geotools.data.Query)

getBoundsInternal

protected com.vividsolutions.jts.geom.Envelope getBoundsInternal(Query query)
Parameters:
query -

getCount

protected int getCount(Query query)
                throws java.io.IOException
Description copied from class: AbstractDataStore
Gets the number of the features that would be returned by this query for the specified feature type.

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

Overrides:
getCount in class AbstractDataStore
Parameters:
query - Contains the Filter and MaxFeatures to find the bounds 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:
java.io.IOException - if there are errors getting the count
See Also:
org.geotools.data.AbstractDataStore#getCount(java.lang.String, org.geotools.data.Query)


Copyright © GeoTools. All Rights Reserved.