public final class JDBCFeatureStore extends ContentFeatureStore
All read only methods are delegated to JDBCFeatureSource.
FeatureLocking.Response| Modifier and Type | Field and Description |
|---|---|
JDBCFeatureSource |
delegate
jdbc feature source to delegate to, we do this b/c we can't inherit from both
ContentFeatureStore and JDBCFeatureSource at the same time
|
ORIGINAL_FEATURE_KEY, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATEentry, hints, lock, query, queryCapabilities, schema, transaction| Constructor and Description |
|---|
JDBCFeatureStore(ContentEntry entry,
Query query)
Creates the new feature store.
|
| Modifier and Type | Method and Description |
|---|---|
protected SimpleFeatureType |
buildFeatureType()
Creates the feature type or schema for the feature source.
|
protected boolean |
canEvent()
We handle events internally
|
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()
The datastore that this feature source originated from.
|
ContentEntry |
getEntry()
The entry for the feature source.
|
JDBCFeatureSource |
getFeatureSource() |
ResourceInfo |
getInfo()
A default ResourceInfo with a generic description.
|
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 |
PrimaryKey |
getPrimaryKey() |
QueryCapabilities |
getQueryCapabilities()
SimpleFeatureCollection optimized for read-only access.
|
protected FeatureReader<SimpleFeatureType,SimpleFeature> |
getReaderInternal(Query query)
Subclass method for returning a native reader from the datastore.
|
JDBCState |
getState()
The current state for the feature source.
|
Transaction |
getTransaction()
The current transaction the feature source is working against.
|
protected FeatureWriter<SimpleFeatureType,SimpleFeature> |
getWriterInternal(Query query,
int flags)
Subclass method for returning a native writer from the datastore.
|
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 |
modifyFeatures(Name[] names,
Object[] values,
Filter filter)
Modifies/updates the features of the store which match the specified filter.
|
void |
removeFeatures(Filter filter)
Removes the features from the store which match the specified filter.
|
void |
setExposePrimaryKeyColumns(boolean exposePrimaryKeyColumns)
Sets the flag which will expose columns which compose a tables identifying or primary key,
through feature type attributes.
|
void |
setTransaction(Transaction transaction)
Sets the current transaction the feature source is working against.
|
addFeatures, addFeatures, getWriter, getWriter, getWriter, getWriter, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, setFeaturesaccepts, addFeatureListener, addHints, buildQueryCapabilities, canLock, canReproject, doLockInternal, doUnlockInternal, getAbsoluteSchema, getBounds, getBounds, getCount, getFeatures, getFeatures, getFeatures, getReader, getReader, getReader, getSchema, getSupportedHints, getView, getView, isView, joinQuery, lockFeatures, lockFeatures, lockFeatures, processLock, removeFeatureListener, resolvePropertyNames, resolvePropertyNames, setFeatureLock, unLockFeatures, unLockFeatures, unLockFeaturesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFeatures, getFeatures, getFeatureslockFeatures, lockFeatures, lockFeatures, setFeatureLock, unLockFeatures, unLockFeatures, unLockFeaturesaddFeatureListener, getBounds, getBounds, getCount, getSchema, getSupportedHints, removeFeatureListenerpublic JDBCFeatureSource delegate
public JDBCFeatureStore(ContentEntry entry, Query query) throws IOException
entry - The datastore entry.query - The defining query.IOExceptionprotected boolean canEvent()
canEvent in class ContentFeatureSourcepublic JDBCDataStore getDataStore()
ContentFeatureSourceSubclasses may wish to extend this method in order to type narrow its return type.
getDataStore in interface FeatureSource<SimpleFeatureType,SimpleFeature>getDataStore in class ContentFeatureSourceFeatureSourcepublic JDBCFeatureSource getFeatureSource()
public ContentEntry getEntry()
ContentFeatureSourcegetEntry in class ContentFeatureSourcepublic ResourceInfo getInfo()
ContentFeatureSourceSubclasses should override to provide an explicit ResourceInfo object for their content.
getInfo in interface FeatureSource<SimpleFeatureType,SimpleFeature>getInfo in class ContentFeatureSourcepublic Name getName()
ContentFeatureSourcegetSchema().getName() to honor the
simple feature land common practice of calling the same both the Features produces and their
typesgetName in interface FeatureSource<SimpleFeatureType,SimpleFeature>getName in class ContentFeatureSourceFeatureSourceFeatureSource.getName()public QueryCapabilities getQueryCapabilities()
ContentFeatureSourceAvailable via getView( filter ):
In particular this method of data access is intended for rendering and other high speed operations; care should be taken to optimize the use of FeatureVisitor.
getQueryCapabilities in interface FeatureSource<SimpleFeatureType,SimpleFeature>getQueryCapabilities in class ContentFeatureSourcepublic JDBCState getState()
ContentFeatureSourceThis value is derived from current transaction of the feature source.
getState in class ContentFeatureSource#setTransaction(Transaction)}.public Transaction getTransaction()
ContentFeatureSourceThis transaction is used to derive the state for the feature source. A null
value for a transaction represents the auto commit transaction: Transaction.AUTO_COMMIT.
getTransaction in interface FeatureStore<SimpleFeatureType,SimpleFeature>getTransaction in class ContentFeatureSource#getState()}.public void setTransaction(Transaction transaction)
ContentFeatureSourcetransaction may be null. This signifies that the auto-commit
transaction is used: Transaction.AUTO_COMMIT.
setTransaction in interface FeatureStore<SimpleFeatureType,SimpleFeature>setTransaction in class ContentFeatureSourcetransaction - The new transaction, or null.public PrimaryKey getPrimaryKey()
public void setExposePrimaryKeyColumns(boolean exposePrimaryKeyColumns)
Note: setting this flag which affect all feature sources created from or working against the current transaction.
public boolean isExposePrimaryKeyColumns()
protected SimpleFeatureType buildFeatureType() throws IOException
ContentFeatureSourceImplementations should use SimpleFeatureTypeBuilder to build the feature type.
Also, the builder should be injected with the feature factory which has been set on the
DataStore (see ContentDataStore.getFeatureFactory(). Example:
SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setFeatureTypeFactory( getDataStore().getFeatureTypeFactory() ); //build the feature type ...
buildFeatureType in class ContentFeatureSourceIOExceptionprotected int getCountInternal(Query query) throws IOException
ContentFeatureSourcegetCountInternal in class ContentFeatureSourceIOExceptionprotected ReferencedEnvelope getBoundsInternal(Query query) throws IOException
ContentFeatureSourcegetBoundsInternal in class ContentFeatureSourceIOExceptionprotected boolean canFilter()
ContentFeatureSourceIf 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.
canFilter in class ContentFeatureSourceprotected boolean canSort()
ContentFeatureSourceIf 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.
canSort in class ContentFeatureSourceSortedFeatureReaderprotected boolean canRetype()
ContentFeatureSourceIf 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.
canRetype in class ContentFeatureSourceReTypeFeatureReaderprotected boolean canLimit()
ContentFeatureSourceIf 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.
canLimit in class ContentFeatureSourceMaxFeatureReaderprotected boolean canOffset()
ContentFeatureSourceoffset 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.
canOffset in class ContentFeatureSourceprotected boolean canTransact()
ContentFeatureSourceIf 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.
canTransact in class ContentFeatureSourceprotected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) throws IOException
ContentFeatureSourceIt is important to note that if the native reader intends to handle any of the following natively:
true:
ContentFeatureSource.canReproject() - handles Query.getCoordinateSystemReproject() internally.
Example would be PostGIS using Proj to handle reproejction internallyContentFeatureSource.canFilter() - handles Query#getFilter() internally.getReaderInternal in class ContentFeatureSourceIOExceptionprotected boolean handleVisitor(Query query, FeatureVisitor visitor) throws IOException
ContentFeatureSourceSubclasses 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.
handleVisitor in class ContentFeatureSourcequery - The query being made.visitor - The visitor toIOExceptionprotected FeatureWriter<SimpleFeatureType,SimpleFeature> getWriterInternal(Query query, int flags) throws IOException
ContentFeatureStoreIt is important to note that if the native writer intends to handle any of the following natively:
true:
getWriterInternal in class ContentFeatureStorequery - Queryflags - See ContentFeatureStore.WRITER_ADD and ContentFeatureStore.WRITER_UPDATEIOExceptionpublic void modifyFeatures(Name[] names, Object[] values, Filter filter) throws IOException
ContentFeatureStoreThis method operates by obtaining an updating feature writer based on the specified filter and writing the updated values to it.
The filter must not be null, in this case this method will throw an
IllegalArgumentException.
modifyFeatures in interface FeatureStore<SimpleFeatureType,SimpleFeature>modifyFeatures in class ContentFeatureStorenames - the attributes to modifyvalues - the new values for the attributesfilter - an OpenGIS filterIOException - if the attribute and object arrays are not equal in length; if the value
types do not match the attribute types; if modification is not supported; or if there
errors accessing the data sourcepublic void removeFeatures(Filter filter) throws IOException
ContentFeatureStoreThis method operates by obtaining an updating feature writer based on the specified filter and removing every feature from it.
The filter must not be null, in this case this method will throw an
IllegalArgumentException.
removeFeatures in interface FeatureStore<SimpleFeatureType,SimpleFeature>removeFeatures in class ContentFeatureStorefilter - an OpenGIS filterIOException - if an error occurs modifying the data sourceCopyright © 1996–2019 Geotools. All rights reserved.