deegree 2.5 (2011/06/29 09:44 build-8-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: 23693 $, $Date: 2010-04-20 14:33:55 +0200 (Di, 20 Apr 2010) $
Author:
Markus Schneider, last edited by: $Author: hrubach $
See Also:
QueryHandler

Field Summary
protected  java.util.Map<FeatureId,Feature> featureMap
           
protected  java.util.Set<FeatureId> featuresInGeneration
           
protected  java.util.Map<FeatureId,java.util.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, java.sql.Connection conn, Query query)
           
 
Method Summary
protected  void appendQualifiedContentList(StatementBuffer query, java.lang.String tableAlias, java.util.List<java.util.List<SimpleContent>> fetchContents)
           
protected  java.util.Map<SimpleContent,java.lang.Integer> buildResultPosMap(java.util.List<java.util.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  java.util.List<java.util.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, java.util.Map<MappedPropertyType,java.util.Collection<PropertyPath>> requestedPropertyMap, java.util.Map<SimpleContent,java.lang.Integer> resultPosMap, java.lang.Object[] resultValues)
          Extracts a feature from the values of a result set row.
protected  FeatureId extractFeatureId(MappedFeatureType ft, java.util.Map<SimpleContent,java.lang.Integer> mfMap, java.lang.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 java.util.Set<FeatureId> featuresInGeneration

featureMap

protected java.util.Map<FeatureId,Feature> featureMap

fidToPropertyMap

protected java.util.Map<FeatureId,java.util.List<FeatureProperty>> fidToPropertyMap

vcProvider

protected VirtualContentProvider vcProvider

query

protected Query query
Constructor Detail

FeatureFetcher

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

extractFeature

protected Feature extractFeature(FeatureId fid,
                                 java.util.Map<MappedPropertyType,java.util.Collection<PropertyPath>> requestedPropertyMap,
                                 java.util.Map<SimpleContent,java.lang.Integer> resultPosMap,
                                 java.lang.Object[] resultValues)
                          throws java.sql.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:
java.sql.SQLException - if a JDBC related error occurs
DatastoreException
UnknownCRSException

extractFeatureId

protected FeatureId extractFeatureId(MappedFeatureType ft,
                                     java.util.Map<SimpleContent,java.lang.Integer> mfMap,
                                     java.lang.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 java.util.List<java.util.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,
                                          java.lang.String tableAlias,
                                          java.util.List<java.util.List<SimpleContent>> fetchContents)

buildResultPosMap

protected java.util.Map<SimpleContent,java.lang.Integer> buildResultPosMap(java.util.List<java.util.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.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