Class MongoDataStore
- Object
-
- ContentDataStore
-
- MongoDataStore
-
- All Implemented Interfaces:
DataAccess<SimpleFeatureType,SimpleFeature>
,DataStore
public class MongoDataStore extends ContentDataStore
-
-
Field Summary
-
Fields inherited from class ContentDataStore
dataStoreFactory, entries, featureFactory, filterFactory, geometryFactory, JOINED_FEATURE_TYPE, lockingManager, namespaceURI, typeFactory, WRITER_ADD, WRITER_COMMIT, WRITER_UPDATE
-
-
Constructor Summary
Constructors Constructor Description MongoDataStore(String dataStoreURI)
MongoDataStore(String dataStoreURI, String schemaStoreURI)
MongoDataStore(String dataStoreURI, String schemaStoreURI, boolean createDatabaseIfNeeded)
MongoDataStore(String dataStoreURI, String schemaStoreURI, boolean createDatabaseIfNeeded, MongoSchemaInitParams schemaInitParams, HTTPClient httpClient)
MongoDataStore(String dataStoreURI, String schemaStoreURI, boolean createDatabaseIfNeeded, HTTPClient httpClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanEntries()
Cleans current memory cached entries.protected ContentState
createContentState(ContentEntry entry)
Instantiates a new content state for the entry.protected ContentFeatureSource
createFeatureSource(ContentEntry entry)
Instantiates new feature source for the entry.void
createSchema(SimpleFeatureType incoming)
Creates a new schema in the datastore.protected List<Name>
createTypeNames()
Creates a set of qualified names corresponding to the types that the datastore provides.void
dispose()
Disposes of this data store and releases any resource that it is using.FeatureWriter<SimpleFeatureType,SimpleFeature>
getFeatureWriter(String typeName, Filter filter, Transaction tx)
Returns a feature writer for the specified query and transaction.FilterCapabilities
getFilterCapabilities()
Optional<MongoSchemaInitParams>
getSchemaInitParams()
MongoSchemaStore
getSchemaStore()
void
setSchemaInitParams(MongoSchemaInitParams schemaInitParams)
-
Methods inherited from class ContentDataStore
ensureEntry, ensureFeatureStore, entry, getDataStoreFactory, getEntry, getFeatureFactory, getFeatureReader, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureSource, getFeatureTypeFactory, getFeatureWriter, getFeatureWriterAppend, getFilterFactory, getGeometryFactory, getInfo, getLockingManager, getLogger, getNames, getNamespaceURI, getSchema, getSchema, getTypeNames, name, removeEntry, removeSchema, removeSchema, setDataStoreFactory, setFeatureFactory, setFeatureTypeFactory, setFilterFactory, setGeometryFactory, setNamespaceURI, updateSchema, updateSchema
-
-
-
-
Constructor Detail
-
MongoDataStore
public MongoDataStore(String dataStoreURI)
-
MongoDataStore
public MongoDataStore(String dataStoreURI, String schemaStoreURI, boolean createDatabaseIfNeeded)
-
MongoDataStore
public MongoDataStore(String dataStoreURI, String schemaStoreURI, boolean createDatabaseIfNeeded, HTTPClient httpClient)
-
MongoDataStore
public MongoDataStore(String dataStoreURI, String schemaStoreURI, boolean createDatabaseIfNeeded, MongoSchemaInitParams schemaInitParams, HTTPClient httpClient)
-
-
Method Detail
-
getFilterCapabilities
public FilterCapabilities getFilterCapabilities()
-
createSchema
public void createSchema(SimpleFeatureType incoming) throws IOException
Description copied from class:ContentDataStore
Creates a new schema in the datastore.This implementation throws a
UnsupportedOperationException
. Subclasses should override to support schema creation.- Specified by:
createSchema
in interfaceDataAccess<SimpleFeatureType,SimpleFeature>
- Overrides:
createSchema
in classContentDataStore
- Parameters:
incoming
- FetureType to add to DataStore- Throws:
IOException
- If featureType cannot be created- See Also:
DataAccess.createSchema(FeatureType)
-
createTypeNames
protected List<Name> createTypeNames() throws IOException
Description copied from class:ContentDataStore
Creates a set of qualified names corresponding to the types that the datastore provides.Namespaces may be left
null
for data stores which do not support namespace qualified type names.- Specified by:
createTypeNames
in classContentDataStore
- Returns:
- A list of
Name
. - Throws:
IOException
- Any errors occuring connecting to data.
-
createFeatureSource
protected ContentFeatureSource createFeatureSource(ContentEntry entry) throws IOException
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. - Throws:
IOException
-
getFeatureWriter
public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction tx) throws IOException
Description copied from class:ContentDataStore
Returns a feature writer for the specified query and transaction.This method is not intended to be overridden and is marked final. This implementation delegates to
FeatureCollection
and wraps an iterator in aFeatureWriter
.- Specified by:
getFeatureWriter
in interfaceDataStore
- Overrides:
getFeatureWriter
in classContentDataStore
- Parameters:
typeName
- the type name for features that will be accessiblefilter
- defines additional constraints on the features that will be accessibletx
- the transaction that the returned writer operates against- Returns:
- an instance of
FeatureWriter
- Throws:
IOException
- if data access errors occur- See Also:
DataStore.getFeatureWriterAppend(String, Transaction)
-
createContentState
protected ContentState createContentState(ContentEntry entry)
Description copied from class:ContentDataStore
Instantiates a new content state for the entry.Subclasses may override this method to return a specific subclass of
ContentState
.- Overrides:
createContentState
in classContentDataStore
- Parameters:
entry
- The entry.- Returns:
- A new instance of
ContentState
for the entry.
-
getSchemaStore
public final MongoSchemaStore getSchemaStore()
-
dispose
public void dispose()
Description copied from interface:DataAccess
Disposes of this data store and releases any resource that it is using.A
DataStore
cannot be used afterdispose
has been called, neither can any data access object it helped create, such asFeatureReader
,FeatureSource
orFeatureCollection
.This operation can be called more than once without side effects.
There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.
- Specified by:
dispose
in interfaceDataAccess<SimpleFeatureType,SimpleFeature>
- Overrides:
dispose
in classContentDataStore
-
cleanEntries
public void cleanEntries()
Cleans current memory cached entries.
-
getSchemaInitParams
public Optional<MongoSchemaInitParams> getSchemaInitParams()
-
setSchemaInitParams
public void setSchemaInitParams(MongoSchemaInitParams schemaInitParams)
-
-