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 TypeMethodDescriptionvoidaddFeature(SimpleFeature feature) Adds a single Feature to the correct typeName entry.voidaddFeatures(Collection<?> collection) Configures MemoryDataStore with Collection.voidConfigures MemoryDataStore with FeatureReader.voidaddFeatures(SimpleFeature... features) Configures MemoryDataStore with feature array.voidaddFeatures(SimpleFeatureIterator reader) Configures MemoryDataStore with FeatureReader.voidaddFeatures(FeatureCollection<SimpleFeatureType, SimpleFeature> collection) protected MemoryStatecreateContentState(ContentEntry entry) Use MemoryState to manage internal storage.protected ContentFeatureSourcecreateFeatureSource(ContentEntry entry) Instantiates new feature source for the entry.protected ContentFeatureSourcecreateFeatureSource(ContentEntry entry, Query query) voidcreateSchema(SimpleFeatureType featureType) Adds support for a new featureType to MemoryDataStore.List of available types provided by this DataStore.protected MemoryEntryAccess MemoryState for typeName.protected MemoryEntryentry(SimpleFeatureType schema) Access to entry to store content of the provided schema, will create new entry if needed.voidremoveSchema(String typeName) Used to permanently remove a schema from the underlying storagevoidremoveSchema(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:
createContentStatein classContentDataStore- Parameters:
entry- The entry.- Returns:
- A new instance of
ContentStatefor 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:
createTypeNamesin classContentDataStore- Returns:
- List of type names
- See Also:
-
org.geotools.data.ContentDataStore#getFeatureTypes()
-
createFeatureSource
Description copied from class:ContentDataStoreInstantiates new feature source for the entry.Subclasses should override this method to return a specific subclass of
ContentFeatureSource.- Specified by:
createFeatureSourcein classContentDataStore- Parameters:
entry- The entry.- Returns:
- An new instance of
ContentFeatureSourcefor 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:
createSchemain interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Overrides:
createSchemain classContentDataStore- Parameters:
featureType- SimpleFeatureType to be added- Throws:
IOException- If featureType already exists- See Also:
-
removeSchema
Description copied from interface:DataStoreUsed 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:
removeSchemain interfaceDataStore- Overrides:
removeSchemain classContentDataStore- Throws:
IOException- if the operation failed- See Also:
-
removeSchema
Description copied from interface:DataAccessUsed 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:
removeSchemain interfaceDataAccess<SimpleFeatureType,SimpleFeature> - Overrides:
removeSchemain classContentDataStore- Throws:
IOException- if the operation failed- See Also:
-