Interface EmbeddedStorageFoundation<F extends EmbeddedStorageFoundation<?>>
- Type Parameters:
F- the "self-type" of theEmbeddedStorageManagerimplementation.
- All Superinterfaces:
StorageFoundation<F>
- All Known Implementing Classes:
EmbeddedStorageFoundation.Default
public interface EmbeddedStorageFoundation<F extends EmbeddedStorageFoundation<?>> extends StorageFoundation<F>
EmbeddedStorageManagerinstance, 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 classEmbeddedStorageFoundation.Default<F extends EmbeddedStorageFoundation.Default<?>> -
Method Summary
Modifier and Type Method Description default EmbeddedStorageManagercreateEmbeddedStorageManager()Creates and returns a newEmbeddedStorageManagerinstance by using the current state of all registered logic part instances and by on-demand creating missing ones via a default logic.EmbeddedStorageManagercreateEmbeddedStorageManager(Object explicitRoot)Creates and returns a newEmbeddedStorageManagerinstance by using the current state of all registered logic part instances and by on-demand creating missing ones via a default logic.FexecuteTypeHandlerRegistration(PersistenceTypeHandlerRegistration<Binary> typeHandlerRegistration)Convenience method forthis.getConnectionFoundation().executeTypeHandlerRegistration(typeHandlerRegistration).EmbeddedStorageConnectionFoundation<?>getConnectionFoundation()Returns the currently setStorageConfigurationinstance.StringgetDataBaseName()A name uniquely identifying theDatabasewhereStorageManagerinstances created by this foundation will belong to.DatabasesgetDatabases()The register ofDatabases whereStorageManagerinstances created by this foundation instance will be registered.PersistenceRootResolverProvidergetRootResolverProvider()Returns the internalEmbeddedStorageConnectionFoundationinstance'sPersistenceRootResolverProviderinstance.PersistenceTypeEvaluatorgetTypeEvaluatorPersistable()static EmbeddedStorageFoundation<?>New()Pseudo-constructor method to create a newEmbeddedStorageFoundationinstance with default implementation.FonConnectionFoundation(Consumer<? super EmbeddedStorageConnectionFoundation<?>> logic)Executes the passed logic on theEmbeddedStorageConnectionFoundationinstance provided bygetConnectionFoundation().FonThis(Consumer<? super EmbeddedStorageFoundation<?>> logic)Executes the passed logic on this.FregisterTypeHandler(PersistenceTypeHandler<Binary,?> typeHandler)FregisterTypeHandlers(Iterable<? extends PersistenceTypeHandler<Binary,?>> typeHandlers)FsetConnectionFoundation(EmbeddedStorageConnectionFoundation<?> connectionFoundation)Sets theEmbeddedStorageConnectionFoundationinstance to be used for the assembly.FsetDataBaseName(String dataBaseName)Sets the name uniquely identifying theDatabaseto be used.
Also see the description ingetDataBaseName().FsetDatabases(Databases databases)Sets theDatabasesinstance to be used to register newly createdStorageManagerinstances.
Also see the description ingetDatabases().FsetRefactoringMappingProvider(PersistenceRefactoringMappingProvider refactoringMappingProvider)Sets the passedPersistenceRefactoringMappingProviderinstance to theEmbeddedStorageConnectionFoundationinstance provided bygetConnectionFoundation().FsetRoot(Object root)Registers the passed root instance as the root instance at theEmbeddedStorageConnectionFoundationinstance provided bygetConnectionFoundation().
UsesetRootSupplier(Supplier)for a more dynamic approach, i.e.FsetRootResolverProvider(PersistenceRootResolverProvider rootResolverProvider)Alias forFsetRootSupplier(Supplier<?> rootSupplier)Registers the passed rootSupplierSupplieras the root instance supplier at thePersistenceRootResolverProviderinstance provided byPersistenceFoundation.getRootResolverProvider()of theEmbeddedStorageConnectionFoundationinstance provided bygetConnectionFoundation().FsetTypeEvaluatorPersistable(PersistenceTypeEvaluator typeEvaluatorPersistable)default EmbeddedStorageManagerstart()Convenience method to create, start and return anEmbeddedStorageManagerinstance using a default root instance.default EmbeddedStorageManagerstart(Object explicitRoot)Convenience method to create, start and return anEmbeddedStorageManagerinstance 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 setStorageConfigurationinstance.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, aMissingFoundationPartExceptionis 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 ofDatabases whereStorageManagerinstances 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 arbitraryDatabasesinstances by callingsetDatabases(Databases).- Returns:
- the
Databasesinstance used to register newly createdStorageManagerinstances. - See Also:
setDatabases(Databases),setDataBaseName(String),getDataBaseName()
-
getDataBaseName
String getDataBaseName()A name uniquely identifying theDatabasewhereStorageManagerinstances 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
Databaseto be used. - See Also:
setDataBaseName(String),setDatabases(Databases),getDatabases()
-
getRootResolverProvider
PersistenceRootResolverProvider getRootResolverProvider()Returns the internalEmbeddedStorageConnectionFoundationinstance'sPersistenceRootResolverProviderinstance. If none is present so far, a new default one is created.- Returns:
- the
PersistenceRootResolverProviderinstance to be used.
-
getTypeEvaluatorPersistable
PersistenceTypeEvaluator getTypeEvaluatorPersistable() -
onConnectionFoundation
Executes the passed logic on theEmbeddedStorageConnectionFoundationinstance 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 newEmbeddedStorageManagerinstance 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
EmbeddedStorageManagerinstance will NOT yet be started.- Returns:
- a new
EmbeddedStorageManagerinstance. - See Also:
createEmbeddedStorageManager(Object),start(),start(Object)
-
createEmbeddedStorageManager
Creates and returns a newEmbeddedStorageManagerinstance 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
EmbeddedStorageManagerinstance will NOT yet be started.- Parameters:
explicitRoot- the instance to be used as the persistent entity graph's root instance.- Returns:
- a new
EmbeddedStorageManagerinstance. - See Also:
createEmbeddedStorageManager(),start(),start(Object)
-
start
Convenience method to create, start and return anEmbeddedStorageManagerinstance using a default root instance.- Returns:
- a new
EmbeddedStorageManagerinstance. - See Also:
start(Object),createEmbeddedStorageManager(),createEmbeddedStorageManager(Object)
-
start
Convenience method to create, start and return anEmbeddedStorageManagerinstance 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
EmbeddedStorageManagerinstance. - See Also:
start(),createEmbeddedStorageManager(),createEmbeddedStorageManager(Object)
-
setConnectionFoundation
Sets theEmbeddedStorageConnectionFoundationinstance to be used for the assembly.- Parameters:
connectionFoundation- the instance to be used.- Returns:
- this to allow method chaining.
-
setDatabases
Sets theDatabasesinstance to be used to register newly createdStorageManagerinstances.
Also see the description ingetDatabases().- Parameters:
databases- theDatabasesinstance used to register newly createdStorageManagerinstances.- Returns:
- this to allow method chaining.
- See Also:
getDatabases(),getDataBaseName(),setDataBaseName(String)
-
setDataBaseName
Sets the name uniquely identifying theDatabaseto be used.
Also see the description ingetDataBaseName().- Parameters:
dataBaseName- the name of theDatabaseto be used- Returns:
- this to allow method chaining.
-
setRoot
Registers the passed root instance as the root instance at theEmbeddedStorageConnectionFoundationinstance 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 rootSupplierSupplieras the root instance supplier at thePersistenceRootResolverProviderinstance provided byPersistenceFoundation.getRootResolverProvider()of theEmbeddedStorageConnectionFoundationinstance provided bygetConnectionFoundation().This means this method is merely an alias for
.onConnectionFoundation(f -> f.getRootResolverProvider().registerCustomRootSupplier(rootSupplier);) }Note that replacing the
PersistenceRootResolverProviderinstance, 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
Sets the.onConnectionFoundation(f -> f.setRootResolverProvider(rootResolverProvider);) }PersistenceRootResolverProviderinstance to be used in the internalEmbeddedStorageConnectionFoundation.- Parameters:
rootResolverProvider- thePersistenceRootResolverProviderto be set.- Returns:
- this to allow method chaining.
- See Also:
setRootSupplier(Supplier),PersistenceFoundation.setRootResolverProvider(PersistenceRootResolverProvider)
-
setTypeEvaluatorPersistable
-
setRefactoringMappingProvider
Sets the passedPersistenceRefactoringMappingProviderinstance to theEmbeddedStorageConnectionFoundationinstance 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- thePersistenceTypeHandlerRegistrationto be executed.- Returns:
- this to allow method chaining.
-
registerTypeHandler
-
registerTypeHandlers
-
New
Pseudo-constructor method to create a newEmbeddedStorageFoundationinstance with default implementation.- Returns:
- a new
EmbeddedStorageFoundationinstance.
-