org.geotools.data.complex
Class AbstractMappingFeatureIterator

java.lang.Object
  extended by org.geotools.data.complex.AbstractMappingFeatureIterator
All Implemented Interfaces:
java.util.Iterator<org.opengis.feature.Feature>, IMappingFeatureIterator, FeatureIterator<org.opengis.feature.Feature>
Direct Known Subclasses:
DataAccessMappingFeatureIterator, XmlMappingFeatureIterator

public abstract class AbstractMappingFeatureIterator
extends java.lang.Object
implements IMappingFeatureIterator

Base class for several MappingFeatureImplementation's.

Version:
$Id: AbstractMappingFeatureIterator.java 35836 2010-07-05 07:49:35Z ang05a $
Author:
Russell Petty, GSV

Field Summary
protected  org.opengis.feature.FeatureFactory attf
          Factory used to create the target feature and attributes
protected  int featureCounter
          counter to ensure maxFeatures is not exceeded
protected  org.opengis.filter.expression.Expression featureFidMapping
          Expression to evaluate the feature id
protected static java.util.logging.Logger LOGGER
          The logger for the filter module.
protected  FeatureTypeMapping mapping
          The mappings for the source and target schemas
protected  int maxFeatures
          maxFeatures restriction value as provided by query
protected  org.opengis.filter.FilterFactory namespaceAwareFilterFactory
           
protected  org.xml.sax.helpers.NamespaceSupport namespaces
           
protected  AppSchemaDataAccess store
           
static org.opengis.feature.type.Name XLINK_HREF_NAME
          Name representation of xlink:href
protected  XPath xpathAttributeBuilder
           
 
Constructor Summary
AbstractMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query)
           
AbstractMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isQueryUnrolled)
           
 
Method Summary
 void close()
          Closes the underlying FeatureIterator
protected abstract  void closeSourceFeatures()
           
protected  org.opengis.feature.Feature computeNext()
           
protected abstract  java.lang.String extractIdForAttribute(org.opengis.filter.expression.Expression idExpression, java.lang.Object sourceInstance)
          Based on the set of xpath expression/id extracting expression, finds the ID for the attribute idExpression from the source complex attribute.
protected abstract  java.lang.String extractIdForFeature()
           
protected abstract  java.util.Iterator<org.opengis.feature.Feature> getSourceFeatureIterator()
           
protected  Query getUnrolledQuery(Query query)
          Return a query appropriate to its underlying feature source.
protected abstract  java.lang.Object getValue(org.opengis.filter.expression.Expression expression, java.lang.Object sourceFeature)
           
 boolean hasNext()
          Return true if there are more features.
protected abstract  void initialiseSourceFeatures(FeatureTypeMapping mapping, Query query)
           
protected  boolean isHasNextCalled()
           
protected abstract  boolean isNextSourceFeatureNull()
           
protected abstract  boolean isSourceFeatureIteratorNull()
           
 org.opengis.feature.Feature next()
          Return next feature.
protected abstract  org.opengis.feature.Feature populateFeatureData(java.lang.String id)
           
 void remove()
          Shall not be called, just throws an UnsupportedOperationException
protected abstract  void setClientProperties(org.opengis.feature.Attribute target, java.lang.Object source, java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientProperties)
           
protected  void setGeometry(org.opengis.feature.Feature feature)
          Set the feature geometry to that of the first property bound to a JTS geometry
protected  void setHasNextCalled(boolean hasNextCalled)
           
protected abstract  boolean sourceFeatureIteratorHasNext()
           
protected abstract  boolean unprocessedFeatureExists()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final java.util.logging.Logger LOGGER
The logger for the filter module.


XLINK_HREF_NAME

public static final org.opengis.feature.type.Name XLINK_HREF_NAME
Name representation of xlink:href


mapping

protected FeatureTypeMapping mapping
The mappings for the source and target schemas


featureFidMapping

protected org.opengis.filter.expression.Expression featureFidMapping
Expression to evaluate the feature id


attf

protected org.opengis.feature.FeatureFactory attf
Factory used to create the target feature and attributes


store

protected AppSchemaDataAccess store

xpathAttributeBuilder

protected final XPath xpathAttributeBuilder

namespaceAwareFilterFactory

protected org.opengis.filter.FilterFactory namespaceAwareFilterFactory

maxFeatures

