HOLDER - the concrete target system type for fluent API supportpublic abstract class AbstractTargetSystem<HOLDER extends AbstractTargetSystem<HOLDER>>
extends java.lang.Object
implements io.flamingock.api.external.TargetSystem, io.flamingock.internal.common.core.context.ContextProvider, io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER>
Provides common functionality for managing target-system-specific context, including dependencies and properties that will be available to changes during execution.
Subclasses should override enhanceExecutionRuntime(ExecutionRuntime, boolean)
to inject session-scoped dependencies (e.g., database connections, client sessions)
that are obtained fresh for each change execution.
| Modifier and Type | Field and Description |
|---|---|
protected io.flamingock.internal.common.core.context.Context |
targetSystemContext |
| Constructor and Description |
|---|
AbstractTargetSystem(java.lang.String id) |
| Modifier and Type | Method and Description |
|---|---|
HOLDER |
addDependency(java.lang.Class<?> type,
java.lang.Object instance) |
HOLDER |
addDependency(java.lang.Object instance) |
HOLDER |
addDependency(java.lang.String name,
java.lang.Class<?> type,
java.lang.Object instance) |
HOLDER |
addDependency(java.lang.String name,
java.lang.Object instance) |
<T> T |
applyChange(java.util.function.Function<ExecutionRuntime,T> changeApplier,
ExecutionRuntime executionRuntime)
Applies a change operation with session-scoped dependency injection.
|
protected void |
enhanceExecutionRuntime(ExecutionRuntime executionRuntime,
boolean isTransactional)
Hook for injecting session-scoped dependencies into the execution runtime.
|
io.flamingock.internal.common.core.context.ContextResolver |
getContext() |
java.lang.String |
getId() |
protected abstract HOLDER |
getSelf() |
<T> T |
rollbackChange(java.util.function.Function<ExecutionRuntime,T> changeRollbacker,
ExecutionRuntime executionRuntime)
Rolls back (reverts) a previously applied change with session-scoped dependency injection.
|
HOLDER |
setProperty(io.flamingock.internal.util.Property property) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Boolean value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Boolean[] value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Byte[] value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Character[] value) |
HOLDER |
setProperty(java.lang.String key,
java.nio.charset.Charset value) |
HOLDER |
setProperty(java.lang.String key,
java.util.Currency value) |
HOLDER |
setProperty(java.lang.String key,
java.util.Date value) |
HOLDER |
setProperty(java.lang.String key,
java.sql.Date value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Double value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Double[] value) |
HOLDER |
setProperty(java.lang.String key,
java.time.Duration value) |
HOLDER |
setProperty(java.lang.String key,
java.io.File value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Float value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Float[] value) |
HOLDER |
setProperty(java.lang.String key,
java.net.InetAddress value) |
HOLDER |
setProperty(java.lang.String key,
java.time.Instant value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Integer value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Integer[] value) |
HOLDER |
setProperty(java.lang.String key,
java.time.LocalDate value) |
HOLDER |
setProperty(java.lang.String key,
java.time.LocalDateTime value) |
HOLDER |
setProperty(java.lang.String key,
java.util.Locale value) |
HOLDER |
setProperty(java.lang.String key,
java.time.LocalTime value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Long value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Long[] value) |
HOLDER |
setProperty(java.lang.String key,
java.time.OffsetDateTime value) |
HOLDER |
setProperty(java.lang.String key,
java.time.OffsetTime value) |
HOLDER |
setProperty(java.lang.String key,
java.nio.file.Path value) |
HOLDER |
setProperty(java.lang.String key,
java.time.Period value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.Short[] value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.String value) |
HOLDER |
setProperty(java.lang.String key,
java.lang.String[] value) |
<T extends java.lang.Enum<T>> |
setProperty(java.lang.String key,
T value) |
HOLDER |
setProperty(java.lang.String key,
java.sql.Time value) |
HOLDER |
setProperty(java.lang.String key,
java.sql.Timestamp value) |
HOLDER |
setProperty(java.lang.String key,
java.net.URI value) |
HOLDER |
setProperty(java.lang.String key,
java.net.URL value) |
HOLDER |
setProperty(java.lang.String key,
java.util.UUID value) |
HOLDER |
setProperty(java.lang.String key,
java.time.ZonedDateTime value) |
protected final io.flamingock.internal.common.core.context.Context targetSystemContext
public java.lang.String getId()
getId in interface io.flamingock.api.external.ExternalSystemprotected abstract HOLDER getSelf()
public final <T> T applyChange(java.util.function.Function<ExecutionRuntime,T> changeApplier, ExecutionRuntime executionRuntime)
This method is the entry point for non-transactional change execution.
It calls enhanceExecutionRuntime(ExecutionRuntime, boolean) to allow
subclasses to inject session-scoped dependencies before executing the change.
T - the return type of the change operationchangeApplier - the function that executes the actual changeexecutionRuntime - the runtime context for dependency resolutionpublic final <T> T rollbackChange(java.util.function.Function<ExecutionRuntime,T> changeRollbacker, ExecutionRuntime executionRuntime)
This method is the entry point for non-transactional rollback execution.
It calls enhanceExecutionRuntime(ExecutionRuntime, boolean) to allow
subclasses to inject session-scoped dependencies before executing the rollback.
T - the return type of the rollback operationchangeRollbacker - the function that executes the actual rollbackexecutionRuntime - the runtime context for dependency resolutionprotected void enhanceExecutionRuntime(ExecutionRuntime executionRuntime, boolean isTransactional)
Subclasses should override this method to inject resources that need to be obtained fresh for each change execution, such as:
The isTransactional parameter indicates whether the change will be
applied within a transaction, allowing different dependencies to be injected
based on the execution context.
executionRuntime - the runtime to enhance with dependenciesisTransactional - true if the change will run in a transaction, false otherwisepublic io.flamingock.internal.common.core.context.ContextResolver getContext()
getContext in interface io.flamingock.internal.common.core.context.ContextProviderpublic HOLDER addDependency(java.lang.String name, java.lang.Class<?> type, java.lang.Object instance)
addDependency in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER addDependency(java.lang.Object instance)
addDependency in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER addDependency(java.lang.String name, java.lang.Object instance)
addDependency in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER addDependency(java.lang.Class<?> type, java.lang.Object instance)
addDependency in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(io.flamingock.internal.util.Property property)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.String value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Boolean value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Integer value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Float value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Long value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Double value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.util.UUID value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.util.Currency value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.util.Locale value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.nio.charset.Charset value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.io.File value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.nio.file.Path value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.net.InetAddress value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.net.URL value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.net.URI value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.Duration value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.Period value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.Instant value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.LocalDate value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.LocalTime value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.LocalDateTime value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.ZonedDateTime value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.OffsetDateTime value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.time.OffsetTime value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.util.Date value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.sql.Date value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.sql.Time value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.sql.Timestamp value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.String[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Integer[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Long[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Double[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Float[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Boolean[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Byte[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Short[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public HOLDER setProperty(java.lang.String key, java.lang.Character[] value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>public <T extends java.lang.Enum<T>> HOLDER setProperty(java.lang.String key, T value)
setProperty in interface io.flamingock.internal.common.core.context.ContextConfigurable<HOLDER extends AbstractTargetSystem<HOLDER>>