S
- the type of stateE
- the type of eventpublic abstract class AbstractStateMachineFactory<S,E> extends LifecycleObjectSupport implements StateMachineFactory<S,E>, org.springframework.beans.factory.BeanNameAware
StateMachineFactory
implementation building StateMachine
s.Constructor and Description |
---|
AbstractStateMachineFactory(StateMachineModel<S,E> defaultStateMachineModel,
StateMachineModelFactory<S,E> stateMachineModelFactory)
Instantiates a new abstract state machine factory.
|
Modifier and Type | Method and Description |
---|---|
protected abstract RegionState<S,E> |
buildRegionStateInternal(S id,
java.util.Collection<Region<S,E>> regions,
java.util.Collection<E> deferred,
java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> entryActions,
java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> exitActions,
PseudoState<S,E> pseudoState,
StateMachineModel<S,E> stateMachineModel) |
protected abstract State<S,E> |
buildStateInternal(S id,
java.util.Collection<E> deferred,
java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> entryActions,
java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> exitActions,
java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> stateActions,
PseudoState<S,E> pseudoState,
StateMachineModel<S,E> stateMachineModel) |
protected abstract StateMachine<S,E> |
buildStateMachineInternal(java.util.Collection<State<S,E>> states,
java.util.Collection<Transition<S,E>> transitions,
State<S,E> initialState,
Transition<S,E> initialTransition,
org.springframework.messaging.Message<E> initialEvent,
ExtendedState extendedState,
PseudoState<S,E> historyState,
java.lang.Boolean contextEventsEnabled,
org.springframework.beans.factory.BeanFactory beanFactory,
java.lang.String beanName,
java.lang.String machineId,
java.util.UUID uuid,
StateMachineModel<S,E> stateMachineModel) |
StateMachine<S,E> |
getStateMachine()
Build a new
StateMachine instance. |
StateMachine<S,E> |
getStateMachine(java.lang.String machineId)
Build a new
StateMachine instance
with a given machine id. |
StateMachine<S,E> |
getStateMachine(java.util.UUID uuid)
Build a new
StateMachine instance
with a given machine uuid. |
StateMachine<S,E> |
getStateMachine(java.util.UUID uuid,
java.lang.String machineId)
Main constructor that create a
StateMachine . |
protected org.springframework.beans.factory.BeanFactory |
resolveBeanFactory(StateMachineModel<S,E> stateMachineModel) |
protected StateMachineModel<S,E> |
resolveStateMachineModel(java.lang.String machineId) |
void |
setBeanName(java.lang.String name) |
void |
setContextEventsEnabled(java.lang.Boolean contextEvents)
Instructs this factory to enable application context events.
|
void |
setHandleAutostartup(boolean handleAutostartup)
Instructs this factory to handle auto-start flag manually
by calling lifecycle start method.
|
void |
setStateMachineMonitor(StateMachineMonitor<S,E> stateMachineMonitor)
Set state machine monitor.
|
afterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, doPreStartReactively, doPreStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactively
public AbstractStateMachineFactory(StateMachineModel<S,E> defaultStateMachineModel, StateMachineModelFactory<S,E> stateMachineModelFactory)
defaultStateMachineModel
- the default state machine modelstateMachineModelFactory
- the state machine model factorypublic void setBeanName(java.lang.String name)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public StateMachine<S,E> getStateMachine()
StateMachineFactory
StateMachine
instance.getStateMachine
in interface StateMachineFactory<S,E>
public StateMachine<S,E> getStateMachine(java.lang.String machineId)
StateMachineFactory
StateMachine
instance
with a given machine id.getStateMachine
in interface StateMachineFactory<S,E>
machineId
- the machine idpublic StateMachine<S,E> getStateMachine(java.util.UUID uuid)
StateMachineFactory
StateMachine
instance
with a given machine uuid.getStateMachine
in interface StateMachineFactory<S,E>
uuid
- to be used internallypublic StateMachine<S,E> getStateMachine(java.util.UUID uuid, java.lang.String machineId)
StateMachine
.uuid
- for internal usage. Can be null, in that case a random one will be generated.machineId
- represent a user Id, up to you to set what you want.StateMachine
public void setHandleAutostartup(boolean handleAutostartup)
handleAutostartup
- the new handle autostartuppublic void setContextEventsEnabled(java.lang.Boolean contextEvents)
contextEvents
- the new context events enabledpublic void setStateMachineMonitor(StateMachineMonitor<S,E> stateMachineMonitor)
stateMachineMonitor
- the state machine monitorprotected org.springframework.beans.factory.BeanFactory resolveBeanFactory(StateMachineModel<S,E> stateMachineModel)
protected StateMachineModel<S,E> resolveStateMachineModel(java.lang.String machineId)
protected abstract StateMachine<S,E> buildStateMachineInternal(java.util.Collection<State<S,E>> states, java.util.Collection<Transition<S,E>> transitions, State<S,E> initialState, Transition<S,E> initialTransition, org.springframework.messaging.Message<E> initialEvent, ExtendedState extendedState, PseudoState<S,E> historyState, java.lang.Boolean contextEventsEnabled, org.springframework.beans.factory.BeanFactory beanFactory, java.lang.String beanName, java.lang.String machineId, java.util.UUID uuid, StateMachineModel<S,E> stateMachineModel)
protected abstract State<S,E> buildStateInternal(S id, java.util.Collection<E> deferred, java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> entryActions, java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> exitActions, java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> stateActions, PseudoState<S,E> pseudoState, StateMachineModel<S,E> stateMachineModel)
protected abstract RegionState<S,E> buildRegionStateInternal(S id, java.util.Collection<Region<S,E>> regions, java.util.Collection<E> deferred, java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> entryActions, java.util.Collection<java.util.function.Function<StateContext<S,E>,reactor.core.publisher.Mono<java.lang.Void>>> exitActions, PseudoState<S,E> pseudoState, StateMachineModel<S,E> stateMachineModel)