protected final int maxFeatures
maxFeatures restriction value as provided by query


featureCounter

protected int featureCounter
counter to ensure maxFeatures is not exceeded


namespaces

protected org.xml.sax.helpers.NamespaceSupport namespaces
Constructor Detail

AbstractMappingFeatureIterator

public AbstractMappingFeatureIterator(AppSchemaDataAccess store,
                                      FeatureTypeMapping mapping,
                                      Query query)
                               throws java.io.IOException
Throws:
java.io.IOException

AbstractMappingFeatureIterator

public AbstractMappingFeatureIterator(AppSchemaDataAccess store,
                                      FeatureTypeMapping mapping,
                                      Query query,
                                      boolean isQueryUnrolled)
                               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

remove

public void remove()
Shall not be called, just throws an UnsupportedOperationException

Specified by:
remove in interface java.util.Iterator<org.opengis.feature.Feature>

close

public void close()
Closes the underlying FeatureIterator

Specified by:
close in interface FeatureIterator<org.opengis.feature.Feature>

extractIdForAttribute

protected abstract java.lang.String extractIdForAttribute(org.opengis.filter.expression.Expression idExpression,
                                                          java.lang.Object sourceInstance)
Based on the set of xpath expression/id extracting expression, finds the ID for the attribute idExpression from the source complex attribute.

Parameters:
idExpression - the location path of the attribute to be created, for which to obtain the id by evaluating the corresponding org.geotools.filter.Expression from sourceInstance.
sourceInstance - a complex attribute which is the source of the mapping.
Returns:
the ID to be applied to a new attribute instance addressed by attributeXPath, or null if there is no an id mapping for that attribute.

next

public org.opengis.feature.Feature next()
Return next feature.

Specified by:
next in interface java.util.Iterator<org.opengis.feature.Feature>
Specified by:
next in interface FeatureIterator<org.opengis.feature.Feature>
Returns:
The next Feature
See Also:
Iterator.next()

hasNext

public boolean hasNext()
Return true if there are more features.

Specified by:
hasNext in interface java.util.Iterator<org.opengis.feature.Feature>
Specified by:
hasNext in interface FeatureIterator<org.opengis.feature.Feature>
Returns:
true if more Features exist, false otherwise.
See Also:
Iterator.hasNext()

getUnrolledQuery

protected Query getUnrolledQuery(Query query)
Return a query appropriate to its underlying feature source.

Parameters:
query - the original query against the output schema
Returns:
a query appropriate to be executed over the underlying feature source.

computeNext

protected org.opengis.feature.Feature computeNext()
                                           throws java.io.IOException
Throws:
java.io.IOException

setGeometry

protected void setGeometry(org.opengis.feature.Feature feature)
Set the feature geometry to that of the first property bound to a JTS geometry

Parameters:
feature -

isHasNextCalled

protected boolean isHasNextCalled()

setHasNextCalled

protected void setHasNextCalled(boolean hasNextCalled)

closeSourceFeatures

protected abstract void closeSourceFeatures()

getSourceFeatureIterator

protected abstract java.util.Iterator<org.opengis.feature.Feature> getSourceFeatureIterator()

initialiseSourceFeatures

protected abstract void initialiseSourceFeatures(FeatureTypeMapping mapping,
                                                 Query query)
                                          throws java.io.IOException
Throws:
java.io.IOException

unprocessedFeatureExists

protected abstract boolean unprocessedFeatureExists()

sourceFeatureIteratorHasNext

protected abstract boolean sourceFeatureIteratorHasNext()

extractIdForFeature

protected abstract java.lang.String extractIdForFeature()

isNextSourceFeatureNull

protected abstract boolean isNextSourceFeatureNull()

populateFeatureData

protected abstract org.opengis.feature.Feature populateFeatureData(java.lang.String id)
                                                            throws java.io.IOException
Throws:
java.io.IOException

getValue

protected abstract java.lang.Object getValue(org.opengis.filter.expression.Expression expression,
                                             java.lang.Object sourceFeature)

isSourceFeatureIteratorNull

protected abstract boolean isSourceFeatureIteratorNull()

setClientProperties

protected abstract void setClientProperties(org.opengis.feature.Attribute target,
                                            java.lang.Object source,
                                            java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientProperties)


Copyright © 1996-2010 Geotools. All Rights Reserved.