deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.io.datastore.sql
Class FeatureFetcher

java.lang.Object
  extended by org.deegree.io.datastore.sql.AbstractRequestHandler
      extended by org.deegree.io.datastore.sql.FeatureFetcher
Direct Known Subclasses:
QueryHandler

abstract class FeatureFetcher
extends AbstractRequestHandler

The only implementation of this abstract class is the QueryHandler class.

While the QueryHandler class performs the initial SELECT, FeatureFetcher is responsible for any subsequent SELECTs that may be necessary.

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  Map<FeatureId,Feature> featureMap
           
protected  Set<FeatureId> featuresInGeneration
           
protected  Map<FeatureId,List<FeatureProperty>> fidToPropertyMap
           
protected  Query query
           
protected  VirtualContentProvider vcProvider
           
 
Fields inherited from class org.deegree.io.datastore.sql.AbstractRequestHandler
aliasGenerator, conn, datastore, FT_COLUMN, FT_PREFIX
 
Constructor Summary
FeatureFetcher(AbstractSQLDatastore datastore, TableAliasGenerator aliasGenerator, Connection conn, Query query)
           
 
Method Summary
protected  void appendQualifiedContentList(StatementBuffer query, String tableAlias, List<List<SimpleContent>> fetchContents)
           
protected  Map<SimpleContent,Integer> buildResultPosMap(List<List<SimpleContent>> fetchContents)
          Builds a lookup map that allows to find the index (position in the ResultSet) by the SimpleContent instance that makes it necessary to fetch it.
protected  List<List<SimpleContent>> determineFetchContents(MappedFeatureType ft, PropertyType[] requestedProps)
          Determines the columns / functions that have to be fetched from the table of the given MappedFeatureType and associates identical columns / functions to avoid that the same column / function is SELECTed more than once.
protected  Feature extractFeature(FeatureId fid, Map<MappedPropertyType,Collection<PropertyPath>> requestedPropertyMap, Map<SimpleContent,Integer> resultPosMap, Object[] resultValues)
          Extracts a feature from the values of a result set row.
protected  FeatureId extractFeatureId(MappedFeatureType ft, Map<SimpleContent,Integer> mfMap, Object[] resultValues)
          Extracts the feature id from the values of a result set row.
 
Methods inherited from class org.deegree.io.datastore.sql.AbstractRequestHandler
appendColumnsList, appendFeatureIdColumns, appendFeatureIdConstraint, appendFeatureIdConstraint, appendJoinCondition, appendJoins, appendQualifiedColumn, appendQualifiedColumnsList, determineAffectedAndModifiableFIDs, determineAffectedFIDs, determineSubFeatures, determineSuperFeatures, extractFeatureId, extractFeatureIds, extractFeatureIdsForceUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

featuresInGeneration

protected Set<FeatureId> featuresInGeneration

featureMap

protected Map<FeatureId,Feature> featureMap

fidToPropertyMap

protected Map<FeatureId,List<FeatureProperty>> fidToPropertyMap

vcProvider

protected VirtualContentProvider vcProvider

query

protected Query query
Constructor Detail

FeatureFetcher

FeatureFetcher(AbstractSQLDatastore datastore,
               TableAliasGenerator aliasGenerator,
               Connection conn,
               Query query)
         throws DatastoreException
Throws:
DatastoreException
Method Detail

extractFeature

protected Feature extractFeature(FeatureId fid,
                                 Map<MappedPropertyType,Collection<PropertyPath>> requestedPropertyMap,
                                 Map<SimpleContent,Integer> resultPosMap,
                                 Object[] resultValues)
                          throws SQLException,
                                 DatastoreException,
                                 UnknownCRSException
Extracts a feature from the values of a result set row.

Parameters:
fid - feature id of the feature
requestedPropertyMap - requested MappedPropertyTypes mapped to Collection of PropertyPaths
resultPosMap - key class: MappingField, value class: Integer (this is the associated index in resultValues)
resultValues - all retrieved columns from one result set row
Returns:
the extracted feature
Throws:
SQLException - if a JDBC related error occurs
DatastoreException
UnknownCRSException

extractFeatureId

protected FeatureId extractFeatureId(MappedFeatureType ft,
                                     Map<SimpleContent,Integer> mfMap,
                                     Object[] resultValues)
                              throws DatastoreException
Extracts the feature id from the values of a result set row.

Parameters:
ft - feature type for which the id shall be extracted
mfMap - key class: MappingField, value class: Integer (this is the associated index in resultValues)
resultValues - all retrieved columns from one result set row
Returns:
the feature id
Throws:
DatastoreException

determineFetchContents

protected List<List<SimpleContent>> determineFetchContents(MappedFeatureType ft,
                                                           PropertyType[] requestedProps)
                                                    throws DatastoreException
Determines the columns / functions that have to be fetched from the table of the given MappedFeatureType and associates identical columns / functions to avoid that the same column / function is SELECTed more than once.

Identical columns are put into the same (inner) list.

The following SimpleContent instances of the MappedFeatureTypes annotation are used to build the list:

Parameters:
ft - feature type for which the content list is built
requestedProps - requested properties
Returns:
List of Lists (that contains SimpleContent instance that refer the same column)
Throws:
DatastoreException

appendQualifiedContentList

protected void appendQualifiedContentList(StatementBuffer query,
                                          String tableAlias,
                                          List<List<SimpleContent>> fetchContents)

buildResultPosMap

protected Map<SimpleContent,Integer> buildResultPosMap(List<List<SimpleContent>> fetchContents)
Builds a lookup map that allows to find the index (position in the ResultSet) by the SimpleContent instance that makes it necessary to fetch it.

Parameters:
fetchContents -
Returns:
key: SimpleContent, value: Integer (position in ResultSet)

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