jfun.yan.lifecycle
Class LifecycleManager

java.lang.Object
  extended by jfun.yan.lifecycle.LifecycleManager
Direct Known Subclasses:
DefaultLifecycleManager

public class LifecycleManager
extends java.lang.Object

This class manages life-cycle for component objects.

Zephyr Business Solution

Author:
Michelle Lei

Constructor Summary
LifecycleManager()
           
 
Method Summary
 void addLiveObject(LiveObject lo)
          Add a LiveObject into the lifecycle manager.
 void fifo(java.lang.Object key, java.lang.Object[] args, ExceptionHandler handler)
          Invoke a certain phase for all managed instances in the creation order.
 void filo(java.lang.Object key, java.lang.Object[] args, ExceptionHandler handler)
          Invoke a certain phase for all managed instances in the reverse order of creation.
 java.util.Set getManagedInstances()
          To get the managed LiveObject instances.
 Component withLifecycle(Component c, Life life)
          To create a Component object that enables life-cycle support.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifecycleManager

public LifecycleManager()
Method Detail

addLiveObject

public void addLiveObject(LiveObject lo)
Add a LiveObject into the lifecycle manager.

Parameters:
lo - the LifeObject instance.

withLifecycle

public Component withLifecycle(Component c,
                               Life life)
To create a Component object that enables life-cycle support.

Parameters:
c - the Component to enable life-cycle support.
life - the Life object.
Returns:
a new Component object that supports life-cycle.

getManagedInstances

public java.util.Set getManagedInstances()
To get the managed LiveObject instances.


fifo

public void fifo(java.lang.Object key,
                 java.lang.Object[] args,
                 ExceptionHandler handler)
          throws java.lang.Throwable
Invoke a certain phase for all managed instances in the creation order.

Parameters:
key - the key of the phase.
args - the arguments passed to the phase procedure.
handler - the exception handler.
Throws:
java.lang.Throwable - when any error happens.

filo

public void filo(java.lang.Object key,
                 java.lang.Object[] args,
                 ExceptionHandler handler)
          throws java.lang.Throwable
Invoke a certain phase for all managed instances in the reverse order of creation.

Parameters:
key - the key of the phase.
args - the arguments passed to the phase procedure.
handler - the exception handler.
Throws:
java.lang.Throwable - when any error happens.