deegree 2.3 (2010/04/09 10:10 build-4-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 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  Connection conn
           
protected  AbstractSQLDatastore datastore
           
protected static String FT_COLUMN
          Column used for disambiguation of feature properties that contain features that have more than one concrete type.
protected static 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, Connection conn)
          Creates a new instance of AbstractRequestHandler from the given parameters.
 
Method Summary
 void appendColumnsList(StatementBuffer query, String[] columns)
          Appends the specified columns as a comma-separated list to the given query.
protected  void appendFeatureIdColumns(MappedFeatureType featureType, 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, String tableAlias)
           
protected  void appendJoinCondition(TableRelation tableRelation, String fromAlias, String toAlias, StatementBuffer query)
           
protected  void appendJoins(TableRelation[] tableRelation, String fromAlias, String[] toAliases, StatementBuffer query)
           
 void appendQualifiedColumn(StatementBuffer query, String tableAlias, String column)
          Appends the specified column to the given query.
 void appendQualifiedColumnsList(StatementBuffer query, String tableAlias, String[] columns)
          Appends the specified columns as alias-qualified, comma-separated list to the given query.
 List<FeatureId> determineAffectedAndModifiableFIDs(MappedFeatureType ft, Filter filter, 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.
 List<FeatureId> determineAffectedFIDs(MappedFeatureType ft, Filter filter)
          Determines the feature ids that are matched by the given filter.
 Map<MappedFeaturePropertyType,List<FeatureId>> determineSubFeatures(FeatureId fid)
          Determines all complex properties and contained subfeature ids for a certain feature.
 Set<FeatureId> determineSuperFeatures(FeatureId fid)
          Determines all super features (as FeatureId instances) for a certain feature.
protected  FeatureId extractFeatureId(ResultSet rs, MappedFeatureType ft)
          Extracts the FeatureId in the current row of the given ResultSet.
protected  List<FeatureId> extractFeatureIds(ResultSet rs, MappedFeatureType ft)
          Extracts the feature ids in the given ResultSet as a List of FeatureIds.
protected  List<FeatureId> extractFeatureIdsForceUnique(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 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 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 Connection conn
Constructor Detail

AbstractRequestHandler

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

Parameters:
ds -
aliasGenerator -
conn -
Method Detail

determineAffectedFIDs

public 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 List<FeatureId> determineAffectedAndModifiableFIDs(MappedFeatureType ft,
                                                          Filter filter,
                                                          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 Map<MappedFeaturePropertyType,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 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,
                                      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(ResultSet rs,
                                     MappedFeatureType ft)
                              throws 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:
SQLException
DatastoreException

extractFeatureIdsForceUnique

protected List<FeatureId> extractFeatureIdsForceUnique(ResultSet rs,
                                                       MappedFeatureType ft)
                                                throws 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:
SQLException
DatastoreException

extractFeatureIds

protected List<FeatureId> extractFeatureIds(ResultSet rs,
                                            MappedFeatureType ft)
                                     throws 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:
SQLException
DatastoreException

appendJoins

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

appendJoinCondition

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

appendFeatureIdConstraint

protected void appendFeatureIdConstraint(StatementBuffer query,
                                         FeatureId fid)

appendFeatureIdConstraint

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

appendColumnsList

public void appendColumnsList(StatementBuffer query,
                              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,
                                       String tableAlias,
                                       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,
                                  String tableAlias,
                                  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.3 (2010/04/09 10:10 build-4-official)

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