org.mule.lifecycle
Class DefaultLifecyclePhase

java.lang.Object
  extended by org.mule.lifecycle.DefaultLifecyclePhase
All Implemented Interfaces:
LifecyclePhase
Direct Known Subclasses:
ContainerManagedLifecyclePhase, MuleContextDisposePhase, MuleContextStartPhase, MuleContextStopPhase, NotInLifecyclePhase

public class DefaultLifecyclePhase
extends Object
implements LifecyclePhase

Represents a configurable lifecycle phase. This is a default implementation of a 'generic phase' in that is can be configured to represnt any phase. Instances of this phase can then be registered with a LifecycleManager and by used to enforce a lifecycle phase on an object. Usually, Lifecycle phases have a fixed configuration in which case a specialisation of this class should be created that initialises its configuration internally.

Note that this class and LifecycleTransitionResult both make assumptions about the interfaces used - the return values and exceptions. These are, currently, that the return value is either void or LifecycleTransitionResult and either 0 or 1 exceptions can be thrown which are either InstantiationException or LifecycleException.

See Also:
LifecyclePhase

Field Summary
protected  Log logger
           
 
Fields inherited from interface org.mule.api.lifecycle.LifecyclePhase
ALL_PHASES
 
Constructor Summary
DefaultLifecyclePhase(String name, Class lifecycleClass, String oppositeLifecyclePhase)
           
 
Method Summary
 void addOrderedLifecycleObject(LifecycleObject lco)
           
 void applyLifecycle(Collection objects, String currentPhase)
           
 void applyLifecycle(Object o)
           
 Class[] getIgnoredObjectTypes()
           
 Class getLifecycleClass()
           
 String getName()
           
 String getOppositeLifecyclePhase()
           
 Set getOrderedLifecycleObjects()
           
 Set getSupportedPhases()
           
protected  boolean ignoreType(Class type)
           
 boolean isPhaseSupported(String phase)
           
 void registerSupportedPhase(String phase)
           
 void removeOrderedLifecycleObject(LifecycleObject lco)
           
 void setIgnoredObjectTypes(Class[] ignorredObjectTypes)
           
 void setLifecycleClass(Class lifecycleClass)
           
 void setOrderedLifecycleObjects(Set orderedLifecycleObjects)
           
 void setSupportedPhases(Set supportedPhases)
           
protected  List sortLifecycleInstances(Collection objects, LifecycleObject lo)
          Subclasses can override this method to order objects before the lifecycle method is applied to them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger
Constructor Detail

DefaultLifecyclePhase

public DefaultLifecyclePhase(String name,
                             Class lifecycleClass,
                             String oppositeLifecyclePhase)
Method Detail

applyLifecycle

public void applyLifecycle(Collection objects,
                           String currentPhase)
                    throws MuleException
Specified by:
applyLifecycle in interface LifecyclePhase
Throws:
MuleException

sortLifecycleInstances

protected List sortLifecycleInstances(Collection objects,
                                      LifecycleObject lo)
Subclasses can override this method to order objects before the lifecycle method is applied to them. This method does not apply any special ordering to objects.

Parameters:
objects -
lo -
Returns:
List with ordered objects

addOrderedLifecycleObject

public void addOrderedLifecycleObject(LifecycleObject lco)
Specified by:
addOrderedLifecycleObject in interface LifecyclePhase

removeOrderedLifecycleObject

public void removeOrderedLifecycleObject(LifecycleObject lco)
Specified by:
removeOrderedLifecycleObject in interface LifecyclePhase

ignoreType

protected boolean ignoreType(Class type)

getOrderedLifecycleObjects

public Set getOrderedLifecycleObjects()
Specified by:
getOrderedLifecycleObjects in interface LifecyclePhase

setOrderedLifecycleObjects

public void setOrderedLifecycleObjects(Set orderedLifecycleObjects)
Specified by:
setOrderedLifecycleObjects in interface LifecyclePhase

getIgnoredObjectTypes

public Class[] getIgnoredObjectTypes()
Specified by:
getIgnoredObjectTypes in interface LifecyclePhase

setIgnoredObjectTypes

public void setIgnoredObjectTypes(Class[] ignorredObjectTypes)
Specified by:
setIgnoredObjectTypes in interface LifecyclePhase

getLifecycleClass

public Class getLifecycleClass()
Specified by:
getLifecycleClass in interface LifecyclePhase

setLifecycleClass

public void setLifecycleClass(Class lifecycleClass)
Specified by:
setLifecycleClass in interface LifecyclePhase

getName

public String getName()
Specified by:
getName in interface LifecyclePhase

getSupportedPhases

public Set getSupportedPhases()
Specified by:
getSupportedPhases in interface LifecyclePhase

setSupportedPhases

public void setSupportedPhases(Set supportedPhases)
Specified by:
setSupportedPhases in interface LifecyclePhase

registerSupportedPhase

public void registerSupportedPhase(String phase)
Specified by:
registerSupportedPhase in interface LifecyclePhase

isPhaseSupported

public boolean isPhaseSupported(String phase)
Specified by:
isPhaseSupported in interface LifecyclePhase

applyLifecycle

public void applyLifecycle(Object o)
                    throws LifecycleException
Specified by:
applyLifecycle in interface LifecyclePhase
Throws:
LifecycleException

getOppositeLifecyclePhase

public String getOppositeLifecyclePhase()
Specified by:
getOppositeLifecyclePhase in interface LifecyclePhase


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.