deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.feature.persistence.memory
Class MemoryFeatureStore

java.lang.Object
  extended by org.deegree.feature.persistence.memory.MemoryFeatureStore
All Implemented Interfaces:
FeatureStore

public class MemoryFeatureStore
extends Object
implements FeatureStore

FeatureStore implementation that keeps the feature instances in memory.

Version:
$Revision: $, $Date: $
Author:
Markus Schneider, last edited by: $Author: schneider $
See Also:
FeatureStore

Field Summary
(package private)  DefaultLockManager lockManager
           
 
Constructor Summary
MemoryFeatureStore(ApplicationSchema schema)
          Creates a new MemoryFeatureStore for the given ApplicationSchema.
MemoryFeatureStore(URL docURL, ApplicationSchema schema)
          Creates a new MemoryFeatureStore that is backed by the given GML file.
 
Method Summary
 FeatureStoreTransaction acquireTransaction()
          Acquires transactional access to the feature store.
(package private)  void addFeatures(Collection<Feature> features)
          Adds the given Feature instances.
(package private)  void addGeometriesWithId(Collection<Geometry> geometries)
          Adds the given identified Geometry instances.
 void destroy()
          Called by the container to indicate that this FeatureStore instance is being taken out of service.
(package private)  FeatureCollection getCollection(FeatureType ft)
           
 Envelope getEnvelope(QName ftName)
          Returns the envelope for all stored features of the given type.
 LockManager getLockManager()
          Returns the associated LockManager.
 GMLObject getObjectById(String id)
          Retrieves the stored object with a certain id.
 ApplicationSchema getSchema()
          Returns the application schema that this FeatureStore serves.
 CRS getStorageSRS()
          Returns the native CRS used for storing geometries.
 void init()
          Called by the container to indicate that this FeatureStore instance is being placed into service.
 boolean isAvailable()
          Returns whether the store is currently able to perform operations.
 FeatureResultSet query(Query query)
          Performs the given query and returns the matching features as a FeatureResultSet.
 FeatureResultSet query(Query[] queries)
          Performs the given queries and returns the matching features as a FeatureResultSet.
 int queryHits(Query query)
          Returns the number of features that are matched by the given query.
 int queryHits(Query[] queries)
          Returns the number of features that are matched by the given queries.
(package private)  void releaseTransaction(MemoryFeatureStoreTransaction ta)
          Returns the transaction to the datastore.
(package private)  void removeObject(String id)
           
