jfun.yan.lifecycle
Class DefaultLifecycleDescriptor

java.lang.Object
  extended by jfun.yan.lifecycle.DefaultLifecycleDescriptor

public class DefaultLifecycleDescriptor
extends java.lang.Object

The descriptor for a typically used life-cycle scheme with "init", "verify", "dispose", "start", "stop", "open", "close" supported.

Zephyr Business Solution

Author:
Michelle Lei

Field Summary
static java.lang.String DEFAULT_CLOSER_NAME
          The default key of the close phase.
static java.lang.String DEFAULT_DISPOSER_NAME
          The default key of the dispose phase.
static java.lang.String DEFAULT_INITIALIZER_NAME
          The default key of the init phase.
static java.lang.String DEFAULT_OPENER_NAME
          The default key of the open phase.
static java.lang.String DEFAULT_STARTER_NAME
          The default key of the start phase.
static java.lang.String DEFAULT_STOPPER_NAME
          The default key of the stop phase.
static java.lang.String DEFAULT_VERIFIER_NAME
          The default key of the verify phase.
 
Constructor Summary
DefaultLifecycleDescriptor()
           To create a LifecycleDescriptor object.
 
Method Summary
 void close(LifecycleManager lm)
          To invoke the "close" phase for the objects stored in the LifecycleManager object.
 DefaultLifecycleDescriptor closer(Lifecycle lc, Procedure proc)
          To register the "close" phase into a Lifecycle object.
The phase allows re-entry.
 DefaultLifecycleDescriptor closer(Lifecycle lc, Procedure proc, boolean reentrant)
          To register the "close" phase into a Lifecycle object.
 void dispose(LifecycleManager lm)
          To invoke the "dispose" phase for the objects stored in the LifecycleManager object.
 DefaultLifecycleDescriptor disposer(Lifecycle lc, Procedure proc)
          To register the "dispose" phase into a Lifecycle object.
The phase ignores re-entry.
 DefaultLifecycleDescriptor disposer(Lifecycle lc, Procedure proc, boolean reentrant)
          To register the "dispose" phase into a Lifecycle object.
 Phase getCloser()
          To get the "closer" phase.
 Phase getDisposer()
          To get the "disposer" phase.
 Phase getInitializer()
          To get the "init" phase.
 Phase getOpener()
          To get the "open" phase.
 Phase getStarter()
          To get the "start" phase.
 Phase getStopper()
          To get the "stop" phase.
 Phase getVerifier()
          To get the "verify" phase.
 void init(LifecycleManager lm)
          To invoke the "init" phase for the objects stored in the LifecycleManager object.
 DefaultLifecycleDescriptor initializer(Lifecycle lc, Procedure proc)
          To register the "init" phase into a Lifecycle object.
The phase ignores re-entry.
 DefaultLifecycleDescriptor initializer(Lifecycle lc, Procedure proc, boolean reentrant)
          To register the "init" phase into a Lifecycle object.
 void open(LifecycleManager lm)
          To invoke the "open" phase for the objects stored in the LifecycleManager object.
 DefaultLifecycleDescriptor opener(Lifecycle lc, Procedure proc)
          To register the "open" phase into a Lifecycle object.
The phase allows re-entry.
 DefaultLifecycleDescriptor opener(Lifecycle lc, Procedure proc, boolean reentrant)
          To register the "open" phase into a Lifecycle object.
 void setCloser(Phase closer)
          To set the "close" phase.
 void setDisposer(Phase disposer)
          To set the "dispose" phase.
 void setInitializer(Phase initializer)
          To set the "init" phase.
 void setOpener(Phase opener)
          To set the "open" phase.
 void setStarter(Phase starter)
          To set the "start" phase.
 void setStopper(Phase stopper)
          To set the "stop" phase.
 void setVerifier(Phase verifier)
          To set the "verify" phase.
 void start(LifecycleManager lm)
          To invoke the "start" phase for the objects stored in the LifecycleManager object.
 DefaultLifecycleDescriptor starter(Lifecycle lc, Procedure proc)
          To register the "start" phase into a Lifecycle object.
The phase allows re-entry.
 DefaultLifecycleDescriptor starter(Lifecycle lc, Procedure proc, boolean reentrant)
          To register the "start" phase into a Lifecycle object.
 void stop(LifecycleManager lm)
          To invoke the "stop" phase for the objects stored in the LifecycleManager object.
 DefaultLifecycleDescriptor stopper(Lifecycle lc, Procedure proc)
          To register the "stop" phase into a Lifecycle object.
