org.deegree.feature.persistence.shape
Class ShapeFeatureStore

java.lang.Object
  extended by org.deegree.feature.persistence.shape.ShapeFeatureStore
All Implemented Interfaces:
FeatureStore

public class ShapeFeatureStore
extends java.lang.Object
implements FeatureStore

FeatureStore implementation that uses shape files as backend.

Version:
$Revision: 27750 $, $Date: 2010-11-03 16:49:44 +0100 (Mi, 03. Nov 2010) $
Author:
Andreas Schmitz, Markus Schneider, last edited by: $Author: mschneider $
See Also:
FeatureStore

Constructor Summary
ShapeFeatureStore(java.lang.String shpName, CRS crs, java.nio.charset.Charset encoding, java.lang.String ftNamespace, java.lang.String localFtName, java.lang.String ftPrefix, boolean generateAlphanumericIndexes, FeatureStoreCache cache)
          Creates a new ShapeFeatureStore instance from the given parameters.
 
Method Summary
 FeatureStoreTransaction acquireTransaction()
          Acquires transactional access to the feature store.
 void destroy()
          Called by the container to indicate that this FeatureStore instance is being taken out of service.
 Envelope getEnvelope(javax.xml.namespace.QName ftName)
          Returns the envelope for all stored features of the given type.
 LockManager getLockManager()
          Returns the associated LockManager.
 GMLObject getObjectById(java.lang.String id)
          Retrieves the stored object with a certain id.
 ApplicationSchema getSchema()
          Returns the application schema that this FeatureStore serves.
 CRS getStorageCRS()
          Returns the CRS used by the shape file.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeFeatureStore

public ShapeFeatureStore(java.lang.String shpName,
                         CRS crs,
                         java.nio.charset.Charset encoding,
                         java.lang.String ftNamespace,
                         java.lang.String localFtName,
                         java.lang.String ftPrefix,
                         boolean generateAlphanumericIndexes,
                         FeatureStoreCache cache)
Creates a new ShapeFeatureStore instance from the given parameters.

Parameters:
shpName - name of the shape file to be loaded, may omit the ".shp" extension, must not be nullcrs - crs used by the shape file, must not be null
encoding - encoding used in the dbf file, can be null (encoding guess mode)
ftNamespace - namespace to be used for the feature type, must not be null
localFtName - if null, the shape file base name will be used
ftPrefix -
generateAlphanumericIndexes - whether to copy the dbf into a h2 database for indexing
cache - used for caching retrieved feature instances, can be null (will create a default cache)
Method Detail

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

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 FeatureStoreException,
                     FilterEvaluationException
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:
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[] 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

getEnvelope

public Envelope getEnvelope(javax.xml.namespace.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 of the shape file

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

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:
whether the shape file is currently available

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

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

getObjectById

public GMLObject getObjectById(java.lang.String id)
                        throws FeatureStoreException
Description copied from interface: FeatureStore
Retrieves the stored object with a certain id.

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

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

getStorageCRS

public CRS getStorageCRS()
Returns the CRS used by the shape file.

Returns:
the CRS used by the shape file, never null


Copyright © 2011. All Rights Reserved.