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>
A kind of factory type that holds and creates on demand all the parts that form anEmbeddedStorageManager
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 theEmbeddedStorageManager
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.default 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.EmbeddedStorageManager
createEmbeddedStorageManager(Supplier<?> rootSupplier)
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.PersistenceRootResolverProvider
getRootResolverProvider()
Returns the internalEmbeddedStorageConnectionFoundation
instance'sPersistenceRootResolverProvider
instance.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
setConnectionFoundation(EmbeddedStorageConnectionFoundation<?> connectionFoundation)
Sets theEmbeddedStorageConnectionFoundation
instance to be used for the assembly.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()
.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 explicitRoot-
Methods inherited from interface one.microstream.storage.types.StorageFoundation
createStorageManager, getBackupThreadProvider, getChannelCreator, getChannelThreadProvider, getConfiguration, getDataChunkValidatorProvider, getDataChunkValidatorProvider2, getDataFileValidatorCreator, getEntityDataIteratorProvider, getEntityDataValidatorCreator, getEntityMarkMonitorCreator, getExceptionHandler, getGCZombieOidHandler, getInitialDataFileNumberProvider, getLockFileManagerCreator, getLockFileManagerThreadProvider, getLockFileSetup, getLockFileSetupProvider, getObjectIdRangeEvaluator, getOidMarkQueueCreator, getOperationControllerCreator, getProcessIdentityProvider, getReaderProvider, getRequestAcceptorCreator, getRequestTaskCreator, getRootOidSelectorProvider, getRootTypeIdProvider, getTaskBrokerCreator, getThreadProvider, getTimestampProvider, getTypeDictionary, getWriterProvider, setBackupThreadProvider, setChannelCreator, setChannelThreadProvider, setConfiguration, setDataChunkValidatorProvider, setDataChunkValidatorProvider2, setDataFileValidatorCreator, setEntityDataIteratorProvider, setEntityDataValidatorCreator, setEntityMarkMonitorCreator, setExceptionHandler, setGCZombieOidHandler, setInitialDataFileNumberProvider, setLockFileManagerCreator, setLockFileManagerThreadProvider, setLockFileSetup, setLockFileSetupProvider, setObjectIdRangeEvaluator, setOidMarkQueueCreator, setOperationControllerCreator, setProcessIdentityProvider, setReaderProvider, setRequestAcceptorCreator, setRootOidSelectorProvider, setRootTypeIdProvider, setTaskBrokerCreator, setTaskCreator, setThreadProvider, setTimestampProvider, setTypeDictionary, setWriterProvider
-
-
-
-
Method Detail
-
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.
-
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.
-
onConnectionFoundation
F onConnectionFoundation(Consumer<? super EmbeddedStorageConnectionFoundation<?>> logic)
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
F onThis(Consumer<? super EmbeddedStorageFoundation<?>> logic)
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
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.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
default 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.If the passed explicitRoot is null, a default root instance will be created, see
EmbeddedStorageManager.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()
,createEmbeddedStorageManager(Supplier)
,start()
,start(Object)
-
createEmbeddedStorageManager
EmbeddedStorageManager createEmbeddedStorageManager(Supplier<?> rootSupplier)
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 rootSupplier is null, a default root instance will be created, see
EmbeddedStorageManager.defaultRoot()
. Otherwise, it will be used to resolve the root instance to be used duringstart()
. This indirection is necessary if the actual root instance is not yet available at the time theEmbeddedStorageManager
is created, but will be at the timestart()
is called.The returned
EmbeddedStorageManager
instance will NOT yet be started.- Parameters:
rootSupplier
- an indirection logic to later supply the instance to be used as the persistent entity graph's root instance.- Returns:
- a new
EmbeddedStorageManager
instance. - See Also:
createEmbeddedStorageManager()
,createEmbeddedStorageManager(Object)
,start()
,start(Object)
-
start
default EmbeddedStorageManager 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
default EmbeddedStorageManager start(Object explicitRoot)
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
F setConnectionFoundation(EmbeddedStorageConnectionFoundation<?> connectionFoundation)
Sets theEmbeddedStorageConnectionFoundation
instance to be used for the assembly.- Parameters:
connectionFoundation
- the instance to be used.- Returns:
- this to allow method chaining.
-
setRoot
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. 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(PersistenceRootResolver)
,EmbeddedStorageConnectionFoundation#setRootResolverProvider(PersistenceRootResolver)
-
setRootSupplier
F setRootSupplier(Supplier<?> rootSupplier)
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(PersistenceRootResolver)
,EmbeddedStorageConnectionFoundation#setRootResolverProvider(PersistenceRootResolver)
,EmbeddedStorageConnectionFoundation#registerCustomRootSupplier(PersistenceRootResolver)
-
setRootResolverProvider
F setRootResolverProvider(PersistenceRootResolverProvider rootResolverProvider)
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)
,EmbeddedStorageConnectionFoundation#setRootResolverProvider(PersistenceRootResolver)
-
setRefactoringMappingProvider
F setRefactoringMappingProvider(PersistenceRefactoringMappingProvider refactoringMappingProvider)
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.
-
New
static EmbeddedStorageFoundation<?> New()
Pseudo-constructor method to create a newEmbeddedStorageFoundation
instance with default implementation.- Returns:
- a new
EmbeddedStorageFoundation
instance.
-
-