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:
org.refcodes.component.Destroyable, org.refcodes.component.Destroyable.DestroyAutomaton, org.refcodes.component.Initializable, org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.InitializedAccessor, org.refcodes.component.LifecycleComponent, org.refcodes.component.LifecycleComponent.LifecycleAutomaton, org.refcodes.component.LifecycleStatusAccessor, org.refcodes.component.Pausable, org.refcodes.component.Pausable.PauseAutomaton, org.refcodes.component.Resumable, org.refcodes.component.Resumable.ResumeAutomaton, org.refcodes.component.RunningAccessor, org.refcodes.component.Startable, org.refcodes.component.Startable.StartAutomaton, org.refcodes.component.Stoppable, org.refcodes.component.Stoppable.StopAutomaton, org.refcodes.observer.Observable<LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.EventMetaData, SRC>>
public class ObservableLifecycleRequestMachine<SRC>
extends org.refcodes.component.LifecycleMachine
implements org.refcodes.observer.Observable<LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.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 org.refcodes.component.LifecycleMachine
org.refcodes.component.LifecycleMachine.ManualLifecycleMachineNested classes/interfaces inherited from interface org.refcodes.component.Destroyable
org.refcodes.component.Destroyable.DestroyAutomatonNested classes/interfaces inherited from interface org.refcodes.component.Initializable
org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B>, org.refcodes.component.Initializable.UncheckedInitializableNested classes/interfaces inherited from interface org.refcodes.component.InitializedAccessor
org.refcodes.component.InitializedAccessor.InitializedMutator, org.refcodes.component.InitializedAccessor.InitializedPropertyNested classes/interfaces inherited from interface org.refcodes.component.LifecycleComponent
org.refcodes.component.LifecycleComponent.LifecycleAutomaton, org.refcodes.component.LifecycleComponent.UncheckedLifecycleComponentNested classes/interfaces inherited from interface org.refcodes.component.LifecycleStatusAccessor
org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusBuilder<B>, org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusMutator, org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusPropertyNested classes/interfaces inherited from interface org.refcodes.component.Pausable
org.refcodes.component.Pausable.PauseAutomaton, org.refcodes.component.Pausable.PauseBuilder<B>, org.refcodes.component.Pausable.UncheckedPausableNested classes/interfaces inherited from interface org.refcodes.component.Resumable
org.refcodes.component.Resumable.ResumeAutomaton, org.refcodes.component.Resumable.ResumeBuilder<B>, org.refcodes.component.Resumable.UncheckedResumableNested classes/interfaces inherited from interface org.refcodes.component.RunningAccessor
org.refcodes.component.RunningAccessor.RunningMutator, org.refcodes.component.RunningAccessor.RunningPropertyNested classes/interfaces inherited from interface org.refcodes.component.Startable
org.refcodes.component.Startable.StartAutomaton, org.refcodes.component.Startable.StartBuilder<B>, org.refcodes.component.Startable.UncheckedStartableNested classes/interfaces inherited from interface org.refcodes.component.Stoppable
org.refcodes.component.Stoppable.StopAutomaton, org.refcodes.component.Stoppable.StopBuilder<B>, org.refcodes.component.Stoppable.UncheckedStoppable -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, SRC aSource) ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, SRC aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) ObservableLifecycleRequestMachine(org.refcodes.observer.EventMetaData aEventMetaData) Instantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(org.refcodes.observer.EventMetaData aEventMetaData, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) ObservableLifecycleRequestMachine(org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource) Instantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) ObservableLifecycleRequestMachine(SRC aSource) Instantiates a newObservableLifecycleRequestMachine.ObservableLifecycleRequestMachine(SRC aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()booleanhasObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.EventMetaData, SRC> aObserver) voidvoidpause()voidresume()voidstart()voidstop()booleansubscribeObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.EventMetaData, SRC> aObserver) booleanunsubscribeObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.EventMetaData, SRC> aObserver) Methods inherited from class org.refcodes.component.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 org.refcodes.component.Initializable
initializeUncheckedMethods inherited from interface org.refcodes.component.Pausable
pauseUncheckedMethods inherited from interface org.refcodes.component.Resumable
resumeUncheckedMethods inherited from interface org.refcodes.component.Startable
startUncheckedMethods inherited from interface org.refcodes.component.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
public ObservableLifecycleRequestMachine(org.refcodes.observer.EventMetaData aEventMetaData) Instantiates a newObservableLifecycleRequestMachine.- Parameters:
aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource) 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
public ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, SRC aSource) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.aSource- The source instance to be used when firing events in case the source is to be different from this class' instance.
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.aEventMetaData- TheEventMetaDatato be used when firing events in case theEventMetaDatais to be different from the auto-generatedEventMetaData.
-
ObservableLifecycleRequestMachine
public ObservableLifecycleRequestMachine(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.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
public ObservableLifecycleRequestMachine(ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - 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, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - 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(org.refcodes.observer.EventMetaData aEventMetaData, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - 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(org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - 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(org.refcodes.component.LifecycleComponent aLifecycleComponent, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.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(org.refcodes.component.LifecycleComponent aLifecycleComponent, SRC aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.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(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.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(org.refcodes.component.LifecycleComponent aLifecycleComponent, org.refcodes.observer.EventMetaData aEventMetaData, SRC aSource, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) - Parameters:
aLifecycleComponent- TheLifecycleComponentto which the life-cycle method calls are to be delegated to.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).
-
-
Method Details
-
hasObserver
public boolean hasObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.EventMetaData, SRC> aObserver) - Specified by:
hasObserverin interfaceorg.refcodes.observer.Observable<SRC>
-
subscribeObserver
public boolean subscribeObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.EventMetaData, SRC> aObserver) - Specified by:
subscribeObserverin interfaceorg.refcodes.observer.Observable<SRC>
-
unsubscribeObserver
public boolean unsubscribeObserver(LifecycleRequestObserver<InitializeRequestedEvent<SRC>, StartRequestedEvent<SRC>, ResumeRequestedEvent<SRC>, PauseRequestedEvent<SRC>, StopRequestedEvent<SRC>, DestroyRequestedEvent<SRC>, org.refcodes.observer.EventMetaData, SRC> aObserver) - Specified by:
unsubscribeObserverin interfaceorg.refcodes.observer.Observable<SRC>
-
initialize
public void initialize() throws org.refcodes.component.InitializeException- Specified by:
initializein interfaceorg.refcodes.component.Initializable- Overrides:
initializein classorg.refcodes.component.LifecycleMachine- Throws:
org.refcodes.component.InitializeException
-
start
public void start() throws org.refcodes.component.StartException- Specified by:
startin interfaceorg.refcodes.component.Startable- Overrides:
startin classorg.refcodes.component.LifecycleMachine- Throws:
org.refcodes.component.StartException
-
pause
public void pause() throws org.refcodes.component.PauseException- Specified by:
pausein interfaceorg.refcodes.component.Pausable- Overrides:
pausein classorg.refcodes.component.LifecycleMachine- Throws:
org.refcodes.component.PauseException
-
resume
public void resume() throws org.refcodes.component.ResumeException- Specified by:
resumein interfaceorg.refcodes.component.Resumable- Overrides:
resumein classorg.refcodes.component.LifecycleMachine- Throws:
org.refcodes.component.ResumeException
-
stop
public void stop() throws org.refcodes.component.StopException- Specified by:
stopin interfaceorg.refcodes.component.Stoppable- Overrides:
stopin classorg.refcodes.component.LifecycleMachine- Throws:
org.refcodes.component.StopException
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.refcodes.component.Destroyable- Overrides:
destroyin classorg.refcodes.component.LifecycleMachine
-