Class MemoryFeatureStore
- Object
-
- ContentFeatureSource
-
- ContentFeatureStore
-
- MemoryFeatureStore
-
- All Implemented Interfaces:
FeatureLocking<SimpleFeatureType,SimpleFeature>,FeatureSource<SimpleFeatureType,SimpleFeature>,FeatureStore<SimpleFeatureType,SimpleFeature>,SimpleFeatureLocking,SimpleFeatureSource,SimpleFeatureStore
public class MemoryFeatureStore extends ContentFeatureStore
-
-
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
-
-
Constructor Summary
Constructors Constructor Description MemoryFeatureStore(ContentEntry entry, Query query)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SimpleFeatureTypebuildFeatureType()Creates the feature type or schema for the feature source.protected QueryCapabilitiesbuildQueryCapabilities()Builds the query capabilities for this feature source.protected ReferencedEnvelopegetBoundsInternal(Query query)Calculates the bounds of a specified query.protected intgetCountInternal(Query query)Calculates the number of features of a specified query.protected FeatureReader<SimpleFeatureType,SimpleFeature>getReaderInternal(Query query)Subclass method for returning a native reader from the datastore.MemoryStategetState()The current state for the feature source.protected FeatureWriter<SimpleFeatureType,SimpleFeature>getWriterInternal(Query query, int flags)Subclass method for returning a native writer from the datastore.protected booleanhandleVisitor(Query query, FeatureVisitor visitor)Subclass method which allows subclasses to natively handle a visitor.voidsetTransaction(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, addHints, canEvent, canFilter, canFilter, canLimit, canLimit, canLock, canOffset, canOffset, canReproject, canRetype, canRetype, canSort, canSort, canTransact, doLockInternal, doUnlockInternal, getAbsoluteSchema, getBounds, getBounds, getCount, getDataStore, 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, 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, getDataStore, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener
-
Methods inherited from interface FeatureStore
getTransaction
-
Methods inherited from interface SimpleFeatureStore
getFeatures, getFeatures, getFeatures
-
-
-
-
Constructor Detail
-
MemoryFeatureStore
public MemoryFeatureStore(ContentEntry entry, Query query)
-
-
Method Detail
-
getState
public MemoryState getState()
Description copied from class:ContentFeatureSourceThe current state for the feature source.This value is derived from current transaction of the feature source.
- Overrides:
getStatein classContentFeatureSource
-
getWriterInternal
protected FeatureWriter<SimpleFeatureType,SimpleFeature> getWriterInternal(Query query, int flags) throws IOException
Description copied from class:ContentFeatureStoreSubclass 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:
getWriterInternalin classContentFeatureStore- Parameters:
query- Queryflags- SeeContentFeatureStore.WRITER_ADDandContentFeatureStore.WRITER_UPDATE- Throws:
IOException
-
setTransaction
public void setTransaction(Transaction transaction)
Description copied from class:ContentFeatureSourceSets 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:
setTransactionin interfaceFeatureStore<SimpleFeatureType,SimpleFeature>- Overrides:
setTransactionin classContentFeatureSource- Parameters:
transaction- The new transaction, ornull.
-
buildFeatureType
protected SimpleFeatureType buildFeatureType() throws IOException
Description copied from class:ContentFeatureSourceCreates the feature type or schema for the feature source.Implementations should use
SimpleFeatureTypeBuilderto 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:
buildFeatureTypein classContentFeatureSource- Throws:
IOException
-
getBoundsInternal
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException
Description copied from class:ContentFeatureSourceCalculates the bounds of a specified query. Subclasses must implement this method. If the computation is not fast, subclasses can returnnull.- Specified by:
getBoundsInternalin classContentFeatureSource- Throws:
IOException
-
getCountInternal
protected int getCountInternal(Query query) throws IOException
Description copied from class:ContentFeatureSourceCalculates 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:
getCountInternalin classContentFeatureSource- Throws:
IOException
-
getReaderInternal
protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) throws IOException
Description copied from class:ContentFeatureSourceSubclass 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:
getReaderInternalin classContentFeatureSource- Throws:
IOException
-
handleVisitor
protected boolean handleVisitor(Query query, FeatureVisitor visitor) throws IOException
Description copied from class:ContentFeatureSourceSubclass 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:
handleVisitorin classContentFeatureSource- Parameters:
query- The query being made.visitor- The visitor to- Returns:
- true if the visitor can be handled natively, otherwise false.
- Throws:
IOException
-
buildQueryCapabilities
protected QueryCapabilities buildQueryCapabilities()
Description copied from class:ContentFeatureSourceBuilds the query capabilities for this feature source. The default implementation returns a newly built QueryCapabilities, subclasses are advised to build their own.- Overrides:
buildQueryCapabilitiesin classContentFeatureSource
-
-