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

org.deegree.io.datastore.sql
Class AbstractRequestHandler

java.lang.Object
  extended by org.deegree.io.datastore.sql.AbstractRequestHandler
Direct Known Subclasses:
DeleteHandler, FeatureFetcher, InsertHandler, LockHandler, SQLTransaction, UpdateHandler

public class AbstractRequestHandler
extends java.lang.Object

This abstract class implements some common SQL functionality needed by request handlers for SQL based datastores.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
Author:
Markus Schneider , last edited by: $Author: mschneider $
See Also:
QueryHandler

Field Summary
protected  TableAliasGenerator aliasGenerator
           
protected  java.sql.Connection conn
           
protected  AbstractSQLDatastore datastore
           
protected static java.lang.String FT_COLUMN
          Column used for disambiguation of feature properties that contain features that have more than one concrete type.
protected static java.lang.String FT_PREFIX
          Column prefix used for disambiguation of feature properties that contain features that have more than one concrete type.
 
Constructor Summary
AbstractRequestHandler(AbstractSQLDatastore ds, TableAliasGenerator aliasGenerator, java.sql.Connection conn)
          Creates a new instance of AbstractRequestHandler from the given parameters.
 
Method Summary
 void appendColumnsList(StatementBuffer query, java.lang.String[] columns)
          Appends the specified columns as a comma-separated list to the given query.
protected  void appendFeatureIdColumns(MappedFeatureType featureType, java.lang.String tableAlias, StatementBuffer query)
          Appends the alias qualified columns that make up the feature id to the given query.
protected  void appendFeatureIdConstraint(StatementBuffer query, FeatureId fid)
           
protected  void appendFeatureIdConstraint(StatementBuffer query, FeatureId fid, java.lang.String tableAlias)
           
protected  void appendJoinCondition(TableRelation tableRelation, java.lang.String fromAlias, java.lang.String toAlias, StatementBuffer query)
           
protected  void appendJoins(TableRelation[] tableRelation, java.lang.String fromAlias, java.lang.String[] toAliases, StatementBuffer query)
           
 void appendQualifiedColumn(StatementBuffer query, java.lang.String tableAlias, java.lang.String column)
          Appends the specified column to the given query.
 void appendQualifiedColumnsList(StatementBuffer query, java.lang.String tableAlias, java.lang.String[] columns)
          Appends the specified columns as alias-qualified, comma-separated list to the given query.
 java.util.List<FeatureId> determineAffectedAndModifiableFIDs(MappedFeatureType ft, Filter filter, java.lang.String lockId)
          Determines the feature ids that are matched by the given filter and that are either not locked or locked by the specified lockId.
 java.util.List<FeatureId> determineAffectedFIDs(MappedFeatureType ft, Filter filter)
          Determines the feature ids that are matched by the given filter.
 java.util.Map<MappedFeaturePropertyType,java.util.List<FeatureId>> determineSubFeatures(FeatureId fid)
          Determines all complex properties and contained subfeature ids for a certain feature.
 java.util.Set<FeatureId> determineSuperFeatures(FeatureId fid)
          Determines all super features (as FeatureId instances) for a certain feature.
protected  FeatureId extractFeatureId(java.sql.ResultSet rs, MappedFeatureType ft)
          Extracts the FeatureId in the current row of the given ResultSet.
protected  java.util.List<FeatureId> extractFeatureIds(java.sql.ResultSet rs, MappedFeatureType ft)
          Extracts the feature ids in the given ResultSet as a List of FeatureIds.
protected  java.util.List<FeatureId> extractFeatureIdsForceUnique(java.sql.ResultSet rs, MappedFeatureType ft)
          Extracts the feature ids in the given ResultSet as a List of FeatureIds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FT_COLUMN

protected static final java.lang.String FT_COLUMN
Column used for disambiguation of feature properties that contain features that have more than one concrete type.

See Also:
Constant Field Values

FT_PREFIX

protected static final java.lang.String FT_PREFIX
Column prefix used for disambiguation of feature properties that contain features that have more than one concrete type.

See Also:
Constant Field Values

datastore

protected AbstractSQLDatastore datastore

aliasGenerator

protected TableAliasGenerator aliasGenerator

conn

protected java.sql.Connection conn
Constructor Detail

AbstractRequestHandler

public AbstractRequestHandler(AbstractSQLDatastore ds,
                              TableAliasGenerator aliasGenerator,
                              java.sql.Connection conn)
Creates a new instance of AbstractRequestHandler from the given parameters.

Parameters:
ds -
aliasGenerator -
conn -
Method Detail

determineAffectedFIDs

public java.util.List<FeatureId> determineAffectedFIDs(MappedFeatureType ft,
                                                       Filter filter)
                                                throws DatastoreException
Determines the feature ids that are matched by the given filter.

