Interface EmbeddedStorageFoundation<F extends EmbeddedStorageFoundation<?>>
- Type Parameters:
F
- the "self-type" of theEmbeddedStorageManager
implementation.
- All Superinterfaces:
StorageFoundation<F>
- All Known Implementing Classes:
EmbeddedStorageFoundation.Default
public interface EmbeddedStorageFoundation<F extends EmbeddedStorageFoundation<?>> extends StorageFoundation<F>
EmbeddedStorageManager
instance, i.e. a functional database handling logic embedded in the same process as the application using it.
Additionally to the services of a mere factory type, a foundation type also keeps references to all parts
after a EmbeddedStorageManager
instance has been created. This is useful if some internal logic parts
shall be accessed while the EmbeddedStorageManager
logic is already running. Therefore, this type can
best be thought of as a foundation on which the running database handling logic stands.
All set~ methods are simple setter methods without any additional logic worth mentioning.
All set~ methods return this to allow for easy method chaining to improve readability.
All get~ methods return a logic part instance, if present or otherwise creates and sets one beforehand
via a default creation logic.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
EmbeddedStorageFoundation.Default<F extends EmbeddedStorageFoundation.Default<?>>
-
Method Summary
Modifier and Type Method Description default EmbeddedStorageManager
createEmbeddedStorageManager()
Creates and returns a newEmbeddedStorageManager
instance by using the current state of all registered logic part instances and by on-demand creating missing ones via a default logic.EmbeddedStorageManager
createEmbeddedStorageManager(Object explicitRoot)
Creates and returns a newEmbeddedStorageManager
instance by using the current state of all registered logic part instances and by on-demand creating missing ones via a default logic.F
executeTypeHandlerRegistration(PersistenceTypeHandlerRegistration<Binary> typeHandlerRegistration)
Convenience method forthis.getConnectionFoundation().executeTypeHandlerRegistration(typeHandlerRegistration)
.EmbeddedStorageConnectionFoundation<?>
getConnectionFoundation()
Returns the currently setStorageConfiguration
instance.String
getDataBaseName()
A name uniquely identifying theDatabase
whereStorageManager
instances created by this foundation will belong to.Databases
getDatabases()
The register ofDatabase
s whereStorageManager
instances created by this foundation instance will be registered.PersistenceRootResolverProvider
getRootResolverProvider()
Returns the internalEmbeddedStorageConnectionFoundation
instance'sPersistenceRootResolverProvider
instance.PersistenceTypeEvaluator
getTypeEvaluatorPersistable()
static EmbeddedStorageFoundation<?>
New()
Pseudo-constructor method to create a newEmbeddedStorageFoundation
instance with default implementation.F
onConnectionFoundation(Consumer<? super EmbeddedStorageConnectionFoundation<?>> logic)
Executes the passed logic on theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.F
onThis(Consumer<? super EmbeddedStorageFoundation<?>> logic)
Executes the passed logic on this.F
registerTypeHandler(PersistenceTypeHandler<Binary,?> typeHandler)
F
registerTypeHandlers(Iterable<? extends PersistenceTypeHandler<Binary,?>> typeHandlers)
F
setConnectionFoundation(EmbeddedStorageConnectionFoundation<?> connectionFoundation)
Sets theEmbeddedStorageConnectionFoundation
instance to be used for the assembly.F
setDataBaseName(String dataBaseName)
Sets the name uniquely identifying theDatabase
to be used.
Also see the description ingetDataBaseName()
.F
setDatabases(Databases databases)
Sets theDatabases
instance to be used to register newly createdStorageManager
instances.
Also see the description ingetDatabases()
.F
setRefactoringMappingProvider(PersistenceRefactoringMappingProvider refactoringMappingProvider)
Sets the passedPersistenceRefactoringMappingProvider
instance to theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.F
setRoot(Object root)
Registers the passed root instance as the root instance at theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.
UsesetRootSupplier(Supplier)
for a more dynamic approach, i.e.F
setRootResolverProvider(PersistenceRootResolverProvider rootResolverProvider)
Alias forF
setRootSupplier(Supplier<?> rootSupplier)
Registers the passed rootSupplierSupplier
as the root instance supplier at thePersistenceRootResolverProvider
instance provided byPersistenceFoundation.getRootResolverProvider()
of theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.F
setTypeEvaluatorPersistable(PersistenceTypeEvaluator typeEvaluatorPersistable)
default EmbeddedStorageManager
start()
Convenience method to create, start and return anEmbeddedStorageManager
instance using a default root instance.default EmbeddedStorageManager
start(Object explicitRoot)
Convenience method to create, start and return anEmbeddedStorageManager
instance using the passed explicitRootMethods inherited from interface one.microstream.storage.types.StorageFoundation
createStorageSystem, getBackupThreadProvider, getChannelCreator, getChannelThreadProvider, getConfiguration, getDataChunkValidatorProvider, getDataChunkValidatorProvider2, getDataFileValidatorCreator, getEntityDataIteratorProvider, getEntityDataValidatorCreator, getEntityMarkMonitorCreator, getEventLogger, getExceptionHandler, getGCZombieOidHandler, getHousekeepingBroker, getInitialDataFileNumberProvider, getLockFileManagerCreator, getLockFileManagerThreadProvider, getLockFileSetup, getLockFileSetupProvider, getObjectIdRangeEvaluator, getOidMarkQueueCreator, getOperationControllerCreator, getProcessIdentityProvider, getRequestAcceptorCreator, getRequestTaskCreator, getRootOidSelectorProvider, getRootTypeIdProvider, getTaskBrokerCreator, getThreadNameProvider, getThreadProvider, getTimestampProvider, getTypeDictionary, getWriteController, getWriterProvider, housekeepingBroker, setBackupThreadProvider, setChannelCreator, setChannelThreadProvider, setConfiguration, setDataChunkValidatorProvider, setDataChunkValidatorProvider2, setDataFileValidatorCreator, setEntityDataIteratorProvider, setEntityDataValidatorCreator, setEntityMarkMonitorCreator, setEventLogger, setExceptionHandler, setGCZombieOidHandler, setHousekeepingBroker, setInitialDataFileNumberProvider, setLockFileManagerCreator, setLockFileManagerThreadProvider, setLockFileSetup, setLockFileSetupProvider, setObjectIdRangeEvaluator, setOidMarkQueueCreator, setOperationControllerCreator, setProcessIdentityProvider, setRequestAcceptorCreator, setRootOidSelectorProvider, setRootTypeIdProvider, setTaskBrokerCreator, setTaskCreator, setThreadNameProvider, setThreadProvider, setTimestampProvider, setTypeDictionary, setWriteController, setWriterProvider, writeController
-
Method Details
-
getConnectionFoundation
EmbeddedStorageConnectionFoundation<?> getConnectionFoundation()Returns the currently setStorageConfiguration
instance.If no instance is set and the implementation deems an instance of this type mandatory for the successful executon of
createEmbeddedStorageManager()
, a suitable instance is created via an internal default creation logic and then set as the current. If the implementation has not sufficient logic and/or data to create a default instance, aMissingFoundationPartException
is thrown.- Returns:
- the currently set instance, potentially created on-demand if required.
- Throws:
MissingFoundationPartException
- if a returnable instance is required but cannot be created by default.
-
getDatabases
Databases getDatabases()The register ofDatabase
s whereStorageManager
instances created by this foundation instance will be registered. By default, this is the global singleton returned byDatabases.get()
, but it can be set to any arbitraryDatabases
instances by callingsetDatabases(Databases)
.- Returns:
- the
Databases
instance used to register newly createdStorageManager
instances. - See Also:
setDatabases(Databases)
,setDataBaseName(String)
,getDataBaseName()
-
getDataBaseName
String getDataBaseName()A name uniquely identifying theDatabase
whereStorageManager
instances created by this foundation will belong to. If no arbitrary name has been set by callingsetDataBaseName(String)
, a generic name is derived using the storage location.- Returns:
- a name uniquely identifying the
Database
to be used. - See Also:
setDataBaseName(String)
,setDatabases(Databases)
,getDatabases()
-
getRootResolverProvider
PersistenceRootResolverProvider getRootResolverProvider()Returns the internalEmbeddedStorageConnectionFoundation
instance'sPersistenceRootResolverProvider
instance. If none is present so far, a new default one is created.- Returns:
- the
PersistenceRootResolverProvider
instance to be used.
-
getTypeEvaluatorPersistable
PersistenceTypeEvaluator getTypeEvaluatorPersistable() -
onConnectionFoundation
Executes the passed logic on theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.This is a mere utility method to allow more concise syntax and multi-layered method chaining.
- Parameters:
logic
- the logic to be executed.- Returns:
- this to allow method chaining.
-
onThis
Executes the passed logic on this.This is a mere utility method to allow more concise syntax and multi-layered method chaining.
- Parameters:
logic
- the logic to be executed.- Returns:
- this to allow method chaining.
-
createEmbeddedStorageManager
Creates and returns a newEmbeddedStorageManager
instance by using the current state of all registered logic part instances and by on-demand creating missing ones via a default logic.Alias for
return this.createEmbeddedStorageManager(null);
The returned
EmbeddedStorageManager
instance will NOT yet be started.- Returns:
- a new
EmbeddedStorageManager
instance. - See Also:
createEmbeddedStorageManager(Object)
,start()
,start(Object)
-
createEmbeddedStorageManager
Creates and returns a newEmbeddedStorageManager
instance by using the current state of all registered logic part instances and by on-demand creating missing ones via a default logic.If the passed explicitRoot is null, a default root instance will be created, see
StorageManager.defaultRoot()
.The returned
EmbeddedStorageManager
instance will NOT yet be started.- Parameters:
explicitRoot
- the instance to be used as the persistent entity graph's root instance.- Returns:
- a new
EmbeddedStorageManager
instance. - See Also:
createEmbeddedStorageManager()
,start()
,start(Object)
-
start
Convenience method to create, start and return anEmbeddedStorageManager
instance using a default root instance.- Returns:
- a new
EmbeddedStorageManager
instance. - See Also:
start(Object)
,createEmbeddedStorageManager()
,createEmbeddedStorageManager(Object)
-
start
Convenience method to create, start and return anEmbeddedStorageManager
instance using the passed explicitRootBy default, it is an alias for:
EmbeddedStorageManager esm = this.createEmbeddedStorageManager(explicitRoot);
esm.start();
return esm;
- Parameters:
explicitRoot
- the instance to be used as the persistent entity graph's root instance.- Returns:
- a new
EmbeddedStorageManager
instance. - See Also:
start()
,createEmbeddedStorageManager()
,createEmbeddedStorageManager(Object)
-
setConnectionFoundation
Sets theEmbeddedStorageConnectionFoundation
instance to be used for the assembly.- Parameters:
connectionFoundation
- the instance to be used.- Returns:
- this to allow method chaining.
-
setDatabases
Sets theDatabases
instance to be used to register newly createdStorageManager
instances.
Also see the description ingetDatabases()
.- Parameters:
databases
- theDatabases
instance used to register newly createdStorageManager
instances.- Returns:
- this to allow method chaining.
- See Also:
getDatabases()
,getDataBaseName()
,setDataBaseName(String)
-
setDataBaseName
Sets the name uniquely identifying theDatabase
to be used.
Also see the description ingetDataBaseName()
.- Parameters:
dataBaseName
- the name of theDatabase
to be used- Returns:
- this to allow method chaining.
-
setRoot
Registers the passed root instance as the root instance at theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.
UsesetRootSupplier(Supplier)
for a more dynamic approach, i.e. if the actual root instance must be created after setting up and creating theEmbeddedStorageManager
.- Parameters:
root
- the instance to be used as the persistent entity graph's root instance.- Returns:
- this to allow method chaining.
- See Also:
setRootSupplier(Supplier)
,setRootResolverProvider(PersistenceRootResolverProvider)
,PersistenceFoundation.setRootResolverProvider(PersistenceRootResolverProvider)
-
setRootSupplier
Registers the passed rootSupplierSupplier
as the root instance supplier at thePersistenceRootResolverProvider
instance provided byPersistenceFoundation.getRootResolverProvider()
of theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.This means this method is merely an alias for
.onConnectionFoundation(f -> f.getRootResolverProvider().registerCustomRootSupplier(rootSupplier);
) }Note that replacing the
PersistenceRootResolverProvider
instance, for example via #setRootResolverProvider, will nullify the changes made via this method.The actual root instance will be queried during startup, not before.
This technique allows a more dynamic approach thansetRoot(Object)
, i.e. if the actual root instance must be created after setting up and creating theEmbeddedStorageManager
.- Parameters:
rootSupplier
- the supplying logic to obtain the instance to be used during startup as the persistent entity graph's root instance.- Returns:
- this to allow method chaining.
- See Also:
EmbeddedStorageManager.start()
,setRoot(Object)
,setRootResolverProvider(PersistenceRootResolverProvider)
,PersistenceFoundation.setRootResolverProvider(PersistenceRootResolverProvider)
-
setRootResolverProvider
Alias for.onConnectionFoundation(f -> f.setRootResolverProvider(rootResolverProvider);
) }PersistenceRootResolverProvider
instance to be used in the internalEmbeddedStorageConnectionFoundation
.- Parameters:
rootResolverProvider
- thePersistenceRootResolverProvider
to be set.- Returns:
- this to allow method chaining.
- See Also:
setRootSupplier(Supplier)
,PersistenceFoundation.setRootResolverProvider(PersistenceRootResolverProvider)
-
setTypeEvaluatorPersistable
-
setRefactoringMappingProvider
Sets the passedPersistenceRefactoringMappingProvider
instance to theEmbeddedStorageConnectionFoundation
instance provided bygetConnectionFoundation()
.- Parameters:
refactoringMappingProvider
- the instance to be used.- Returns:
- this to allow method chaining.
- See Also:
PersistenceFoundation.setRefactoringMappingProvider(PersistenceRefactoringMappingProvider)
-
executeTypeHandlerRegistration
F executeTypeHandlerRegistration(PersistenceTypeHandlerRegistration<Binary> typeHandlerRegistration)Convenience method forthis.getConnectionFoundation().executeTypeHandlerRegistration(typeHandlerRegistration)
.See
PersistenceFoundation.executeTypeHandlerRegistration(PersistenceTypeHandlerRegistration)
for details.- Parameters:
typeHandlerRegistration
- thePersistenceTypeHandlerRegistration
to be executed.- Returns:
- this to allow method chaining.
-
registerTypeHandler
-
registerTypeHandlers
-
New
Pseudo-constructor method to create a newEmbeddedStorageFoundation
instance with default implementation.- Returns:
- a new
EmbeddedStorageFoundation
instance.
-