O - The object type being managed by this LifecycleManagerpublic abstract class AbstractLifecycleManager<O> extends Object implements LifecycleManager
LifecycleManager interface
and provides almost all the plumbing required to write a LifecycleManager
implementation. This class handles the tracking ofg the phases, transition validation and
checking state.| Modifier and Type | Field and Description |
|---|---|
protected Set<String> |
completedPhases |
protected String |
currentPhase |
protected String |
executingPhase |
protected String |
lifecycleManagerId |
protected org.apache.commons.logging.Log |
logger
logger used by this class
|
protected O |
object |
protected Set<String> |
phaseNames |
protected LifecycleState |
state |
NOT_IN_LIFECYCLE_PHASE| Constructor and Description |
|---|
AbstractLifecycleManager(String id,
O object) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDirectTransition(String phase1,
String phase2) |
void |
checkPhase(String name)
Will check that the phase passed in is a valid next phase for this lifecycle manager.
|
protected LifecycleState |
createLifecycleState() |
void |
fireLifecycle(String phase)
Applies lifecycle phase to a collection of objects.
|
String |
getCurrentPhase()
The current phase for the lifecycle manager.
|
String |
getExecutingPhase()
Returns the lifecycle phase being executed.
|
O |
getLifecycleObject() |
LifecycleState |
getState()
Provides access to a state machine for this lifecycle manager.
|
protected void |
invokePhase(String phase,
Object object,
LifecycleCallback callback) |
boolean |
isDirectTransition(String destinationPhase) |
protected boolean |
isDirectTransition(String startPhase,
String endPhase) |
boolean |
isPhaseComplete(String phaseName)
Checks that a phase has completed
|
protected void |
notifyTransition(String phase)
Allows any for any state adjustments in sub classes.
|
void |
registerLifecycleCallback(String phaseName,
LifecycleCallback<O> callback) |
protected abstract void |
registerTransitions() |
void |
reset()
Reset the lifecycle manager state back to 'not in lifecycle' phase
|
protected void |
setCurrentPhase(String currentPhase) |
protected void |
setExecutingPhase(String executingPhase) |
protected final transient org.apache.commons.logging.Log logger
protected String lifecycleManagerId
protected String currentPhase
protected String executingPhase
protected O object
protected LifecycleState state
protected abstract void registerTransitions()
public void registerLifecycleCallback(String phaseName, LifecycleCallback<O> callback)
protected LifecycleState createLifecycleState()
public void checkPhase(String name) throws IllegalStateException
LifecycleManagercheckPhase in interface LifecycleManagername - The name of the lifecycle to validate as a valid next transitionIllegalStateException - if the lifecycle name is not recognised or the phase is not valid for the current lifecycle statepublic O getLifecycleObject()
public void fireLifecycle(String phase) throws LifecycleException
LifecycleManagerfireLifecycle in interface LifecycleManagerphase - that phase to execute nextLifecycleException - if the phase is not a valid transition of does not exist on this lifecycle managerprotected void invokePhase(String phase, Object object, LifecycleCallback callback) throws LifecycleException
LifecycleExceptionpublic boolean isDirectTransition(String destinationPhase)
isDirectTransition in interface LifecycleManagerpublic String getCurrentPhase()
LifecycleManagerLifecycleManager.getExecutingPhase() to get the phase being executed.getCurrentPhase in interface LifecycleManagerprotected void setCurrentPhase(String currentPhase)
public String getExecutingPhase()
LifecycleManagergetExecutingPhase in interface LifecycleManagerprotected void setExecutingPhase(String executingPhase)
protected void notifyTransition(String phase)
phase - the currently completed phasepublic void reset()
LifecycleManagerreset in interface LifecycleManagerpublic boolean isPhaseComplete(String phaseName)
LifecycleManagerisPhaseComplete in interface LifecycleManagerphaseName - the name of the pahse to check forpublic LifecycleState getState()
LifecycleManagergetState in interface LifecycleManagerCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.