(package private)  void setCollection(FeatureType ft, FeatureCollection fc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lockManager

DefaultLockManager lockManager
Constructor Detail

MemoryFeatureStore

public MemoryFeatureStore(ApplicationSchema schema)
                   throws FeatureStoreException
Creates a new MemoryFeatureStore for the given ApplicationSchema.

Parameters:
schema - application schema, must not be null
Throws:
FeatureStoreException

MemoryFeatureStore

public MemoryFeatureStore(URL docURL,
                          ApplicationSchema schema)
                   throws XMLStreamException,
                          XMLParsingException,
                          UnknownCRSException,
                          FactoryConfigurationError,
                          IOException,
                          FeatureStoreException,
                          ReferenceResolvingException
Creates a new MemoryFeatureStore that is backed by the given GML file.

Parameters:
docURL -
schema -
Throws:
XMLStreamException
XMLParsingException
UnknownCRSException
FactoryConfigurationError
IOException
FeatureStoreException
ReferenceResolvingException
Method Detail

addFeatures

void addFeatures(Collection<Feature> features)
Adds the given Feature instances.

Parameters:
features - features

addGeometriesWithId

void addGeometriesWithId(Collection<Geometry> geometries)
                   throws UnknownCRSException
Adds the given identified Geometry instances.

Parameters:
geometries - geometries with ids
Throws:
UnknownCRSException

destroy

public void destroy()
Description copied from interface: FeatureStore
Called by the container to indicate that this FeatureStore instance is being taken out of service.

Specified by:
destroy in interface FeatureStore

init

public void init()
Description copied from interface: FeatureStore
Called by the container to indicate that this FeatureStore instance is being placed into service.

Specified by:
init in interface FeatureStore

getSchema

public ApplicationSchema getSchema()
Description copied from interface: FeatureStore
Returns the application schema that this FeatureStore serves.

Specified by:
getSchema in interface FeatureStore
Returns:
the served application schema, never null

query

public FeatureResultSet query(Query query)
                       throws FilterEvaluationException,
                              FeatureStoreException
Description copied from interface: FeatureStore
Performs the given query and returns the matching features as a FeatureResultSet.

Specified by:
query in interface FeatureStore
Parameters:
query - query to be performed, must not be null
Returns:
matching features, never null
Throws:
FilterEvaluationException - if the filter contained in the query could not be evaluated
FeatureStoreException - if the query could not be performed

query

public FeatureResultSet query(Query[] queries)
                       throws FeatureStoreException,
                              FilterEvaluationException
Description copied from interface: FeatureStore
Performs the given queries and returns the matching features as a FeatureResultSet.

Specified by:
query in interface FeatureStore
Parameters:
queries - queries to be performed, must not be null and contain at least one entry
Returns:
matching features, never null
Throws:
FeatureStoreException - if the query could not be performed
FilterEvaluationException - if the filter contained in the query could not be evaluated

queryHits

public int queryHits(Query query)
              throws FilterEvaluationException,
                     FeatureStoreException
Description copied from interface: FeatureStore
Returns the number of features that are matched by the given query.

Specified by:
queryHits in interface FeatureStore
Parameters:
query - query to be performed, must not be null
Returns:
number of matching featuress
Throws:
FilterEvaluationException - if the filter contained in the query could not be evaluated
FeatureStoreException - if the query could not be performed

queryHits

public int queryHits(Query[] queries)
              throws FeatureStoreException,
                     FilterEvaluationException
Description copied from interface: FeatureStore
Returns the number of features that are matched by the given queries.

Specified by:
queryHits in interface FeatureStore
Parameters:
queries - queries to be performed, must not be null and contain at least one entry
Returns:
number of matching features
Throws:
FeatureStoreException - if the query could not be performed
FilterEvaluationException - if the filter contained in the query could not be evaluated

getObjectById

public GMLObject getObjectById(String id)
Description copied from interface: FeatureStore
Retrieves the stored object with a certain id. TODO check if a common interface for returned objects should be used here (instead of Object)

Specified by:
getObjectById in interface FeatureStore
Parameters:
id - identifier of the object to be retrieved
Returns:
the stored object (either a Feature or a Geometry) or null if no object with the given id is known

acquireTransaction

public FeatureStoreTransaction acquireTransaction()
                                           throws FeatureStoreException
Description copied from interface: FeatureStore
Acquires transactional access to the feature store.

Specified by:
acquireTransaction in interface FeatureStore
Returns:
transaction object that allows to perform transactions operations on the datastore, never null
Throws:
FeatureStoreException - if the transactional access could not be acquired or is not implemented for this FeatureStore

releaseTransaction

void releaseTransaction(MemoryFeatureStoreTransaction ta)
                  throws FeatureStoreException
Returns the transaction to the datastore. This makes the transaction available to other clients again (via acquireTransaction().

The transaction should be terminated, i.e. commit() or rollback() must have been called before.

Parameters:
ta - the DatastoreTransaction to be returned
Throws:
FeatureStoreException

getCollection

FeatureCollection getCollection(FeatureType ft)

setCollection

void setCollection(FeatureType ft,
                   FeatureCollection fc)

removeObject

void removeObject(String id)
            throws FeatureStoreException
Throws:
FeatureStoreException

getLockManager

public LockManager getLockManager()
                           throws FeatureStoreException
Description copied from interface: FeatureStore
Returns the associated LockManager.

Specified by:
getLockManager in interface FeatureStore
Returns:
the associated LockManager instance, never null
Throws:
FeatureStoreException - if the FeatureStore does not implement locking

getEnvelope

public Envelope getEnvelope(QName ftName)
Description copied from interface: FeatureStore
Returns the envelope for all stored features of the given type.

Specified by:
getEnvelope in interface FeatureStore
Parameters:
ftName - name of the feature type, must not be null and must be served by this store
Returns:
the envelope (using the native CRS), or null if the feature type is not known

isAvailable

public boolean isAvailable()
Description copied from interface: FeatureStore
Returns whether the store is currently able to perform operations.

Specified by:
isAvailable in interface FeatureStore
Returns:
true, if the store is functional, false otherwise

getStorageSRS

public CRS getStorageSRS()
Description copied from interface: FeatureStore
Returns the native CRS used for storing geometries.

Specified by:
getStorageSRS in interface FeatureStore
Returns:
the native CRS used for storing geometries, can be null

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>