|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractDataStore
MemoryDataStore
public class MemoryDataStore
This is an example implementation of a DataStore used for testing.
It serves as an example implementation of:
This class will also illustrate the use of In-Process locking when the time comes.
| Field Summary | |
|---|---|
protected Map<String,Map<String,SimpleFeature>> |
memory
Memory holds Map of Feature by fid by typeName. |
protected Map<String,SimpleFeatureType> |
schema
Schema holds FeatureType by typeName |
| Fields inherited from class AbstractDataStore |
|---|
isWriteable, listenerManager, LOGGER |
| Constructor Summary | |
|---|---|
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 |
|
| Method Summary | |
|---|---|
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. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
createFeatureWriter(String typeName,
Transaction transaction)
Provides FeatureWriter over the entire contents of typeName. |
void |
createSchema(SimpleFeatureType featureType)
Adds support for a new featureType to MemoryDataStore. |
protected Map<String,SimpleFeature> |
features(String typeName)
Access featureMap for typeName. |
protected ReferencedEnvelope |
getBounds(Query query)
Computes the bounds of the features for the specified feature type that satisfy the query provided that there is a fast way to get that result. |
protected int |
getCount(Query query)
Gets the number of the features that would be returned by this query for the specified feature type. |
FeatureReader<SimpleFeatureType,SimpleFeature> |
getFeatureReader(String typeName)
Provides FeatureReader typeName. |
SimpleFeatureType |
getSchema(String typeName)
SimpleFeatureType access by typeName. |
String[] |
getTypeNames()
List of available types provided by this DataStore. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map<String,Map<String,SimpleFeature>> memory
protected Map<String,SimpleFeatureType> schema
| Constructor Detail |
|---|
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| Method Detail |
|---|
public void addFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
throws IOException
reader - New contents to add
IOException - If problems are encountered while adding
DataSourceException - See IOException
public void addFeatures(SimpleFeatureIterator reader)
throws IOException
reader - New contents to add
IOException - If problems are encountered while adding
DataSourceException - See IOExceptionpublic void addFeatures(Collection<?> collection)
You may use this to create a MemoryDataStore from a FeatureCollection.
collection - Collection of features to add
IllegalArgumentException - If provided collection is emptypublic void addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
public void addFeatures(SimpleFeature[] features)
features - Array of features to add
IllegalArgumentException - If provided feature array is emptypublic void addFeature(SimpleFeature feature)
This is an internal opperation used for setting up MemoryDataStore - please use FeatureWriter for generatl use.
This method is willing to create new FeatureTypes for MemoryDataStore.
feature - Individual feature to add
protected Map<String,SimpleFeature> features(String typeName)
throws IOException
typeName -
IOException - If typeName cannot be foundpublic String[] getTypeNames()
getTypeNames in interface DataStoregetTypeNames in class AbstractDataStoreorg.geotools.data.AbstractDataStore#getFeatureTypes()
public SimpleFeatureType getSchema(String typeName)
throws IOException
typeName.
getSchema in interface DataStoregetSchema in class AbstractDataStoretypeName -
typeName
IOException
SchemaNotFoundException - DOCUMENT ME!AbstractDataStore.getSchema(java.lang.String)
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 AbstractDataStorefeatureType - SimpleFeatureType to be added
IOException - If featureType already existsorg.geotools.data.DataStore#createSchema(org.geotools.feature.SimpleFeatureType)
public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName)
throws IOException
typeName.
Implements getFeatureReader contract for AbstractDataStore.
getFeatureReader in class AbstractDataStoretypeName -
IOException - If typeName could not be found
DataSourceException - See IOExceptionAbstractDataStore.getFeatureSource(java.lang.String)
public FeatureWriter<SimpleFeatureType,SimpleFeature> createFeatureWriter(String typeName,
Transaction transaction)
throws IOException
typeName.
Implements getFeatureWriter contract for AbstractDataStore.
createFeatureWriter in class AbstractDataStoretypeName - name of FeatureType we wish to modifytransaction - a feature writer
IOException - If writer cannot be obtained for typeName
DataSourceException - See IOExceptionAbstractDataStore.getFeatureSource(java.lang.String)
protected ReferencedEnvelope getBounds(Query query)
throws IOException
AbstractDataStoreWill return null if there is not fast way to compute the bounds. Since it's based on some kind of header/cached information, it's not guaranteed to be real bound of the features
getBounds in class AbstractDataStoreSchemaNotFoundException
IOExceptionorg.geotools.data.AbstractDataStore#getBounds(java.lang.String,
org.geotools.data.Query)
protected int getCount(Query query)
throws IOException
AbstractDataStore
If getBounds(Query) returns -1 due to expense consider
using getFeatures(Query).getCount() as a an alternative.
getCount in class AbstractDataStorequery - Contains the Filter and MaxFeatures to find the bounds for.
-1
if count is too expensive to calculate or any errors or occur.
IOExceptionorg.geotools.data.AbstractDataStore#getCount(java.lang.String, org.geotools.data.Query)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||