Class ObservableLifecycleRequestMachine<SRC>
java.lang.Object
org.refcodes.component.LifecycleMachine
org.refcodes.component.ext.observer.ObservableLifecycleRequestMachine<SRC>
- Type Parameters:
SRC- The source of the events consumed by theLifecycleRequestObserver.
- All Implemented Interfaces:
Destroyable, Destroyable.DestroyAutomaton, Initializable, Initializable.InitializeAutomaton, InitializedAccessor, LifecycleComponent, LifecycleComponent.LifecycleAutomaton, LifecycleStatusAccessor, Pausable, Pausable.PauseAutomaton, Resumable, Resumable.ResumeAutomaton, RunningAccessor, Startable, Startable.StartAutomaton, Stoppable, Stoppable.StopAutomaton, Observable<LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, EventMetaData, SRC>>
public class ObservableLifecycleRequestMachine<SRC>
extends LifecycleMachine
implements Observable<LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, EventMetaData, SRC>>
The
ObservableLifecycleRequestMachine extends the
LifecycleMachine with request ActionEvent functionality which
can be vetoed. The implementation is suffixed with "Machine" instead of
"Automaton" for differentiation with any interface of similar (same) name.-
Nested Class Summary
Nested classes/interfaces inherited from class LifecycleMachine
LifecycleMachine.ManualLifecycleMachineNested classes/interfaces inherited from interface Destroyable
Destroyable.DestroyAutomatonNested classes/interfaces inherited from interface Initializable
Initializable.InitializeAutomaton, Initializable.InitializeBuilder<B>, Initializable.UncheckedInitializableNested classes/interfaces inherited from interface InitializedAccessor
InitializedAccessor.InitializedMutator, InitializedAccessor.InitializedPropertyNested classes/interfaces inherited from interface LifecycleComponent
LifecycleComponent.LifecycleAutomaton, LifecycleComponent.UncheckedLifecycleComponentNested classes/interfaces inherited from interface LifecycleStatusAccessor
LifecycleStatusAccessor.LifecycleStatusBuilder<B>, LifecycleStatusAccessor.LifecycleStatusMutator, LifecycleStatusAccessor.LifecycleStatusPropertyNested classes/interfaces inherited from interface Pausable
Pausable.PauseAutomaton, Pausable.PauseBuilder<B>, Pausable.UncheckedPausableNested classes/interfaces inherited from interface Resumable
Resumable.ResumeAutomaton, Resumable.ResumeBuilder<B>, Resumable.UncheckedResumableNested classes/interfaces inherited from interface RunningAccessor
RunningAccessor.RunningMutator, RunningAccessor.RunningPropertyNested classes/interfaces inherited from interface Startable
Startable.StartAutomaton, Startable.StartBuilder<B>, Startable.UncheckedStartableNested classes/interfaces inherited from interface Stoppable
Stoppable.StopAutomaton, Stoppable.StopBuilder<B>, Stoppable.UncheckedStoppable -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData, SRC aSource) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, SRC aSource) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(EventMetaData aEventMetaData) Instantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(EventMetaData aEventMetaData, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(EventMetaData aEventMetaData, SRC aSource) Instantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(SRC aSource) Instantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()booleanhasObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, EventMetaData, SRC> aObserver) voidvoidpause()voidresume()voidstart()voidstop()booleansubscribeObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, EventMetaData, SRC> aObserver) booleanMethods inherited from class LifecycleMachine
getLifecycleComponent, getLifecycleStatus, isDestroyable, isDestroyed, isInitalizable, isInitialized, isPausable, isPaused, isResumable, isRunning, isStartable, isStoppable, isStopped, setLifecycleStatusMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Initializable
initializeUncheckedMethods inherited from interface Pausable
pauseUncheckedMethods inherited from interface Resumable
resumeUncheckedMethods inherited from interface Startable
startUncheckedMethods inherited from interface Stoppable
stopUnchecked
-
Constructor Details
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine()Instantiates a newObservableLifecycleRequestMachine. -
ObservableLifecycleRequestMachine
Instantiates a newObservableLifecycleRequestMachine.- Parameters:
aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.
-
ObservableLifecycleRequestMachine
Instantiates a newObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.
-
ObservableLifecycleRequestMachine
Instantiates a newObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.
-
ObservableLifecycleRequestMachine
Instantiates the classObservableLifecycleRequestMachine.- See Also:
-
ObservableLifecycleRequestMachine
Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.- See Also:
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.- See Also:
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData, SRC aSource) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData. * *aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.- See Also:
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(EventMetaData aEventMetaData, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used).aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used). * *aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).- See Also:
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aSource- The source instance to be used when firing events in case the source is to be different from this class' instance. * *aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used). * *aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).- See Also:
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData. * *aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used). * *aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).- See Also:
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(LifecycleComponent aLifecycleComponent, EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, ExecutionStrategy aExecutionStrategy) Instantiates the classObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData. * *aSource- The source instance to be used when firing events in case the source is to be different from this class' instance. * *aExecutorService- The executor service to be used when firingActionEventinstances in multiple threads (if null then a default one is used). * *aExecutionStrategy- TheExecutionStrategyto be used when firingActionEventinstance (if null then the defaultExecutionStrategy.SEQUENTIALis used).- See Also:
-
-
Method Details
-
hasObserver
public boolean hasObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, EventMetaData, SRC> aObserver) - Specified by:
hasObserverin interfaceObservable<SRC>
-
subscribeObserver
public boolean subscribeObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, EventMetaData, SRC> aObserver) - Specified by:
subscribeObserverin interfaceObservable<SRC>
-
unsubscribeObserver
public boolean unsubscribeObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, EventMetaData, SRC> aObserver) - Specified by:
unsubscribeObserverin interfaceObservable<SRC>
-
initialize
- Specified by:
initializein interfaceInitializable- Overrides:
initializein classLifecycleMachine- Throws:
InitializeException
-
start
- Specified by:
startin interfaceStartable- Overrides:
startin classLifecycleMachine- Throws:
StartException
-
pause
- Specified by:
pausein interfacePausable- Overrides:
pausein classLifecycleMachine- Throws:
PauseException
-
resume
- Specified by:
resumein interfaceResumable- Overrides:
resumein classLifecycleMachine- Throws:
ResumeException
-
stop
- Specified by:
stopin interfaceStoppable- Overrides:
stopin classLifecycleMachine- Throws:
StopException
-
destroy
public void destroy()- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classLifecycleMachine
-