org.geotools.jdbc
Class JDBCFeatureSource

Object
  extended by ContentFeatureSource
      extended by JDBCFeatureSource
All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>, SimpleFeatureSource
Direct Known Subclasses:
JoiningJDBCFeatureSource

public class JDBCFeatureSource
extends ContentFeatureSource


Field Summary
 
Fields inherited from class ContentFeatureSource
entry, hints, lock, query, queryCapabilities, schema, transaction
 
Constructor Summary
  JDBCFeatureSource(ContentEntry entry, Query query)
          Creates the new feature store.
protected JDBCFeatureSource(JDBCFeatureSource featureSource)
          Copy existing feature source
 
Method Summary
protected  void addHints(Set<Hints.Key> hints)
          Subclass hook too add additional hints.
protected  SimpleFeatureType buildFeatureType()
          Builds the feature type from database metadata.
protected  QueryCapabilities buildQueryCapabilities()
          Builds the query capabilities for this feature source.
protected  boolean canFilter()
          Determines if the datastore can natively perform a filtering.
protected  boolean canLimit()
          Determines if the datastore can natively limit the number of features returned in a query.
protected  boolean canOffset()
          Determines if the datastore can natively skip the first offset number of features returned in a query.
protected  boolean canRetype()
          Determines if the datasatore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributes If the subclass can handle retyping natively it should override this method to return true.
protected  boolean canSort()
          Determines if the datastore can natively perform sorting.
protected  boolean canTransact()
          Determines if the store can natively manage transactions.
protected  ReferencedEnvelope getBoundsInternal(Query query)
          Calculates the bounds of a specified query.
protected  int getCountInternal(Query query)
          Calculates the number of features of a specified query.
 JDBCDataStore getDataStore()
          Type narrow to JDBCDataStore.
 PrimaryKey getPrimaryKey()
          Returns the primary key of the table backed by feature store.
protected  FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query)
          Subclass method for returning a native reader from the datastore.
 JDBCState getState()
          Type narrow to JDBCState.
protected  boolean handleVisitor(Query query, FeatureVisitor visitor)
          Subclass method which allows subclasses to natively handle a visitor.
 boolean isExposePrimaryKeyColumns()
          The flag which will expose columns which compose a tables identifying or primary key, through feature type attributes.
 void setExposePrimaryKeyColumns(boolean exposePrimaryKeyColumns)
          Sets the flag which will expose columns which compose a tables identifying or primary key, through feature type attributes.
 
Methods inherited from class ContentFeatureSource
accepts, addFeatureListener, canEvent, canLock, canReproject, doLockInternal, doUnlockInternal, getAbsoluteSchema, getBounds, getBounds, getCount, getEntry, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getReader, getReader, getReader, getSchema, getSupportedHints, getTransaction, getView, getView, isView, joinQuery, lockFeatures, lockFeatures, lockFeatures, processLock, removeFeatureListener, resolvePropertyNames, resolvePropertyNames, setFeatureLock, setTransaction, unLockFeatures, unLockFeatures, unLockFeatures
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCFeatureSource

public JDBCFeatureSource(ContentEntry entry,
                         Query query)
                  throws IOException
Creates the new feature store.

Parameters:
entry - The datastore entry.
query - The defining query.
Throws:
IOException

JDBCFeatureSource

protected JDBCFeatureSource(JDBCFeatureSource featureSource)
                     throws IOException
Copy existing feature source

Parameters:
featureSource - jdbc feature source
Throws:
IOException
Method Detail

buildQueryCapabilities

protected QueryCapabilities buildQueryCapabilities()
Description copied from class: ContentFeatureSource
Builds the query capabilities for this feature source. The default implementation returns a newly built QueryCapabilities, subclasses are advised to build their own.

Overrides:
buildQueryCapabilities in class ContentFeatureSource
Returns:

addHints

protected void addHints(Set<Hints.Key> hints)
Description copied from class: ContentFeatureSource
Subclass hook too add additional hints.

By default, the followings are already present:

Overrides:
addHints in class ContentFeatureSource
Parameters:
hints - The set of hints supported by the feature source.

getDataStore

public JDBCDataStore getDataStore()
Type narrow to JDBCDataStore.

Specified by:
getDataStore in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Overrides:
getDataStore in class ContentFeatureSource
Returns:
the data source providing this FeatureSource

getState

public JDBCState getState()
Type narrow to JDBCState.

Overrides:
getState in class ContentFeatureSource
See Also:
#setTransaction(Transaction)}.

getPrimaryKey

public PrimaryKey getPrimaryKey()
Returns the primary key of the table backed by feature store.


setExposePrimaryKeyColumns

public void setExposePrimaryKeyColumns(boolean exposePrimaryKeyColumns)
Sets the flag which will expose columns which compose a tables identifying or primary key, through feature type attributes.

