org.geotools.arcsde.data
Class ArcSdeFeatureSource

Object
  extended by ArcSdeFeatureSource
All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>, SimpleFeatureSource
Direct Known Subclasses:
ArcSdeFeatureStore

public class ArcSdeFeatureSource
extends Object
implements SimpleFeatureSource


Field Summary
protected  ArcSDEDataStore dataStore
           
protected  Transaction transaction
           
protected  FeatureTypeInfo typeInfo
           
 
Constructor Summary
ArcSdeFeatureSource(FeatureTypeInfo typeInfo, ArcSDEDataStore dataStore)
           
 
Method Summary
 void addFeatureListener(FeatureListener listener)
          Registers a listening object that will be notified of changes to this FeatureSource.
 ReferencedEnvelope getBounds()
          Get the spatial bounds of the feature data.
 ReferencedEnvelope getBounds(Query query)
          Get the spatial bounds of the features that would be returned by the given Query.
protected  ReferencedEnvelope getBounds(Query namedQuery, ISession session)
           
 int getCount(Query query)
          Gets the number of the features that would be returned by the given Query, taking into account any settings for max features and start index set on the Query.
protected  int getCount(Query namedQuery, ISession session)
           
 ArcSDEDataStore getDataStore()
          Returns the data source, as a DataAccess object, providing this FeatureSource.
 FeatureReader<SimpleFeatureType,SimpleFeature> getfeatureReader(SimpleFeatureType targetSchema, Query query)
           
 SimpleFeatureCollection getFeatures()
          Retrieves all features in the form of a FeatureCollection.
 SimpleFeatureCollection getFeatures(Filter filter)
          Retrieves features, in the form of a FeatureCollection, based on an OGC Filter.
 SimpleFeatureCollection getFeatures(Query query)
          Retrieves features, in the form of a FeatureCollection, based on a Query.
 ArcSdeResourceInfo getInfo()
          Returns information describing this FeatureSource which may include title, description and spatial parameters.
 Name getName()
          Returns the same name than the feature type (ie, getSchema().getName() to honor the simple feature land common practice of calling the same both the Features produces and their types
 QueryCapabilities getQueryCapabilities()
          Enquire what what query capabilities this FeatureSource natively supports.
 SimpleFeatureType getSchema()
          Retrieves the schema (feature type) that will apply to features retrieved from this FeatureSource.
protected  ISession getSession()
          Returns a session appropriate for the current transaction This is convenient way to get a connection for getBounds() and getCount(Query).
 Set<RenderingHints.Key> getSupportedHints()
          ArcSDE features are always "detached", so we return the FEATURE_DETACHED hint here, as well as the JTS related ones.
 ArcSdeVersionHandler getVersionHandler()
           
 void removeFeatureListener(FeatureListener listener)
          Removes an object from this FeatureSource's listeners.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transaction

protected Transaction transaction

typeInfo

protected FeatureTypeInfo typeInfo

dataStore

protected ArcSDEDataStore dataStore
Constructor Detail

ArcSdeFeatureSource

public ArcSdeFeatureSource(FeatureTypeInfo typeInfo,
                           ArcSDEDataStore dataStore)
Method Detail

getName

public Name getName()
Returns the same name than the feature type (ie, getSchema().getName() to honor the simple feature land common practice of calling the same both the Features produces and their types

Specified by:
getName in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
the name of the features accessible through this FeatureSource
Since:
2.5
See Also:
FeatureSource.getName()

getInfo

public ArcSdeResourceInfo getInfo()
Description copied from interface: FeatureSource
Returns information describing this FeatureSource which may include title, description and spatial parameters. Note that in the returned ResourceInfo object, the distinction between feature name and schema (feature type) name applies as discussed for FeatureSource.getName().

Specified by:
getInfo in interface FeatureSource<SimpleFeatureType,SimpleFeature>
See Also:
FeatureSource.getInfo()

getQueryCapabilities

public QueryCapabilities getQueryCapabilities()
Description copied from interface: FeatureSource
Enquire what what query capabilities this FeatureSource natively supports. For example, whether queries can return sorted results.

Specified by:
getQueryCapabilities in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
the native query capabilities of this FeatureSource

addFeatureListener

public final void addFeatureListener(FeatureListener listener)
Description copied from interface: FeatureSource
Registers a listening object that will be notified of changes to this FeatureSource.

Specified by:
addFeatureListener in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
listener - the new listener
See Also:
FeatureSource.addFeatureListener(FeatureListener)

removeFeatureListener

public final void removeFeatureListener(FeatureListener listener)
Description copied from interface: FeatureSource
Removes an object from this FeatureSource's listeners.

Specified by:
removeFeatureListener in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
listener - the listener to remove
See Also:
FeatureSource.removeFeatureListener(FeatureListener)

getBounds

public final ReferencedEnvelope getBounds()
                                   throws IOException
Description copied from interface: FeatureSource
Get the spatial bounds of the feature data. This is equivalent to calling getBounds(Query.ALL).

It is possible that this method will return null if the calculation of bounds is judged to be too costly by the implementing class. In this case, you might call getFeatures().getBounds() instead.

Specified by:
getBounds in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
The bounding envelope of the feature data; or null if the bounds are unknown or too costly to calculate.
Throws:
IOException - on any errors calculating the bounds
See Also:
FeatureSource.getBounds()

getBounds

public final ReferencedEnvelope getBounds(Query query)
                                   throws IOException
Description copied from interface: FeatureSource
Get the spatial bounds of the features that would be returned by the given Query.

It is possible that this method will return null if the calculation of bounds is judged to be too costly by the implementing class. In this case, you might call getFeatures(query).getBounds() instead.

Specified by:
getBounds in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
query - the query to select features
Returns:
The bounding box of the query or null if unknown and too expensive for the method to calculate or any errors occur.
Throws:
IOException - on any errors calculating the bounds
See Also:
FeatureSource.getBounds(Query)

getBounds

protected ReferencedEnvelope getBounds(Query namedQuery,
                                       ISession session)
                                throws DataSourceException,
                                       IOException
Parameters:
namedQuery -
session -
Returns:
The bounding box of the query or null if unknown and too expensive for the method to calculate or any errors occur.
Throws:
DataSourceException
IOException

getCount

public final int getCount(Query query)
                   throws IOException
Description copied from interface: FeatureSource
Gets the number of the features that would be returned by the given Query, taking into account any settings for max features and start index set on the Query.

It is possible that this method will return -1 if the calculation of number of features is judged to be too costly by the implementing class. In this case, you might call getFeatures(query).size() instead.

Example use:

 int count = featureSource.getCount();
 if( count == -1 ){
    count = featureSource.getFeatures( "typeName", count ).size();
 }

Specified by:
getCount in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Parameters:
query - the query to select features
Returns:
the numer of features that would be returned by the Query; or -1 if this cannot be calculated.
Throws:
IOException - if there are errors getting the count
See Also:
FeatureSource.getCount(Query)

getCount

protected int getCount(Query namedQuery,
                       ISession session)
                throws IOException
Throws:
IOException
See Also:
FeatureSource.getCount(Query)

getSession

protected final ISession getSession()
                             throws IOException
Returns a session appropriate for the current transaction

This is convenient way to get a connection for getBounds() and getCount(Query). ArcSdeFeatureStore overrides to get the connection from the transaction instead of the pool.

Returns:
Throws:
IOException

getDataStore

public final ArcSDEDataStore getDataStore()
Description copied from interface: FeatureSource
Returns the data source, as a DataAccess object, providing this FeatureSource.

Specified by:
getDataStore in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
the data source providing this FeatureSource
See Also:
FeatureSource.getDataStore()

getFeatures

public final SimpleFeatureCollection getFeatures(Query query)
                                          throws IOException
Description copied from interface: FeatureSource
Retrieves features, in the form of a FeatureCollection, based on a Query.

Specified by:
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Specified by:
getFeatures in interface SimpleFeatureSource
Parameters:
query - DataAccess query for requested information, such as typeName, maxFeatures and filter.
Returns:
features retrieved by the Query
Throws:
IOException - if the underlying data source cannot be accessed.
See Also:
FeatureSource.getFeatures(Query)

getFeatures

public final SimpleFeatureCollection getFeatures(Filter filter)
                                          throws IOException
Description copied from interface: FeatureSource
Retrieves features, in the form of a FeatureCollection, based on an OGC Filter.

Specified by:
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Specified by:
getFeatures in interface SimpleFeatureSource
Parameters:
filter - the filter to select features; must not be null (use Filter.INCLUDE instead)
Returns:
features retrieved by the Filter
Throws:
IOException - if the underlying data source cannot be accessed.
See Also:
FeatureSource.getFeatures(Filter)

getFeatures

public final SimpleFeatureCollection getFeatures()
                                          throws IOException
Description copied from interface: FeatureSource
Retrieves all features in the form of a FeatureCollection.

The following statements are equivalent:


     featureSource.getFeatures();
     featureSource.getFeatures(Filter.INCLUDE);
     featureSource.getFeatures(Query.ALL);
 

Specified by:
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Specified by:
getFeatures in interface SimpleFeatureSource
Returns:
features retrieved by the Query
Throws:
IOException - if the underlying data source cannot be accessed.
See Also:
FeatureSource.getFeatures()

getSchema

public final SimpleFeatureType getSchema()
Description copied from interface: FeatureSource
Retrieves the schema (feature type) that will apply to features retrieved from this FeatureSource.

For a homogeneous data source such as a shapefile or a database table, this schema be that of all features. For a heterogeneous data source, e.g. a GML document, the schema returned is the lowest common denominator across all features.

Specified by:
getSchema in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
the schema that will apply to features retrieved from this FeatureSource
See Also:
FeatureSource.getSchema();

getSupportedHints

public final Set<RenderingHints.Key> getSupportedHints()
ArcSDE features are always "detached", so we return the FEATURE_DETACHED hint here, as well as the JTS related ones.

The JTS related hints supported are:

  • JTS_GEOMETRY_FACTORY
  • JTS_COORDINATE_SEQUENCE_FACTORY
  • JTS_PRECISION_MODEL
  • JTS_SRID
Note, however, that if a GeometryFactory is provided through the JTS_GEOMETRY_FACTORY hint, that very factory is used and takes precedence over all the other ones.

Specified by:
getSupportedHints in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Returns:
a set of RenderingHints#Key objects; may be empty but never null
See Also:
FeatureSource.getSupportedHints(), Hints.FEATURE_DETACHED, Hints.JTS_GEOMETRY_FACTORY, Hints.JTS_COORDINATE_SEQUENCE_FACTORY, Hints.JTS_PRECISION_MODEL, Hints.JTS_SRID

getVersionHandler

public ArcSdeVersionHandler getVersionHandler()
                                       throws IOException
Throws:
IOException

getfeatureReader

public FeatureReader<SimpleFeatureType,SimpleFeature> getfeatureReader(SimpleFeatureType targetSchema,
                                                                       Query query)
                                                                throws IOException
Throws:
IOException


Copyright © 1996-2014 Geotools. All Rights Reserved.