org.mule.lifecycle
Class RegistryLifecycleManager

java.lang.Object
  extended by org.mule.lifecycle.RegistryLifecycleManager
All Implemented Interfaces:
LifecycleManager
Direct Known Subclasses:
MuleContextLifecycleManager

public class RegistryLifecycleManager
extends Object
implements LifecycleManager


Field Summary
protected  Set completedPhases
           
protected  String currentPhase
           
protected  String executingPhase
           
protected  List<LifecyclePair> lifecyclePairs
           
protected static NotInLifecyclePhase notInLifecyclePhase
           
protected  LifecycleState state
           
protected  Set transitions
           
 
Constructor Summary
RegistryLifecycleManager()
           
 
Method Summary
 void applyCompletedPhases(Object object)
          Successively applies all completed lifecycle phase to an object.
 void applyPhase(Object object, String phase)
          Applies lifecycle phase to an object independent of the current lifecycle phase.
 void checkPhase(String name)
           
protected  void doApplyPhase(Registry registry, String phase)
           
 void fireLifecycle(Registry registry, String phase)
          Applies lifecycle phase to a collection of objects.
 void firePhase(MuleContext muleContext, String phase)
          Applies lifecycle phase to all objects in the Registry.
 String getCurrentPhase()
          The current phase for the lifecycle manager.
 String getExecutingPhase()
          Returns the name of the currently executing phase or null if there is not current phase.
 List<LifecyclePair> getLifecyclePairs()
          The lifecycle pairs that will be invoked by this lifecycle manager
protected  LifecyclePhase getPhaseForIndex(int phaseIndex)
           
protected  int getPhaseIndex(String phase)
           
protected  List<LifecyclePhase> getPhasesIndex()
           
 LifecycleState getState()
          Provides access to a state machine for this lifecycle manager.
 boolean isPhaseComplete(String phaseName)
           
protected  LifecyclePhase lookupPhase(String phase)
           
 void registerLifecycle(LifecyclePair lifecyclePair)
          Register a lifecycle pair that will be invoked by this lifecycle manager The order in which the lifecycle pairs are registered will be the order in which the life cycle phases will be invoked the LifecyclePair.getBegin() phases will be called in order, the LifecyclePair.getEnd() will be called in opposite order.
 void reset()
          Reset the lifecycle manager state back to 'not in lifecycle' phase
protected  void setCurrentPhase(LifecyclePhase phase)
           
protected  void setExecutingPhase(String phase)
           
 void setLifecyclePairs(List<LifecyclePair> lifecyclePairs)
          The lifecycle pairs that will be invoked by this lifecycle manager The order the list will be the order in which the life cycle phases will be invoked the LifecyclePair.getBegin() phases will be called in order, the LifecyclePair.getEnd() will be called in opposite order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

notInLifecyclePhase

protected static final NotInLifecyclePhase notInLifecyclePhase

currentPhase

protected String currentPhase

executingPhase

protected String executingPhase

completedPhases

protected Set completedPhases

transitions

protected Set transitions

lifecyclePairs

protected List<LifecyclePair> lifecyclePairs

state

protected LifecycleState state
Constructor Detail

RegistryLifecycleManager

public RegistryLifecycleManager()
Method Detail

getLifecyclePairs

public List<LifecyclePair> getLifecyclePairs()
Description copied from interface: LifecycleManager
The lifecycle pairs that will be invoked by this lifecycle manager

Specified by:
getLifecyclePairs in interface LifecycleManager
Returns:
The lifecycle pairs that will be invoked by this lifecycle manager

setLifecyclePairs

public void setLifecyclePairs(List<LifecyclePair> lifecyclePairs)
Description copied from interface: LifecycleManager
The lifecycle pairs that will be invoked by this lifecycle manager The order the list will be the order in which the life cycle phases will be invoked the LifecyclePair.getBegin() phases will be called in order, the LifecyclePair.getEnd() will be called in opposite order. i.e. call initialise first and dispose last.