The phase allows re-entry.
 DefaultLifecycleDescriptor stopper(Lifecycle lc, Procedure proc, boolean reentrant)
          To register the "stop" phase into a Lifecycle object.
 DefaultLifecycleDescriptor verifier(Lifecycle lc, Procedure proc)
          To register the "verify" phase into a Lifecycle object.
The phase allows re-entry.
 DefaultLifecycleDescriptor verifier(Lifecycle lc, Procedure proc, boolean reentrant)
          To register the "verify" phase into a Lifecycle object.
 void verify(LifecycleManager lm)
          To invoke the "verify" phase for the objects stored in the LifecycleManager object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_OPENER_NAME

public static final java.lang.String DEFAULT_OPENER_NAME
The default key of the open phase.

See Also:
Constant Field Values

DEFAULT_CLOSER_NAME

public static final java.lang.String DEFAULT_CLOSER_NAME
The default key of the close phase.

See Also:
Constant Field Values

DEFAULT_INITIALIZER_NAME

public static final java.lang.String DEFAULT_INITIALIZER_NAME
The default key of the init phase.

See Also:
Constant Field Values

DEFAULT_VERIFIER_NAME

public static final java.lang.String DEFAULT_VERIFIER_NAME
The default key of the verify phase.

See Also:
Constant Field Values

DEFAULT_DISPOSER_NAME

public static final java.lang.String DEFAULT_DISPOSER_NAME
The default key of the dispose phase.

See Also:
Constant Field Values

DEFAULT_STARTER_NAME

public static final java.lang.String DEFAULT_STARTER_NAME
The default key of the start phase.

See Also:
Constant Field Values

DEFAULT_STOPPER_NAME

public static final java.lang.String DEFAULT_STOPPER_NAME
The default key of the stop phase.

See Also:
Constant Field Values
Constructor Detail

DefaultLifecycleDescriptor

public DefaultLifecycleDescriptor()

To create a LifecycleDescriptor object.

By default, init, open, start phases are initialized with the default key and a exception printer that prints exception thrown out of the procedure to the System.err.
dispose, close, stop phases are initialized with the default key and a exception thrower that will stop the execution when any phase of any object fails.

Method Detail

open

public void open(LifecycleManager lm)
          throws java.lang.Throwable
To invoke the "open" phase for the objects stored in the LifecycleManager object.

Parameters:
lm - the LifecycleManager object.
Throws:
java.lang.Throwable - when any exception happens.

close

public void close(LifecycleManager lm)
           throws java.lang.Throwable
To invoke the "close" phase for the objects stored in the LifecycleManager object.

Parameters:
lm - the LifecycleManager object.
Throws:
java.lang.Throwable - when any exception happens.

init

public void init(LifecycleManager lm)
          throws java.lang.Throwable
To invoke the "init" phase for the objects stored in the LifecycleManager object.

Parameters:
lm - the LifecycleManager object.
Throws:
java.lang.Throwable - when any exception happens.

dispose

public void dispose(LifecycleManager lm)
             throws java.lang.Throwable
To invoke the "dispose" phase for the objects stored in the LifecycleManager object.

Parameters:
lm - the LifecycleManager object.
Throws:
java.lang.Throwable - when any exception happens.

verify

public void verify(LifecycleManager lm)
            throws java.lang.Throwable
To invoke the "verify" phase for the objects stored in the LifecycleManager object.

Parameters:
lm - the LifecycleManager object.
Throws:
java.lang.Throwable - when any exception happens.

start

public void start(LifecycleManager lm)
           throws java.lang.Throwable
To invoke the "start" phase for the objects stored in the LifecycleManager object.

Parameters:
lm - the LifecycleManager object.
Throws:
java.lang.Throwable - when any exception happens.

stop

public void stop(LifecycleManager lm)
          throws java.lang.Throwable
To invoke the "stop" phase for the objects stored in the LifecycleManager object.

Parameters:
lm - the LifecycleManager object.
Throws:
java.lang.Throwable - when any exception happens.

opener

public DefaultLifecycleDescriptor opener(Lifecycle lc,
                                         Procedure proc,
                                         boolean reentrant)
To register the "open" phase into a Lifecycle object.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
reentrant - whether the phase is reentrant.
Returns:
this LifecycleDescriptor object itself.

closer

public DefaultLifecycleDescriptor closer(Lifecycle lc,
                                         Procedure proc,
                                         boolean reentrant)
To register the "close" phase into a Lifecycle object.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
reentrant - whether the phase is reentrant.
Returns:
this LifecycleDescriptor object itself.

