Class PropertyFeatureStore
- Object
-
- ContentFeatureSource
-
- ContentFeatureStore
-
- PropertyFeatureStore
-
- All Implemented Interfaces:
FeatureLocking<SimpleFeatureType,SimpleFeature>
,FeatureSource<SimpleFeatureType,SimpleFeature>
,FeatureStore<SimpleFeatureType,SimpleFeature>
,SimpleFeatureLocking
,SimpleFeatureSource
,SimpleFeatureStore
public class PropertyFeatureStore extends ContentFeatureStore
Implementation used for writeable property files. Supports limited caching of number of features and bounds.- Author:
- Jody Garnett, Torben Barsballe (Boundless)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface FeatureLocking
FeatureLocking.Response
-
-
Field Summary
-
Fields inherited from class ContentFeatureStore
ORIGINAL_FEATURE_KEY, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATE
-
Fields inherited from class ContentFeatureSource
entry, hints, lock, query, queryCapabilities, schema, transaction
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addHints(Set<Hints.Key> hints)
Subclass hook too add additional hints.protected SimpleFeatureType
buildFeatureType()
Creates the feature type or schema for the feature source.protected QueryCapabilities
buildQueryCapabilities()
Builds the query capabilities for this feature source.protected boolean
canEvent()
We handle events internallyprotected 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.PropertyDataStore
getDataStore()
The datastore that this feature source originated from.ContentEntry
getEntry()
The entry for the feature source.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 typesQueryCapabilities
getQueryCapabilities()
SimpleFeatureCollection optimized for read-only access.protected FeatureReader<SimpleFeatureType,SimpleFeature>
getReaderInternal(Query query)
Subclass method for returning a native reader from the datastore.ContentState
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.void
setTransaction(Transaction transaction)
Sets the current transaction the feature source is working against.-
Methods inherited from class ContentFeatureStore
addFeatures, addFeatures, getWriter, getWriter, getWriter, getWriter, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, removeFeatures, setFeatures
-
Methods inherited from class ContentFeatureSource
accepts, addFeatureListener, canFilter, canFilter, canLimit, canLimit, canLock, canOffset, canOffset, canReproject, canRetype, canRetype, canSort, canSort, canTransact, 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, unLockFeatures
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface FeatureLocking
lockFeatures, lockFeatures, lockFeatures, setFeatureLock, unLockFeatures, unLockFeatures, unLockFeatures
-
Methods inherited from interface FeatureSource
addFeatureListener, getBounds, getBounds, getCount, getSchema, getSupportedHints, removeFeatureListener
-
Methods inherited from interface SimpleFeatureStore
getFeatures, getFeatures, getFeatures
-
-
-
-
Method Detail
-
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 classContentFeatureSource
- Parameters:
hints
- The set of hints supported by the feature source.
-
canEvent
protected boolean canEvent()
We handle events internally- Overrides:
canEvent
in classContentFeatureSource
- Returns:
- true if event notification has custom implementation
-
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 classContentFeatureSource
-
getWriterInternal
protected FeatureWriter<SimpleFeatureType,SimpleFeature> getWriterInternal(Query query, int flags) throws IOException
Description copied from class:ContentFeatureStore
Subclass method for returning a native writer from the datastore.It is important to note that if the native writer intends to handle any of the following natively:
- reprojection
- filtering
- events
- max feature limiting
- sorting
- locking
true
:- Specified by:
getWriterInternal
in classContentFeatureStore
- Parameters:
query
- Queryflags
- SeeContentFeatureStore.WRITER_ADD
andContentFeatureStore.WRITER_UPDATE
- Throws:
IOException
-
setTransaction
public void setTransaction(Transaction transaction)
Description copied from class:ContentFeatureSource
Sets the current transaction the feature source is working against.transaction may be
null
. This signifies that the auto-commit transaction is used:Transaction.AUTO_COMMIT
.- Specified by:
setTransaction
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Overrides:
setTransaction
in classContentFeatureSource
- Parameters:
transaction
- The new transaction, ornull
.
-
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. If the computation is not fast, subclasses can returnnull
.- Specified by:
getBoundsInternal
in classContentFeatureSource
- 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. If the computation is not fast, it's possible to return -1.- Specified by:
getCountInternal
in classContentFeatureSource
- Throws:
IOException
-
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:
- reprojection
- filtering
- max feature limiting
- sorting
- locking
- transactions
true
:ContentFeatureSource.canReproject()
- handlesQuery.getCoordinateSystemReproject()
internally. Example would be PostGIS using Proj to handle reproejction internallyContentFeatureSource.canFilter(Query)
- handlesinternally.
- {@link #canLimit(Query)} - handles {@link Query#getMaxFeatures()} and {@link Query#getStartIndex()} internally.
- {@link #canSort(Query)} - handles {@link Query#getSortBy()} natively.
- {@link #canRetype(Query)} - handles {@link Query#getProperties()} natively. Example would be only parsing the properties the user asks for from an XML file
- {@link #canLock()} - handles read-locks natively
- {@link #canTransact()} - handles transactions natively
- Specified by:
getReaderInternal
in classContentFeatureSource
- Throws:
IOException
-
buildFeatureType
protected SimpleFeatureType buildFeatureType() throws IOException
Description copied from class:ContentFeatureSource
Creates the feature type or schema for the feature source.Implementations 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 (seeContentDataStore.getFeatureFactory()
. Example:SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setFeatureTypeFactory( getDataStore().getFeatureTypeFactory() ); //build the feature type ...
- Specified by:
buildFeatureType
in classContentFeatureSource
- 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 classContentFeatureSource
- Parameters:
query
- The query being made.visitor
- The visitor to- Returns:
- true if the visitor can be handled natively, otherwise false.
- Throws:
IOException
-
getDataStore
public PropertyDataStore getDataStore()
Description copied from class:ContentFeatureSource
The datastore that this feature source originated from.Subclasses may wish to extend this method in order to type narrow its return type.
- Specified by:
getDataStore
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Overrides:
getDataStore
in classContentFeatureSource
- Returns:
- the data source providing this
FeatureSource
-
getEntry
public ContentEntry getEntry()
Description copied from class:ContentFeatureSource
The entry for the feature source.- Overrides:
getEntry
in classContentFeatureSource
-
getTransaction
public Transaction getTransaction()
Description copied from class:ContentFeatureSource
The current transaction the feature source is working against.This 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
.- Specified by:
getTransaction
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Overrides:
getTransaction
in classContentFeatureSource
- Returns:
- Transaction in use, or Transaction.AUTO_COMMIT
-
getState
public ContentState getState()
Description copied from class:ContentFeatureSource
The current state for the feature source.This value is derived from current transaction of the feature source.
- Overrides:
getState
in classContentFeatureSource
-
getInfo
public ResourceInfo getInfo()
Description copied from class:ContentFeatureSource
A default ResourceInfo with a generic description.Subclasses should override to provide an explicit ResourceInfo object for their content.
- Specified by:
getInfo
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Overrides:
getInfo
in classContentFeatureSource
- Returns:
- description of features contents
-
getName
public Name getName()
Description copied from class:ContentFeatureSource
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 interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Overrides:
getName
in classContentFeatureSource
- Returns:
- the name of the features accessible through this
FeatureSource
- See Also:
FeatureSource.getName()
-
getQueryCapabilities
public QueryCapabilities getQueryCapabilities()
Description copied from class:ContentFeatureSource
SimpleFeatureCollection optimized for read-only access.Available via getView( filter ):
- getFeatures().sort( sort )
- getFeatures( filter ).sort( sort )
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.
- Specified by:
getQueryCapabilities
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Overrides:
getQueryCapabilities
in classContentFeatureSource
- Returns:
- readonly access
-
-