@java.lang.SuppressWarnings("rawtypes")
public class SimpleMapDatastore
extends AbstractDatastore
implements java.io.Closeable, ConnectionSourcesProvider, SchemaMultiTenantCapableDatastore, SingleSessionCapableDatastore, TransactionCapableDatastore
A simple implementation of the Datastore interface that backs onto an in-memory map. Mainly used for mocking and testing scenarios.
| Modifiers | Name | Description |
|---|---|---|
protected java.util.Map<java.lang.String, SimpleMapDatastore> |
datastoresByConnectionSource |
|
protected boolean |
failOnError |
|
protected GormEnhancer |
gormEnhancer |
| Fields inherited from class | Fields |
|---|---|
class AbstractDatastore |
LOG, applicationEventPublisher, cacheAdapterRepository, connectionDetails, mappingContext, serviceRegistry |
| Constructor and description |
|---|
SimpleMapDatastore(ConnectionSources<java.util.Map<java.lang.String, java.util.Map>, ConnectionSourceSettings> connectionSources, MappingContext mappingContext, ConfigurableApplicationEventPublisher eventPublisher) |
SimpleMapDatastore(ConnectionSources<java.util.Map<java.lang.String, java.util.Map>, ConnectionSourceSettings> connectionSources, ConfigurableApplicationEventPublisher eventPublisher, java.lang.Class classes) |
SimpleMapDatastore(PropertyResolver configuration, ConfigurableApplicationEventPublisher eventPublisher, java.lang.Class classes) |
SimpleMapDatastore() |
SimpleMapDatastore(java.lang.Iterable<java.lang.String> dataSourceNames, java.lang.Class classes) |
SimpleMapDatastore(java.lang.Class classes) |
SimpleMapDatastore(PropertyResolver configuration, java.lang.Iterable<java.lang.String> dataSourceNames, java.lang.Class classes) |
SimpleMapDatastore(PropertyResolver configuration, java.lang.Iterable<java.lang.String> dataSourceNames, java.lang.Package packages) |
SimpleMapDatastore(java.util.Map configuration, java.lang.Iterable<java.lang.String> dataSourceNames, java.lang.Package packages) |
SimpleMapDatastore(java.util.Map configuration, java.lang.Package packages) |
SimpleMapDatastore(PropertyResolver configuration, java.lang.Iterable<java.lang.String> dataSourceNames, java.lang.Package packageToScan) |
SimpleMapDatastore(java.util.Map<java.lang.String, java.util.Map> datastore, ConfigurableApplicationContext ctx)Creates a map based datastore backing onto the specified map |
SimpleMapDatastore(ConfigurableApplicationContext ctx) |
SimpleMapDatastore(MappingContext mappingContext, ConfigurableApplicationContext ctx)Creates a map based datastore for the specified mapping context |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addTenantForSchema(java.lang.String schemaName) |
|
public void |
clearData() |
|
public void |
close() |
|
protected static KeyValueMappingContext |
createMappingContext(ConnectionSources<java.util.Map<java.lang.String, java.util.Map>, ConnectionSourceSettings> connectionSources, java.lang.Class classes) |
|
protected static InMemoryConnectionSources<java.util.Map<java.lang.String, java.util.Map>, ConnectionSourceSettings> |
createMultipleDataSources(java.lang.Iterable<java.lang.String> dataSourceNames, PropertyResolver propertyResolver) |
|
protected Session |
createSession(PropertyResolver connectionDetails) |
|
public ApplicationEventPublisher |
getApplicationEventPublisher() |
|
public java.util.Map<java.lang.String, java.util.Map> |
getBackingMap() |
|
protected java.lang.Iterable<java.lang.String> |
getConnectionSourceNames(ConnectionSourceFactory<java.util.Map<java.lang.String, java.util.Map>, ConnectionSourceSettings> connectionSourceFactory, PropertyResolver configuration) |
|
public ConnectionSources<java.util.Map<java.lang.String, java.util.Map>, ConnectionSourceSettings> |
getConnectionSources() |
|
public Datastore |
getDatastoreForConnection(java.lang.String connectionName) |
|
public Datastore |
getDatastoreForTenantId(java.io.Serializable tenantId) |
|
public java.util.Map |
getIndices() |
<D> |
protected GormInstanceApi<D> |
getInstanceApi(java.lang.Class<D> cls, java.lang.String qualifier) |
|
public MultiTenancyMode |
getMultiTenancyMode() |
<D> |
protected GormStaticApi<D> |
getStaticApi(java.lang.Class<D> cls, java.lang.String qualifier) |
|
public TenantResolver |
getTenantResolver() |
|
public PlatformTransactionManager |
getTransactionManager() |
<D> |
protected GormValidationApi<D> |
getValidationApi(java.lang.Class<D> cls, java.lang.String qualifier) |
|
protected GormEnhancer |
initialize(ConnectionSourceSettings settings) |
|
protected GormEnhancer |
initialize(ConnectionSourceSettings settings) |
|
protected GormEnhancer |
initialize(ConnectionSourceSettings settings) |
|
public long |
nextIdentifier(java.lang.String family)Hands out the next generated identifier for the given family. |
|
public void |
persistentEntityAdded(PersistentEntity entity) |
|
protected void |
registerEventListeners(ConfigurableApplicationEventPublisher eventPublisher) |
<T1> |
public T1 |
withNewSession(java.io.Serializable tenantId, Closure<T1> callable) |
| Methods inherited from class | Name |
|---|---|
class AbstractDatastore |
connect, connect, connectStateless, createSession, createStatelessSession, destroy, doInSession, getApplicationContext, getApplicationEventPublisher, getCurrentSession, getMappingContext, getService, getServices, getSessionResolver, hasCurrentSession, initializeConverters, isIndexed, isSchemaless, mapToPropertyResolver, retrieveSession, retrieveSession, setApplicationContext, withSession |
Creates a map based datastore backing onto the specified map
datastore - The datastore to back on toctx - the application contextCreates a map based datastore for the specified mapping context
mappingContext - The mapping contextHands out the next generated identifier for the given family. The count is shared by every session of this datastore, so an identifier is not handed out twice by sessions open at the same time, whose inserts are not yet written, or reused after a delete. It continues from the family's size when that is higher, as when entries are put in the backing map directly, and starts again once clearData() empties the datastore.
family - the family of the root entity the identifier is for