initializer

public DefaultLifecycleDescriptor initializer(Lifecycle lc,
                                              Procedure proc,
                                              boolean reentrant)
To register the "init" phase into a Lifecycle object.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
reentrant - whether the phase is reentrant.
Returns:
this LifecycleDescriptor object itself.

disposer

public DefaultLifecycleDescriptor disposer(Lifecycle lc,
                                           Procedure proc,
                                           boolean reentrant)
To register the "dispose" phase into a Lifecycle object.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
reentrant - whether the phase is reentrant.
Returns:
this LifecycleDescriptor object itself.

verifier

public DefaultLifecycleDescriptor verifier(Lifecycle lc,
                                           Procedure proc,
                                           boolean reentrant)
To register the "verify" phase into a Lifecycle object.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
reentrant - whether the phase is reentrant.
Returns:
this LifecycleDescriptor object itself.

starter

public DefaultLifecycleDescriptor starter(Lifecycle lc,
                                          Procedure proc,
                                          boolean reentrant)
To register the "start" phase into a Lifecycle object.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
reentrant - whether the phase is reentrant.
Returns:
this LifecycleDescriptor object itself.

stopper

public DefaultLifecycleDescriptor stopper(Lifecycle lc,
                                          Procedure proc,
                                          boolean reentrant)
To register the "stop" phase into a Lifecycle object.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
reentrant - whether the phase is reentrant.
Returns:
this LifecycleDescriptor object itself.

opener

public DefaultLifecycleDescriptor opener(Lifecycle lc,
                                         Procedure proc)
To register the "open" phase into a Lifecycle object.
The phase allows re-entry.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
Returns:
this LifecycleDescriptor object itself.

closer

public DefaultLifecycleDescriptor closer(Lifecycle lc,
                                         Procedure proc)
To register the "close" phase into a Lifecycle object.
The phase allows re-entry.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
Returns:
this LifecycleDescriptor object itself.

initializer

public DefaultLifecycleDescriptor initializer(Lifecycle lc,
                                              Procedure proc)
To register the "init" phase into a Lifecycle object.
The phase ignores re-entry.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
Returns:
this LifecycleDescriptor object itself.

disposer

public DefaultLifecycleDescriptor disposer(Lifecycle lc,
                                           Procedure proc)
To register the "dispose" phase into a Lifecycle object.
The phase ignores re-entry.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
Returns:
this LifecycleDescriptor object itself.

verifier

public DefaultLifecycleDescriptor verifier(Lifecycle lc,
                                           Procedure proc)
To register the "verify" phase into a Lifecycle object.
The phase allows re-entry.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
Returns:
this LifecycleDescriptor object itself.

starter

public DefaultLifecycleDescriptor starter(Lifecycle lc,
                                          Procedure proc)
To register the "start" phase into a Lifecycle object.
The phase allows re-entry.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
Returns:
this LifecycleDescriptor object itself.

stopper

public DefaultLifecycleDescriptor stopper(Lifecycle lc,
                                          Procedure proc)
To register the "stop" phase into a Lifecycle object.
The phase allows re-entry.

Parameters:
lc - the Lifecycle object.
proc - the Procedure for the phase.
Returns:
this LifecycleDescriptor object itself.

getCloser

public Phase getCloser()
To get the "closer" phase.


setCloser

public void setCloser(Phase closer)
To set the "close" phase.

Parameters:
closer - the phase.

getDisposer

public Phase getDisposer()
To get the "disposer" phase.


setDisposer

public void setDisposer(Phase disposer)
To set the "dispose" phase.

Parameters:
disposer - the phase.

getInitializer

public Phase getInitializer()
To get the "init" phase.


setInitializer

public void setInitializer(Phase initializer)
To set the "init" phase.

Parameters:
initializer - the phase.

getOpener

public Phase getOpener()
To get the "open" phase.


setOpener

public void setOpener(Phase opener)
To set the "open" phase.

Parameters:
opener - the phase.

getStarter

public Phase getStarter()
To get the "start" phase.


setStarter

public void setStarter(Phase starter)
To set the "start" phase.

Parameters:
starter - the phase.

getStopper

public Phase getStopper()
To get the "stop" phase.


setStopper

public void setStopper(Phase stopper)
To set the "stop" phase.

Parameters:
stopper - the phase.

getVerifier

public Phase getVerifier()
To get the "verify" phase.


setVerifier

public void setVerifier(Phase verifier)
To set the "verify" phase.

Parameters:
verifier - the phase.