org.deegree.feature.persistence.sql
Class SQLFeatureStore

java.lang.Object
  extended by org.deegree.feature.persistence.sql.SQLFeatureStore
All Implemented Interfaces:
Resource, FeatureStore

public class SQLFeatureStore
extends Object
implements FeatureStore

FeatureStore that is backed by a spatial SQL database.

Version:
$Revision: 32096 $, $Date: 2011-10-05 13:41:47 +0200 (Wed, 05 Oct 2011) $
Author:
Markus Schneider, last edited by: $Author: mschneider $
See Also:
SQLDialect

Constructor Summary
SQLFeatureStore(SQLFeatureStoreJAXB config, URL configURL, SQLDialect dialect)
          Creates a new SQLFeatureStore for the given configuration.
 
Method Summary
 FeatureStoreTransaction acquireTransaction()
          Acquires transactional access to the feature store.
 Envelope calcEnvelope(QName ftName)
          Recalculates the envelope for all stored features of the given type.
 void destroy()
          Usually called by the ResourceManager upon workspace shutdown.
 FeatureStoreCache getCache()
          Returns the FeatureStoreCache.
static Geometry getCompatibleGeometry(Geometry literal, ICRS crs)
          Returns a transformed version of the given Geometry in the specified CRS.
protected  Connection getConnection()
           
 String getConnId()
           
 ParticleConverter<?> getConverter(Mapping mapping)
          Returns a ParticleConverter for the given Mapping instance from the served MappedAppSchema.
 SQLDialect getDialect()
           
 Envelope getEnvelope(QName ftName)
          Returns the envelope for all stored features of the given type.
 LockManager getLockManager()
          Returns the associated LockManager.
 FeatureTypeMapping getMapping(QName ftName)
          Returns the relational mapping for the given feature type name.
 Map<String,String> getNamespaceContext()
           
 GMLObject getObjectById(String id)
          Retrieves the stored object with a certain id.
 GMLReferenceResolver getResolver()
          Returns a resolver instance for resolving references to objects that are stored in this feature store.
 MappedAppSchema getSchema()
          Returns the application schema that this FeatureStore serves.
 void init(DeegreeWorkspace workspace)
          Usually called by the ResourceManager upon workspace startup.
 boolean isAvailable()
          Returns whether the store is currently able to perform operations.
 FeatureInputStream query(Query query)
          Performs the given query and returns the matching features as a FeatureInputStream.
 FeatureInputStream query(Query[] queries)
          Performs the given queries and returns the matching features as a FeatureInputStream.
 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

SQLFeatureStore

public SQLFeatureStore(SQLFeatureStoreJAXB config,
                       URL configURL,
                       SQLDialect dialect)
Creates a new SQLFeatureStore for the given configuration.

Parameters:
config - jaxb configuration object
configURL - configuration systemid
Method Detail

init

public void init(DeegreeWorkspace workspace)
          throws ResourceInitException
Description copied from interface: Resource
Usually called by the ResourceManager upon workspace startup.

Specified by:
init in interface Resource
Parameters:
workspace - the workspace the resource belongs to, may be null
Throws:
ResourceInitException

getSchema

public MappedAppSchema 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

getConnId

public String getConnId()

getMapping

public FeatureTypeMapping getMapping(QName ftName)
Returns the relational mapping for the given feature type name.

Parameters:
ftName - name of the feature type, must not be null
Returns:
relational mapping for the feature type, may be null (no relational mapping)

getConverter

public ParticleConverter<?> getConverter(Mapping mapping)
Returns a ParticleConverter for the given Mapping instance from the served MappedAppSchema.

Parameters:
mapping - particle mapping, must not be null
Returns:
particle converter, never null

getEnvelope

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

NOTE: This method may return incorrect (cached) results. Use FeatureStore.calcEnvelope(QName) to force the recalculation of the Envelope.

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 storage CRS), or null if the feature type does not have an envelope (no geometry properties or no instances)
Throws:
FeatureStoreException

calcEnvelope

public Envelope calcEnvelope(QName ftName)
                      throws FeatureStoreException
Description copied from interface: FeatureStore
Recalculates the envelope for all stored features of the given type.

NOTE: This method may potentially be expensive. Depending on the implementation, it may involve fetching all features of the specified type.

Specified by:
calcEnvelope 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 storage CRS), or null if the feature type does not have an envelope (no geometry properties or no instances)
Throws:
FeatureStoreException

getObjectById

public GMLObject getObjectById(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

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, or null if the FeatureStore does not implement locking
Throws:
FeatureStoreException - if the lock manager could not be acquired

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

getCache

public FeatureStoreCache getCache()
Returns the FeatureStoreCache.

Returns:
feature store cache, never null

getResolver

public GMLReferenceResolver getResolver()
Returns a resolver instance for resolving references to objects that are stored in this feature store.

Returns:
resolver, never null

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

destroy

public void destroy()
Description copied from interface: Resource
Usually called by the ResourceManager upon workspace shutdown.

Specified by:
destroy in interface Resource

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, one entry per query
Throws:
FeatureStoreException - if the query could not be performed
FilterEvaluationException - if the filter contained in the query could not be evaluated

getNamespaceContext

public Map<String,String> getNamespaceContext()

getCompatibleGeometry

public static Geometry getCompatibleGeometry(Geometry literal,
                                             ICRS crs)
                                      throws FilterEvaluationException
Returns a transformed version of the given Geometry in the specified CRS.

Parameters:
literal -
crs -
Returns:
transformed version of the geometry, never null
Throws:
FilterEvaluationException

query

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

Specified by:
query in interface FeatureStore
Parameters:
query - query to be performed, must not be null
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

query

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

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

getConnection

protected Connection getConnection()
                            throws SQLException
Throws:
SQLException

getDialect

public SQLDialect getDialect()


Copyright © 2011. All Rights Reserved.