public class MemoryDataStore extends ContentDataStore
It serves as an example implementation of:
This class will also illustrate the use of In-Process locking when the time comes.
dataStoreFactory, entries, featureFactory, filterFactory, geometryFactory, JOINED_FEATURE_TYPE, lockingManager, LOGGER, namespaceURI, typeFactory, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATE
Constructor and Description |
---|
MemoryDataStore() |
MemoryDataStore(FeatureCollection<SimpleFeatureType,SimpleFeature> collection) |
MemoryDataStore(FeatureReader<SimpleFeatureType,SimpleFeature> reader) |
MemoryDataStore(SimpleFeature[] array) |
MemoryDataStore(SimpleFeatureCollection collection) |
MemoryDataStore(SimpleFeatureIterator reader) |
MemoryDataStore(SimpleFeatureType featureType)
Construct an MemoryDataStore around an empty collection of the provided SimpleFeatureType
|
Modifier and Type | Method and Description |
---|---|
void |
addFeature(SimpleFeature feature)
Adds a single Feature to the correct typeName entry.
|
void |
addFeatures(Collection<?> collection)
Configures MemoryDataStore with Collection.
|
void |
addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection) |
void |
addFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
Configures MemoryDataStore with FeatureReader.
|
void |
addFeatures(SimpleFeature[] features)
Configures MemoryDataStore with feature array.
|
void |
addFeatures(SimpleFeatureIterator reader)
Configures MemoryDataStore with FeatureReader.
|
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.
|
protected List<Name> |
createTypeNames()
List of available types provided by this DataStore.
|
protected MemoryEntry |
entry(SimpleFeatureType schema)
Access to entry to store content of the provided schema, will create new entry if needed.
|
protected MemoryEntry |
entry(String typeName)
Access MemoryState for typeName.
|
void |
removeSchema(Name typeName)
Used to permanently remove a schema from the underlying storage
This functionality is similar to an "drop table" statement in SQL.
|
void |
removeSchema(String typeName)
Used to permanently remove a schema from the underlying storage
This functionality is similar to an "drop table" statement in SQL.
|
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
public MemoryDataStore()
public MemoryDataStore(SimpleFeatureType featureType)
schema
- An empty feature collection of this type will be made availablepublic MemoryDataStore(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
public MemoryDataStore(SimpleFeatureCollection collection)
public MemoryDataStore(SimpleFeature[] array)
public MemoryDataStore(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException
IOException
public MemoryDataStore(SimpleFeatureIterator reader) throws IOException
IOException
protected MemoryState createContentState(ContentEntry entry)
createContentState
in class ContentDataStore
entry
- The entry.ContentState
for the entry.public void addFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException
reader
- New contents to addIOException
- If problems are encountered while addingDataSourceException
- See IOExceptionpublic void addFeatures(SimpleFeatureIterator reader) throws IOException
reader
- New contents to addIOException
- If problems are encountered while addingDataSourceException
- See IOExceptionpublic void addFeatures(Collection<?> collection)
You may use this to create a MemoryDataStore from a FeatureCollection.
collection
- Collection of features to addIllegalArgumentException
- If provided collection is emptypublic void addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
public void addFeatures(SimpleFeature[] features)
features
- Array of features to addIllegalArgumentException
- If provided feature array is emptypublic void addFeature(SimpleFeature feature)
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.
feature
- Individual feature to addprotected MemoryEntry entry(String typeName) throws IOException
Technically this is accessing the MemoryState for Transaction.AUTO_COMMIT
, which
is the definitive storage for the feature content.
typeName
- IOException
- If typeName cannot be foundprotected MemoryEntry entry(SimpleFeatureType schema) throws IOException
schema
- IOException
- If new entry could not be created due to typeName conflictprotected List<Name> createTypeNames()
createTypeNames
in class ContentDataStore
org.geotools.data.ContentDataStore#getFeatureTypes()
protected ContentFeatureSource createFeatureSource(ContentEntry entry)
ContentDataStore
Subclasses should override this method to return a specific subclass of ContentFeatureSource
.
createFeatureSource
in class ContentDataStore
entry
- The entry.ContentFeatureSource
for the entry.protected ContentFeatureSource createFeatureSource(ContentEntry entry, Query query)
public void createSchema(SimpleFeatureType featureType) throws IOException
FeatureTypes are stored by typeName, an IOException will be thrown if the requested typeName is already in use.
createSchema
in interface DataAccess<SimpleFeatureType,SimpleFeature>
createSchema
in class ContentDataStore
featureType
- SimpleFeatureType to be addedIOException
- If featureType already existsorg.geotools.data.DataStore#createSchema(org.geotools.feature.SimpleFeatureType)
public void removeSchema(String typeName) throws IOException
DataStore
This functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
removeSchema
in interface DataStore
removeSchema
in class ContentDataStore
IOException
- if the operation failedDataStore.removeSchema(String)
public void removeSchema(Name typeName) throws IOException
DataAccess
This functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
removeSchema
in interface DataAccess<SimpleFeatureType,SimpleFeature>
removeSchema
in class ContentDataStore
IOException
- if the operation failedDataAccess.removeSchema(Name)
Copyright © 1996–2019 Geotools. All rights reserved.