|
deegree 2.2 (2008/12/22 11:33 build-3038-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deegree.io.datastore.Datastore
org.deegree.io.datastore.sql.AbstractSQLDatastore
public abstract class AbstractSQLDatastore
This abstract class implements the common functionality of a Datastore
that is backed by an SQL database.
QueryHandler
Field Summary | |
---|---|
protected static ILogger |
LOG
|
protected DBConnectionPool |
pool
|
protected static int |
SRS_UNDEFINED
|
Constructor Summary | |
---|---|
AbstractSQLDatastore()
|
Method Summary | |
---|---|
protected Connection |
acquireConnection()
Returns the database connection requested for. |
DatastoreTransaction |
acquireTransaction()
Acquires transactional access to the datastore. |
SQLFunctionCall |
buildSRSTransformCall(MappedGeometryPropertyType geoProperty,
String targetSRS)
Returns an SQLFunctionCall that refers to the given MappedGeometryPropertyType in the specified
target SRS using a database specific SQL function. |
String |
buildSRSTransformCall(String geomIdentifier,
int nativeSRSCode)
Builds an SQL fragment that converts the given geometry to the specified SRS. |
(package private) String |
checkTransformation(MappedGeometryPropertyType pt,
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(Object value,
CoordinateSystem targetSRS,
Connection conn)
Converts a database specific geometry Object from the ResultSet to a deegree
Geometry . |
abstract Object |
convertDeegreeToDBGeometry(Geometry geometry,
int nativeSRSCode,
Connection conn)
Converts a deegree Geometry to a database specific geometry Object . |
Object |
convertFromDBType(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()
|
Set<FeatureId> |
determineFidsToLock(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(Connection conn,
String tableName,
String columnName)
Returns the maximum (integer) value stored in a certain table column. |
int |
getNativeSRSCode(String srsName)
Returns the database specific code for the given SRS name. |
Object |
getSequenceNextVal(Connection conn,
String sequence)
Overwrite this to enable the datastore to fetch the next value of a SQL sequence. |
WhereBuilder |
getWhereBuilder(MappedFeatureType[] rootFts,
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,
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). |
PreparedStatement |
prepareStatement(Connection conn,
StatementBuffer statementBuffer)
Converts the StatementBuffer into a PreparedStatement , which is initialized and
ready to be performed. |
void |
releaseConnection(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 ILogger LOG
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, 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, 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
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 Set<FeatureId> determineFidsToLock(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(Object value, CoordinateSystem targetSRS, Connection conn) throws SQLException
Object
from the ResultSet
to a deegree
Geometry
.
value
- targetSRS
- conn
-
SQLException
public abstract Object convertDeegreeToDBGeometry(Geometry geometry, int nativeSRSCode, Connection conn) throws DatastoreException
Geometry
to a database specific geometry Object
.
geometry
- nativeSRSCode
- conn
-
DatastoreException
protected Connection acquireConnection() throws DatastoreException
DatastoreException
public void releaseConnection(Connection conn) throws DatastoreException
conn
- connection to be released.
DatastoreException
public PreparedStatement prepareStatement(Connection conn, StatementBuffer statementBuffer) throws 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
SQLException
- if a JDBC related error occurs
DatastoreException
public Object convertFromDBType(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 Object getSequenceNextVal(Connection conn, String sequence) throws DatastoreException
conn
- JDBC connection to be used.sequence
- name of the SQL sequence.
DatastoreException
- if the value could not be retrievedpublic int getMaxValue(Connection conn, String tableName, 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, 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 String buildSRSTransformCall(String geomIdentifier, int nativeSRSCode) throws DatastoreException
geomIdentifier
- nativeSRSCode
-
DatastoreException
public int getNativeSRSCode(String srsName) throws DatastoreException
srsName
- spatial reference system name (usually "EPSG:XYZ")
DatastoreException
String checkTransformation(MappedGeometryPropertyType pt, String queriedSrs) throws DatastoreException
DatastoreException
is thrown to indicate the problem.
pt
- queriedSrs
-
DatastoreException
|
deegree 2.2 (2008/12/22 11:33 build-3038-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://deegree.sourceforge.net