Note: setting this flag which affect all feature sources created from or working against the current transaction.


isExposePrimaryKeyColumns

public boolean isExposePrimaryKeyColumns()
The flag which will expose columns which compose a tables identifying or primary key, through feature type attributes.


buildFeatureType

protected SimpleFeatureType buildFeatureType()
                                      throws IOException
Builds the feature type from database metadata.

Specified by:
buildFeatureType in class ContentFeatureSource
Throws:
IOException

getCountInternal

protected int getCountInternal(Query query)
                        throws IOException
Description copied from class: ContentFeatureSource
Calculates the number of features of a specified query. Subclasses must implement this method.

Specified by:
getCountInternal in class ContentFeatureSource
Throws:
IOException

getBoundsInternal

protected ReferencedEnvelope getBoundsInternal(Query query)
                                        throws IOException
Description copied from class: ContentFeatureSource
Calculates the bounds of a specified query. Subclasses must implement this method.

Specified by:
getBoundsInternal in class ContentFeatureSource
Throws:
IOException

canFilter

protected boolean canFilter()
Description copied from class: ContentFeatureSource
Determines if the datastore can natively perform a filtering.

If the subclass can handle filtering natively it should override this method to return true. In this case it must do the filtering or throw an exception. This includes the case of partial native filtering where the datastore can only handle part of the filter natively. In these cases it is up to the subclass to apply a decorator to the reader it returns which will handle any part of the filter can was not applied natively. See FilteringFeatureReader.

Not overriding this method or returning false will cause the feature reader created by the subclass to be wrapped in a filtering feature reader when the query specifies a filter. See FilteringFeatureReader.

Overrides:
canFilter in class ContentFeatureSource

canSort

protected boolean canSort()
Description copied from class: ContentFeatureSource
Determines if the datastore can natively perform sorting.

If the subclass can handle retyping natively it should override this method to return true. In this case it must do the retyping or throw an exception.

Not overriding this method or returning false will cause an exception to be thrown when the query specifies sorting.

Overrides:
canSort in class ContentFeatureSource
See Also:
SortedFeatureReader

canRetype

protected boolean canRetype()
Description copied from class: ContentFeatureSource
Determines if the datasatore can natively perform "retyping" which includes limiting the number of attributes returned and reordering of those attributes

If the subclass can handle retyping natively it should override this method to return true. In this case it must do the retyping or throw an exception.

Not overriding this method or returning false will cause the feature reader created by the subclass to be wrapped in a retyping feature reader when the query specifies a retype.

Overrides:
canRetype in class ContentFeatureSource
See Also:
ReTypeFeatureReader

canLimit

protected boolean canLimit()
Description copied from class: ContentFeatureSource
Determines if the datastore can natively limit the number of features returned in a query.

If the subclass can handle a map feature cap natively then it should override this method to return true. In this case it must do the cap or throw an exception.

Not overriding this method or returning false will case the feature reader created by the subclass to be wrapped in a max feature capping decorator when the query specifies a max feature cap.

Overrides:
canLimit in class ContentFeatureSource
See Also:
MaxFeatureReader

canOffset

protected boolean canOffset()
Description copied from class: ContentFeatureSource
Determines if the datastore can natively skip the first offset number of features returned in a query.

If the subclass can handle a map feature cap natively then it should override this method to return true. In this case it must do the cap or throw an exception.

Not overriding this method or returning false will case the feature reader created by the subclass to be be accesset offset times before being returned to the caller.

Overrides:
canOffset in class ContentFeatureSource

canTransact

protected boolean canTransact()
Description copied from class: ContentFeatureSource
Determines if the store can natively manage transactions.

If a subclass can handle transactions natively it should override this method to return true and deal with transactions on its own, including firing feature modifications events.

Overrides:
canTransact in class ContentFeatureSource
Returns:
true if transaction independence has custom implementation

getReaderInternal

protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query)
                                                                    throws IOException
Description copied from class: ContentFeatureSource
Subclass method for returning a native reader from the datastore.

It is important to note that if the native reader intends to handle any of the following natively:

Then it *must* set the corresponding flags to true:

Specified by:
getReaderInternal in class ContentFeatureSource
Throws:
IOException

handleVisitor

protected boolean handleVisitor(Query query,
                                FeatureVisitor visitor)
                         throws IOException
Description copied from class: ContentFeatureSource
Subclass method which allows subclasses to natively handle a visitor.

Subclasses would override this method and return true in cases where the specific visitor could be handled without iterating over the entire result set of query. An example would be handling visitors that calculate aggregate values.

Overrides:
handleVisitor in class ContentFeatureSource
Parameters:
query - The query being made.
visitor - The visitor to
Returns:
true if the visitor can be handled natively, otherwise false.
Throws:
IOException


Copyright © 1996-2014 Geotools. All Rights Reserved.