deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.io.datastore
Class Datastore

java.lang.Object
  extended by org.deegree.io.datastore.Datastore
Direct Known Subclasses:
AbstractSQLDatastore, CachedWFSDatastore, CascadingWFSDatastore, SDEDatastore, ShapeDatastore

public abstract class Datastore
extends java.lang.Object

A datastore implementation must extend this class.

Describes the access to a datastore that encapsulates the access to a database or file. The accessible objects are Feature instances. Primarily, datastores are used as persistence layer by the WFService class.

Version:
$Revision: 23693 $, $Date: 2010-04-20 14:33:55 +0200 (Di, 20 Apr 2010) $
Author:
Andreas Poth , Torsten Friebe , Markus Schneider , last edited by: $Author: hrubach $

Field Summary
static int SRS_UNDEFINED
           
 
Constructor Summary
Datastore()
           
 
Method Summary
 DatastoreTransaction acquireTransaction()
          Acquires transactional access to the datastore instance.
 void bindSchema(MappedGMLSchema schema)
          Adds the given GML application schema to the set of schemas that are handled by this datastore instance.
protected  boolean canTransformTo(java.lang.String targetSRS)
          Returns whether the datastore is capable of performing a native coordinate transformation (using an SQL function call for example) into the given SRS.
abstract  void close()
          Closes the datastore so it can free dependent resources.
 void configure(DatastoreConfiguration config)
          Configures the datastore with the supplied configuration.
 java.util.Set<FeatureId> determineFidsToLock(java.util.List<Lock> requestParts)
          Determines the ids of all features to be locked by the given parts of a LockFeature request, this includes all descendant and super features of the targeted features as well.
abstract  AnnotationDocument getAnnotationParser()
          Returns the datastore specific annotation parser.
 DatastoreConfiguration getConfiguration()
          Returns the configuration parameters of the datastore.
 MappedFeatureType getFeatureType(QualifiedName ftName)
          Returns the feature type with the given name.
 MappedGMLSchema[] getSchemas()
          Returns the GML application schemas that are handled by this datastore.
abstract  FeatureCollection performQuery(Query query, MappedFeatureType[] rootFts)
          Performs a query against the datastore.
abstract  FeatureCollection performQuery(Query query, MappedFeatureType[] rootFts, DatastoreTransaction context)
          Performs a query against the datastore (in the given transaction context).
 void releaseTransaction(DatastoreTransaction ta)
          Returns the transaction to the datastore.
protected  Query transformQuery(Query query)
          Transforms the incoming Query so that the CoordinateSystem of all spatial arguments (BBOX, etc.) in the Filter match the SRS of the targeted MappingGeometryFields.
protected  FeatureCollection transformResult(FeatureCollection fc, java.lang.String targetSRS)
          Transforms the FeatureCollection so that the geometries of all contained geometry properties use the requested SRS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SRS_UNDEFINED

public static final int SRS_UNDEFINED
See Also:
Constant Field Values
Constructor Detail

Datastore

public Datastore()
Method Detail

getAnnotationParser

public abstract AnnotationDocument getAnnotationParser()
Returns the datastore specific annotation parser.

Returns:
the datastore specific annotation parser

configure

public void configure(DatastoreConfiguration config)
               throws DatastoreException
Configures the datastore with the supplied configuration.

Parameters:
config - configuration
Throws:
DatastoreException

getConfiguration

public DatastoreConfiguration getConfiguration()
Returns the configuration parameters of the datastore.

Returns:
the configuration parameters of the datastore

bindSchema

public void bindSchema(MappedGMLSchema schema)
                throws DatastoreException
Adds the given GML application schema to the set of schemas that are handled by this datastore instance.

Note that this method may be called several times for every GML schema that uses this datastore instance.

Parameters:
schema - GML application schema to bind
Throws:
DatastoreException

getSchemas

public MappedGMLSchema[] getSchemas()
Returns the GML application schemas that are handled by this datastore.

Returns:
the GML application schemas that are handled by this datastore

getFeatureType

public MappedFeatureType getFeatureType(QualifiedName ftName)
Returns the feature type with the given name.

Parameters:
ftName - name of the feature type
Returns:
the feature type with the given name, or null if the Datastore does not this feature type

close

public abstract void close()
                    throws DatastoreException
Closes the datastore so it can free dependent resources.

Throws:
DatastoreException

performQuery

public abstract FeatureCollection performQuery(Query query,
                                               MappedFeatureType[] rootFts)
                                        throws DatastoreException,
                                               UnknownCRSException
Performs a query against the datastore.

Parameters:
query - query to be performed
rootFts - the root feature types that are queried, more than one type means that the types are joined
Returns:
requested feature instances
Throws:
DatastoreException
UnknownCRSException

performQuery

public abstract FeatureCollection performQuery(Query query,
                                               MappedFeatureType[] rootFts,
                                               DatastoreTransaction context)
                                        throws DatastoreException,
                                               UnknownCRSException
Performs a query against the datastore (in the given transaction context).

Parameters:
query - query to be performed
rootFts - the root feature types that are queried, more than one type means that the types are joined
context - context (used to specify the JDBCConnection, for example)
Returns:
requested feature instances
Throws:
DatastoreException
UnknownCRSException

determineFidsToLock

public java.util.Set<FeatureId> determineFidsToLock(java.util.List<Lock> requestParts)
                                             throws DatastoreException
Determines the ids of all features to be locked by the given parts of a LockFeature request, this includes all descendant and super features of the targeted features as well.

Parameters:
requestParts - the parts of a LockFeature request that this Datastore is responsible for
Returns:
the ids of all features that have to be locked
Throws:
DatastoreException

acquireTransaction

public DatastoreTransaction acquireTransaction()
                                        throws DatastoreException
Acquires transactional access to the datastore instance. There's only one active transaction per datastore allowed.

Returns:
transaction object that allows to perform transactions operations on the datastore
Throws:
DatastoreException

releaseTransaction

public void releaseTransaction(DatastoreTransaction ta)
                        throws DatastoreException
Returns the transaction to the datastore. This makes the transaction available to other clients again (via acquireTransaction()). Underlying resources (such as JDBCConnections are freed).

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

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

transformQuery

protected Query transformQuery(Query query)
Transforms the incoming Query so that the CoordinateSystem of all spatial arguments (BBOX, etc.) in the Filter match the SRS of the targeted MappingGeometryFields.

NOTE: If this transformation can be performed by the backend (e.g. by Oracle Spatial), this method should be overwritten to return the original input Query.

Parameters:
query - query to be transformed
Returns:
query with spatial arguments transformed to target SRS

transformResult

protected FeatureCollection transformResult(FeatureCollection fc,
                                            java.lang.String targetSRS)
Transforms the FeatureCollection so that the geometries of all contained geometry properties use the requested SRS.

Parameters:
fc - feature collection to be transformed
targetSRS - requested SRS
Returns:
transformed FeatureCollection

canTransformTo

protected boolean canTransformTo(java.lang.String targetSRS)
Returns whether the datastore is capable of performing a native coordinate transformation (using an SQL function call for example) into the given SRS.

Datastore implementations capable of performing native coordinate transformations must override this class.

Parameters:
targetSRS - target spatial reference system (usually "EPSG:XYZ")
Returns:
true, if the datastore can perform the coordinate transformation, false otherwise

deegree 2.5 (2011/06/29 09:44 build-8-official)

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