Specified by:
setLifecyclePairs in interface LifecycleManager
Parameters:
lifecyclePairs - The lifecycle pairs that will be invoked by this lifecycle manager

registerLifecycle

public void registerLifecycle(LifecyclePair lifecyclePair)
Description copied from interface: LifecycleManager
Register a lifecycle pair that will be invoked by this lifecycle manager The order in which the lifecycle pairs are registered will be the order in which the life cycle phases will be invoked the LifecyclePair.getBegin() phases will be called in order, the LifecyclePair.getEnd() will be called in opposite order. i.e. call initialise first and dispose last.

Specified by:
registerLifecycle in interface LifecycleManager
Parameters:
lifecyclePair - a lifecycle pair that will be invoked by this lifecycle manager

firePhase

public void firePhase(MuleContext muleContext,
                      String phase)
               throws MuleException
Applies lifecycle phase to all objects in the Registry.

Throws:
MuleException

getPhasesIndex

protected List<LifecyclePhase> getPhasesIndex()

getPhaseIndex

protected int getPhaseIndex(String phase)

getPhaseForIndex

protected LifecyclePhase getPhaseForIndex(int phaseIndex)

doApplyPhase

protected void doApplyPhase(Registry registry,
                            String phase)
                     throws MuleException
Throws:
MuleException

applyPhase

public void applyPhase(Object object,
                       String phase)
                throws MuleException
Description copied from interface: LifecycleManager
Applies lifecycle phase to an object independent of the current lifecycle phase. All phases between the current phase and the 'endPhase' will be executed.

Specified by:
applyPhase in interface LifecycleManager
Throws:
MuleException

fireLifecycle

public void fireLifecycle(Registry registry,
                          String phase)
                   throws MuleException
Description copied from interface: LifecycleManager
Applies lifecycle phase to a collection of objects.

Specified by:
fireLifecycle in interface LifecycleManager
Throws:
MuleException

getCurrentPhase

public String getCurrentPhase()
Description copied from interface: LifecycleManager
The current phase for the lifecycle manager. While in transition this will reflect the last completed phase not the currently executing phase, use LifecycleManager.getExecutingPhase() to get the phase being executed.

Specified by:
getCurrentPhase in interface LifecycleManager
Returns:
The current completed phase for the lifecycle manager

getExecutingPhase

public String getExecutingPhase()
Returns the name of the currently executing phase or null if there is not current phase.

Specified by:
getExecutingPhase in interface LifecycleManager
Returns:
the lifecycle phase being executed

setCurrentPhase

protected void setCurrentPhase(LifecyclePhase phase)

setExecutingPhase

protected void setExecutingPhase(String phase)

reset

public void reset()
Description copied from interface: LifecycleManager
Reset the lifecycle manager state back to 'not in lifecycle' phase

Specified by:
reset in interface LifecycleManager

isPhaseComplete

public boolean isPhaseComplete(String phaseName)
Specified by:
isPhaseComplete in interface LifecycleManager

applyCompletedPhases

public void applyCompletedPhases(Object object)
                          throws MuleException
Description copied from interface: LifecycleManager
Successively applies all completed lifecycle phase to an object.

Specified by:
applyCompletedPhases in interface LifecycleManager
Throws:
MuleException

checkPhase

public void checkPhase(String name)
                throws IllegalStateException
Specified by:
checkPhase in interface LifecycleManager
Throws:
IllegalStateException

lookupPhase

protected LifecyclePhase lookupPhase(String phase)
                              throws IllegalArgumentException
Throws:
IllegalArgumentException

getState

public LifecycleState getState()
Description copied from interface: LifecycleManager
Provides access to a state machine for this lifecycle manager. components in the registry can use this to assert lifecycle rather than managing thier own lifecycle state

Specified by:
getState in interface LifecycleManager
Returns:
A state machine for this lifecycle manager


Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.