Class MemoryDataStore
- All Implemented Interfaces:
DataAccess<SimpleFeatureType,
,SimpleFeature> DataStore
It serves as an example implementation of:
- FeatureListenerManager use: allows handling of FeatureEvents
This class will also illustrate the use of In-Process locking when the time comes.
- Author:
- jgarnett
-
Field Summary
Fields inherited from class ContentDataStore
dataStoreFactory, entries, featureFactory, filterFactory, geometryFactory, JOINED_FEATURE_TYPE, lockingManager, LOGGER, namespaceURI, typeFactory, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATE
-
Constructor Summary
ConstructorsConstructorDescriptionMemoryDataStore
(SimpleFeature... array) MemoryDataStore
(SimpleFeatureType featureType) Construct an MemoryDataStore around an empty collection of the provided SimpleFeatureTypeMemoryDataStore
(SimpleFeatureCollection collection) MemoryDataStore
(SimpleFeatureIterator reader) MemoryDataStore
(FeatureCollection<SimpleFeatureType, SimpleFeature> collection) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFeature
(SimpleFeature feature) Adds a single Feature to the correct typeName entry.void
addFeatures
(Collection<?> collection) Configures MemoryDataStore with Collection.void
Configures MemoryDataStore with FeatureReader.void
addFeatures
(SimpleFeature... features) Configures MemoryDataStore with feature array.void
addFeatures
(SimpleFeatureIterator reader) Configures MemoryDataStore with FeatureReader.void
addFeatures
(FeatureCollection<SimpleFeatureType, SimpleFeature> collection) protected MemoryState
createContentState
(ContentEntry entry) Use MemoryState to manage internal storage.protected ContentFeatureSource
createFeatureSource
(ContentEntry entry) Instantiates new feature source for the entry.protected ContentFeatureSource
createFeatureSource
(ContentEntry entry, Query query) void
createSchema
(SimpleFeatureType featureType) Adds support for a new featureType to MemoryDataStore.List of available types provided by this DataStore.protected MemoryEntry
Access MemoryState for typeName.protected MemoryEntry
entry
(SimpleFeatureType schema) Access to entry to store content of the provided schema, will create new entry if needed.void
removeSchema
(String typeName) Used to permanently remove a schema from the underlying storagevoid
removeSchema
(Name typeName) Used to permanently remove a schema from the underlying storageMethods inherited from class ContentDataStore
dispose, ensureEntry, ensureFeatureStore, entry, getDataStoreFactory, getEntry, getFeatureFactory, getFeatureReader, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureTypeFactory, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getFilterFactory, getGeometryFactory, getInfo, getLockingManager, getLogger, getNames, getNamespaceURI, getSchema, getSchema, getTypeNames, name, removeEntry, setDataStoreFactory, setFeatureFactory, setFeatureTypeFactory, setFilterFactory, setGeometryFactory, setNamespaceURI, updateSchema, updateSchema
-
Constructor Details
-
MemoryDataStore
public MemoryDataStore() -
MemoryDataStore
Construct an MemoryDataStore around an empty collection of the provided SimpleFeatureType- Parameters:
featureType
- The initial feature type for the memory data store, an empty feature collection of this type will be made available
-
MemoryDataStore
-
MemoryDataStore
-
MemoryDataStore
-
MemoryDataStore
- Throws:
IOException
-
MemoryDataStore
- Throws:
IOException
-
-
Method Details
-
createContentState
Use MemoryState to manage internal storage.- Overrides:
createContentState
in classContentDataStore
- Parameters:
entry
- The entry.- Returns:
- A new instance of
ContentState
for the entry.
-
addFeatures
Configures MemoryDataStore with FeatureReader.- Parameters:
reader
- New contents to add- Throws:
IOException
- If problems are encountered while addingDataSourceException
- See IOException
-
addFeatures
Configures MemoryDataStore with FeatureReader.- Parameters:
reader
- New contents to add- Throws:
IOException
- If problems are encountered while addingDataSourceException
- See IOException
-
addFeatures
Configures MemoryDataStore with Collection.You may use this to create a MemoryDataStore from a FeatureCollection.
- Parameters:
collection
- Collection of features to add- Throws:
IllegalArgumentException
- If provided collection is empty
-
addFeatures
-
addFeatures
Configures MemoryDataStore with feature array.- Parameters:
features
- Array of features to add- Throws:
IllegalArgumentException
- If provided feature array is empty
-
addFeature
Adds a single Feature to the correct typeName entry.This is an internal operation used for setting up MemoryDataStore - please use FeatureWriter for general use.
This method is willing to create new FeatureTypes for MemoryDataStore.
- Parameters:
feature
- Individual feature to add
-
entry
Access MemoryState for typeName.Technically this is accessing the MemoryState for
Transaction.AUTO_COMMIT
, which is the definitive storage for the feature content.- Returns:
- MemoryState storing feature (by FeatureID)
- Throws:
IOException
- If typeName cannot be found
-
entry
Access to entry to store content of the provided schema, will create new entry if needed.- Returns:
- MemoryState used for content storage
- Throws:
IOException
- If new entry could not be created due to typeName conflict
-
createTypeNames
List of available types provided by this DataStore.- Specified by:
createTypeNames
in classContentDataStore
- Returns:
- List of type names
- See Also:
-
org.geotools.data.ContentDataStore#getFeatureTypes()
-
createFeatureSource
Description copied from class:ContentDataStore
Instantiates new feature source for the entry.Subclasses should override this method to return a specific subclass of
ContentFeatureSource
.- Specified by:
createFeatureSource
in classContentDataStore
- Parameters:
entry
- The entry.- Returns:
- An new instance of
ContentFeatureSource
for the entry.
-
createFeatureSource
-
createSchema
Adds support for a new featureType to MemoryDataStore.FeatureTypes are stored by typeName, an IOException will be thrown if the requested typeName is already in use.
- Specified by:
createSchema
in interfaceDataAccess<SimpleFeatureType,
SimpleFeature> - Overrides:
createSchema
in classContentDataStore
- Parameters:
featureType
- SimpleFeatureType to be added- Throws:
IOException
- If featureType already exists- See Also:
-
removeSchema
Description copied from interface:DataStore
Used to permanently remove a schema from the underlying storageThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
- Specified by:
removeSchema
in interfaceDataStore
- Overrides:
removeSchema
in classContentDataStore
- Throws:
IOException
- if the operation failed- See Also:
-
removeSchema
Description copied from interface:DataAccess
Used to permanently remove a schema from the underlying storageThis functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
- Specified by:
removeSchema
in interfaceDataAccess<SimpleFeatureType,
SimpleFeature> - Overrides:
removeSchema
in classContentDataStore
- Throws:
IOException
- if the operation failed- See Also:
-