|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.lifecycle.AbstractLifecycleManager<O>
O - The object type being managed by this LifecycleManagerpublic abstract class AbstractLifecycleManager<O>
This is a base implementation of the 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.
| Field Summary | |
|---|---|
protected Set<String> |
completedPhases
|
protected String |
currentPhase
|
protected String |
executingPhase
|
protected String |
lifecycleManagerId
|
protected Log |
logger
logger used by this class |
protected O |
object
|
protected Set<String> |
phaseNames
|
protected LifecycleState |
state
|
| Fields inherited from interface org.mule.api.lifecycle.LifecycleManager |
|---|
NOT_IN_LIFECYCLE_PHASE |
| Constructor Summary | |
|---|---|
AbstractLifecycleManager(String id,
O object)
|
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final transient Log logger
protected String lifecycleManagerId
protected String currentPhase
protected String executingPhase
protected Set<String> phaseNames
protected Set<String> completedPhases
protected O object
protected LifecycleState state
| Constructor Detail |
|---|
public AbstractLifecycleManager(String id,
O object)
| Method Detail |
|---|
protected abstract void registerTransitions()
public void registerLifecycleCallback(String phaseName,
LifecycleCallback<O> callback)
protected LifecycleState createLifecycleState()
protected void addDirectTransition(String phase1,
String phase2)
public void checkPhase(String name)
throws IllegalStateException
LifecycleManager
checkPhase in interface LifecycleManagername - The name of the lifecycle to validate as a valid next transition
IllegalStateException - 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
LifecycleManager
fireLifecycle in interface LifecycleManagerphase - that phase to execute next
LifecycleException - if the phase is not a valid transition of does not exist on this lifecycle manager
protected void invokePhase(String phase,
Object object,
LifecycleCallback callback)
throws LifecycleException
LifecycleExceptionpublic boolean isDirectTransition(String destinationPhase)
isDirectTransition in interface LifecycleManager
protected boolean isDirectTransition(String startPhase,
String endPhase)
public String getCurrentPhase()
LifecycleManagerLifecycleManager.getExecutingPhase() to get the phase being executed.
getCurrentPhase in interface LifecycleManagerprotected void setCurrentPhase(String currentPhase)
public String getExecutingPhase()
LifecycleManager
getExecutingPhase in interface LifecycleManagerprotected void setExecutingPhase(String executingPhase)
protected void notifyTransition(String phase)
phase - the currently completed phasepublic void reset()
LifecycleManager
reset in interface LifecycleManagerpublic boolean isPhaseComplete(String phaseName)
LifecycleManager
isPhaseComplete in interface LifecycleManagerphaseName - the name of the pahse to check for
public LifecycleState getState()
LifecycleManager
getState in interface LifecycleManager
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||