|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.io.datastore.Datastore org.deegree.io.datastore.sql.AbstractSQLDatastore
public abstract class AbstractSQLDatastore
This abstract class implements the common functionality of Datastore
implementations that use SQL databases
as backend.
QueryHandler
Field Summary | |
---|---|
protected DBConnectionPool |
pool
Pool of database connections. |
protected static int |
SRS_UNDEFINED
Database specific SRS code for an unspecified SRS. |
Constructor Summary | |
---|---|
AbstractSQLDatastore()
|
Method Summary | |
---|---|
protected java.sql.Connection |
acquireConnection()
Returns the database connection requested for. |
DatastoreTransaction |
acquireTransaction()
Acquires transactional access to the datastore. |
void |
appendGeometryColumnGet(StatementBuffer query,
java.lang.String tableAlias,
java.lang.String column)
|
SQLFunctionCall |
buildSRSTransformCall(MappedGeometryPropertyType geoProperty,
java.lang.String targetSRS)
Returns an SQLFunctionCall that refers to the given MappedGeometryPropertyType in the specified
target SRS using a database specific SQL function. |
java.lang.String |
buildSRSTransformCall(java.lang.String geomIdentifier,
int nativeSRSCode)
Builds an SQL fragment that converts the given geometry to the specified SRS. |
(package private) java.lang.String |
checkTransformation(MappedGeometryPropertyType pt,
java.lang.String queriedSrs)
Checks whether the (native) coordinate transformation of the specified geometry property to the given SRS is possible (and necessary), i.e. |
void |
close()
Closes the datastore so it can free dependent resources. |
void |
configure(DatastoreConfiguration datastoreConfiguration)
Configures the datastore with the supplied configuration. |
abstract Geometry |
convertDBToDeegreeGeometry(java.lang.Object value,
CoordinateSystem targetSRS,
java.sql.Connection conn)
Converts a database specific geometry Object from the ResultSet to a deegree
Geometry . |
abstract java.lang.Object |
convertDeegreeToDBGeometry(Geometry geometry,
int nativeSRSCode,
java.sql.Connection conn)
Converts a deegree Geometry to a database specific geometry Object . |
java.lang.Object |
convertFromDBType(java.lang.Object rsObject,
int sqlTypeCode)
Converts the given object from a java.sql.ResultSet column to the common type to be used as a
feature property. |
protected SQLTransaction |
createTransaction()
Creates a new SQLTransaction that provides transactional access. |
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. |
AnnotationDocument |
getAnnotationParser()
Returns the datastore specific annotation parser. |
int |
getMaxValue(java.sql.Connection conn,
java.lang.String tableName,
java.lang.String columnName)
Returns the maximum (integer) value stored in a certain table column. |
int |
getNativeSRSCode(java.lang.String srsName)
Returns the database specific code for the given SRS name. |
java.lang.Object |
getSequenceCurrValPlusOffset(java.sql.Connection conn,
java.lang.String sequence,
int offset)
Overwrite this to enable the datastore to fetch the current value (plus an offset) of a SQL sequence. |
java.lang.Object |
getSequenceNextVal(java.sql.Connection conn,
java.lang.String sequence)
Overwrite this to enable the datastore to fetch the next value of a SQL sequence. |
WhereBuilder |
getWhereBuilder(MappedFeatureType[] rootFts,
java.lang.String[] aliases,
Filter filter,
SortProperty[] sortProperties,
TableAliasGenerator aliasGenerator,
VirtualContentProvider vcProvider)
Overwrite this to return a database specific (spatial capable) WhereBuilder implementation. |
FeatureCollection |
performQuery(Query query,
MappedFeatureType[] rootFts)
Performs a query against the datastore. |
protected FeatureCollection |
performQuery(Query query,
MappedFeatureType[] rootFts,
java.sql.Connection conn)
Performs a Query against the datastore. |
FeatureCollection |
performQuery(Query query,
MappedFeatureType[] rootFts,
DatastoreTransaction context)
Performs a query against the datastore (in the given transaction context). |
java.sql.PreparedStatement |
prepareStatement(java.sql.Connection conn,
StatementBuffer statementBuffer)
Converts the StatementBuffer into a PreparedStatement , which is initialized and ready
to be performed. |
void |
releaseConnection(java.sql.Connection conn)
Releases the connection. |
void |
releaseTransaction(DatastoreTransaction ta)
Returns the transaction to the datastore. |
Methods inherited from class org.deegree.io.datastore.Datastore |
---|
bindSchema, canTransformTo, getConfiguration, getFeatureType, getSchemas, transformQuery, transformResult |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int SRS_UNDEFINED
protected DBConnectionPool pool
Constructor Detail |
---|
public AbstractSQLDatastore()
Method Detail |
---|
public AnnotationDocument getAnnotationParser()
Datastore
getAnnotationParser
in class Datastore
public void configure(DatastoreConfiguration datastoreConfiguration) throws DatastoreException
Datastore
configure
in class Datastore
datastoreConfiguration
- configuration
DatastoreException
public void close() throws DatastoreException
Datastore
close
in class Datastore
DatastoreException
public WhereBuilder getWhereBuilder(MappedFeatureType[] rootFts, java.lang.String[] aliases, Filter filter, SortProperty[] sortProperties, TableAliasGenerator aliasGenerator, VirtualContentProvider vcProvider) throws DatastoreException
WhereBuilder
implementation.
rootFts
- involved (requested) feature typesaliases
- aliases for the feature types, may be nullfilter
- filter that restricts the matched featuressortProperties
- sort criteria for the result, may be null or emptyaliasGenerator
- used to generate unique table aliasesvcProvider
-
WhereBuilder
implementation suitable for this datastore
DatastoreException
public FeatureCollection performQuery(Query query, MappedFeatureType[] rootFts) throws DatastoreException, UnknownCRSException
Datastore
performQuery
in class Datastore
query
- query to be performedrootFts
- the root feature types that are queried, more than one type means that the types
are joined
DatastoreException
UnknownCRSException
public FeatureCollection performQuery(Query query, MappedFeatureType[] rootFts, DatastoreTransaction context) throws DatastoreException, UnknownCRSException
Datastore
performQuery
in class Datastore
query
- query to be performedrootFts
- the root feature types that are queried, more than one type means that the types
are joinedcontext
- context (used to specify the JDBCConnection, for example)
DatastoreException
UnknownCRSException
protected FeatureCollection performQuery(Query query, MappedFeatureType[] rootFts, java.sql.Connection conn) throws DatastoreException, UnknownCRSException
Query
against the datastore.
Note that this method is responsible for the coordinate system tranformation of the input Query
and the
output FeatureCollection
.
query
- query to be performedrootFts
- the root feature types that are queried, more than one type means that the types are joinedconn
- JDBC connection to use
DatastoreException
UnknownCRSException
public DatastoreTransaction acquireTransaction() throws DatastoreException
acquireTransaction
in class Datastore
DatastoreException
protected SQLTransaction createTransaction() throws DatastoreException
SQLTransaction
that provides transactional access.
SQLTransaction
instance
DatastoreException
public void releaseTransaction(DatastoreTransaction ta) throws DatastoreException
acquireTransaction
). Underlying resources (such as JDBCConnections are freed).
The transaction should be terminated, i.e. commit() or rollback() must have been called before.
releaseTransaction
in class Datastore
ta
- the DatastoreTransaction to be returned
DatastoreException
public java.util.Set<FeatureId> determineFidsToLock(java.util.List<Lock> requestParts) throws DatastoreException
Datastore
LockFeature
request, this includes all descendant and super features of the targeted features as well.
determineFidsToLock
in class Datastore
requestParts
- the parts of a LockFeature
request that this Datastore
is responsible for
DatastoreException
public abstract Geometry convertDBToDeegreeGeometry(java.lang.Object value, CoordinateSystem targetSRS, java.sql.Connection conn) throws java.sql.SQLException
Object
from the ResultSet
to a deegree
Geometry
.
value
- targetSRS
- conn
-
java.sql.SQLException
public abstract java.lang.Object convertDeegreeToDBGeometry(Geometry geometry, int nativeSRSCode, java.sql.Connection conn) throws DatastoreException
Geometry
to a database specific geometry Object
.
geometry
- nativeSRSCode
- conn
-
DatastoreException
protected java.sql.Connection acquireConnection() throws DatastoreException
DatastoreException
public void releaseConnection(java.sql.Connection conn) throws DatastoreException
conn
- connection to be released.
DatastoreException
public java.sql.PreparedStatement prepareStatement(java.sql.Connection conn, StatementBuffer statementBuffer) throws java.sql.SQLException, DatastoreException
StatementBuffer
into a PreparedStatement
, which is initialized and ready
to be performed.
conn
- connection to be used to create the PreparedStatement
statementBuffer
-
PreparedStatment
, ready to be performed
java.sql.SQLException
- if a JDBC related error occurs
DatastoreException
public java.lang.Object convertFromDBType(java.lang.Object rsObject, int sqlTypeCode) throws DatastoreException
java.sql.ResultSet
column to the common type to be used as a
feature property.
rsObject
- sqlTypeCode
-
DatastoreException
public java.lang.Object getSequenceNextVal(java.sql.Connection conn, java.lang.String sequence) throws DatastoreException
conn
- JDBC connection to be used.sequence
- name of the SQL sequence.
DatastoreException
- if the value could not be retrievedpublic java.lang.Object getSequenceCurrValPlusOffset(java.sql.Connection conn, java.lang.String sequence, int offset) throws DatastoreException
conn
- JDBC connection to be used.sequence
- name of the SQL sequenceoffset
- offset added to the sequence value
DatastoreException
- if the value could not be retrievedpublic int getMaxValue(java.sql.Connection conn, java.lang.String tableName, java.lang.String columnName) throws IdGenerationException
conn
- JDBC connection to be usedtableName
- name of the tablecolumnName
- name of the column
IdGenerationException
- if the value could not be retrievedpublic SQLFunctionCall buildSRSTransformCall(MappedGeometryPropertyType geoProperty, java.lang.String targetSRS) throws DatastoreException
SQLFunctionCall
that refers to the given MappedGeometryPropertyType
in the specified
target SRS using a database specific SQL function.
geoProperty
- geometry propertytargetSRS
- target spatial reference system (usually "EPSG:XYZ")
SQLFunctionCall
that refers to the geometry in the specified srs
DatastoreException
public java.lang.String buildSRSTransformCall(java.lang.String geomIdentifier, int nativeSRSCode) throws DatastoreException
geomIdentifier
- nativeSRSCode
-
DatastoreException
public int getNativeSRSCode(java.lang.String srsName) throws DatastoreException
srsName
- spatial reference system name (usually "EPSG:XYZ")
DatastoreException
java.lang.String checkTransformation(MappedGeometryPropertyType pt, java.lang.String queriedSrs) throws DatastoreException
DatastoreException
is thrown to indicate the problem.
pt
- queriedSrs
-
DatastoreException
public void appendGeometryColumnGet(StatementBuffer query, java.lang.String tableAlias, java.lang.String column)
|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org