org.geotools.data.collection
Class CollectionDataStore

Object
  extended by AbstractDataStore
      extended by CollectionDataStore
All Implemented Interfaces:
DataAccess<SimpleFeatureType,SimpleFeature>, 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 AbstractDataStore
isWriteable, listenerManager, LOGGER
 
Constructor Summary
CollectionDataStore(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
          Builds a data store wrapper on top of a feature collection
CollectionDataStore(SimpleFeatureType schema)
          Builds a data store wrapper around an empty collection.
 
Method Summary
protected  ReferencedEnvelope 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  ReferencedEnvelope getBoundsInternal(Query query)
           
 FeatureCollection<SimpleFeatureType,SimpleFeature> 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<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName)
          Provides FeatureReader over the entire contents of typeName.
 SimpleFeatureType getSchema(String typeName)
          Retrive schema information for typeName
 String[] getTypeNames()
          helper method for retrieving all the names.
 
Methods inherited from class AbstractDataStore
createFeatureWriter, createLockingManager, createMetadata, createSchema, dispose, getFeatureReader, getFeatureReader, getFeatureSource, getFeatureSource, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getInfo, getLockingManager, getNames, getSchema, getSupportedHints, getUnsupportedFilter, removeSchema, removeSchema, state, updateSchema, updateSchema
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionDataStore

public CollectionDataStore(SimpleFeatureType schema)
Builds a data store wrapper around an empty collection.

Parameters:
collection -

CollectionDataStore

public CollectionDataStore(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
Builds a data store wrapper on top of a feature collection

Parameters:
collection -
Method Detail

getTypeNames

public String[] getTypeNames()
Description copied from class: AbstractDataStore
helper method for retrieving all the names.

Specified by:
getTypeNames in interface DataStore
Specified by:
getTypeNames in class AbstractDataStore
Returns:
names of feature types available in this DataStore
See Also:
DataStore.getTypeNames()

getSchema

public SimpleFeatureType getSchema(String typeName)
                            throws IOException
Description copied from class: AbstractDataStore
Retrive schema information for typeName

Specified by:
getSchema in interface DataStore
Specified by:
getSchema in class AbstractDataStore
Parameters:
typeName - the feature type name
Returns:
the requested feature type
Throws:
IOException - if typeName is not available
See Also:
DataStore.getSchema(java.lang.String)

getFeatureReader

public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName)
                                                                throws IOException
Provides FeatureReader over the entire contents of typeName.

Implements getFeatureReader contract for AbstractDataStore.

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

getCollection

public FeatureCollection<SimpleFeatureType,SimpleFeature> getCollection()
Returns the feature collection held by this data store


getBounds

protected ReferencedEnvelope 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
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 ReferencedEnvelope getBoundsInternal(Query query)
Parameters:
query -

getCount

protected int getCount(Query query)
                throws 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:
IOException
See Also:
org.geotools.data.AbstractDataStore#getCount(java.lang.String, org.geotools.data.Query)


Copyright © 1996-2014 Geotools. All Rights Reserved.