Parameters:
ft - non-abstract feature type
filter - constraints the feature instances
Returns:
the feature ids that are matched by the given filter
Throws:
DatastoreException

determineAffectedAndModifiableFIDs

public java.util.List<FeatureId> determineAffectedAndModifiableFIDs(MappedFeatureType ft,
                                                                    Filter filter,
                                                                    java.lang.String lockId)
                                                             throws DatastoreException
Determines the feature ids that are matched by the given filter and that are either not locked or locked by the specified lockId.

Parameters:
ft - non-abstract feature type
filter - constraints the feature instances
lockId - optional id of associated lock (may be null)
Returns:
the feature ids that are matched by the given filter
Throws:
DatastoreException

determineSubFeatures

public java.util.Map<MappedFeaturePropertyType,java.util.List<FeatureId>> determineSubFeatures(FeatureId fid)
                                                                                        throws DatastoreException
Determines all complex properties and contained subfeature ids for a certain feature.

Parameters:
fid - id of the feature
Returns:
all complex properties and contained subfeature ids of the feature
Throws:
DatastoreException

determineSuperFeatures

public java.util.Set<FeatureId> determineSuperFeatures(FeatureId fid)
                                                throws DatastoreException
Determines all super features (as FeatureId instances) for a certain feature.

Parameters:
fid - id of the feature
Returns:
all super feature ids of the feature
Throws:
DatastoreException

appendFeatureIdColumns

protected void appendFeatureIdColumns(MappedFeatureType featureType,
                                      java.lang.String tableAlias,
                                      StatementBuffer query)
Appends the alias qualified columns that make up the feature id to the given query.

Parameters:
featureType -
tableAlias -
query -

extractFeatureId

protected FeatureId extractFeatureId(java.sql.ResultSet rs,
                                     MappedFeatureType ft)
                              throws java.sql.SQLException,
                                     DatastoreException
Extracts the FeatureId in the current row of the given ResultSet.

Parameters:
rs -
ft - feature type (may not be abstract)
Returns:
feature ids
Throws:
java.sql.SQLException
DatastoreException

extractFeatureIdsForceUnique

protected java.util.List<FeatureId> extractFeatureIdsForceUnique(java.sql.ResultSet rs,
                                                                 MappedFeatureType ft)
                                                          throws java.sql.SQLException,
                                                                 DatastoreException
Extracts the feature ids in the given ResultSet as a List of FeatureIds.

If the given feature type is abstract, it is expected that the first column of the result set contains the local name of the feature type.

Parameters:
rs -
ft - feature type
Returns:
feature ids
Throws:
java.sql.SQLException
DatastoreException

extractFeatureIds

protected java.util.List<FeatureId> extractFeatureIds(java.sql.ResultSet rs,
                                                      MappedFeatureType ft)
                                               throws java.sql.SQLException,
                                                      DatastoreException
Extracts the feature ids in the given ResultSet as a List of FeatureIds.

If the given feature type is abstract, it is expected that the first column of the result set contains the local name of the feature type.

Parameters:
rs -
ft - feature type (may be abstract)
Returns:
feature ids
Throws:
java.sql.SQLException
DatastoreException

appendJoins

protected void appendJoins(TableRelation[] tableRelation,
                           java.lang.String fromAlias,
                           java.lang.String[] toAliases,
                           StatementBuffer query)

appendJoinCondition

protected void appendJoinCondition(TableRelation tableRelation,
                                   java.lang.String fromAlias,
                                   java.lang.String toAlias,
                                   StatementBuffer query)

appendFeatureIdConstraint

protected void appendFeatureIdConstraint(StatementBuffer query,
                                         FeatureId fid)

appendFeatureIdConstraint

protected void appendFeatureIdConstraint(StatementBuffer query,
                                         FeatureId fid,
                                         java.lang.String tableAlias)

appendColumnsList

public void appendColumnsList(StatementBuffer query,
                              java.lang.String[] columns)
Appends the specified columns as a comma-separated list to the given query.

Parameters:
query - StatementBuffer that the list is appended to
columns - array of column names

appendQualifiedColumnsList

public void appendQualifiedColumnsList(StatementBuffer query,
                                       java.lang.String tableAlias,
                                       java.lang.String[] columns)
Appends the specified columns as alias-qualified, comma-separated list to the given query.

Parameters:
query - StatementBuffer that the list is appended to
tableAlias - alias to use as qualifier (alias.field)
columns - array of column names

appendQualifiedColumn

public void appendQualifiedColumn(StatementBuffer query,
                                  java.lang.String tableAlias,
                                  java.lang.String column)
Appends the specified column to the given query.

Parameters:
query - StatementBuffer that the list is appended to
tableAlias - alias to use as qualifier (alias.field)
column - column name

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