All Implemented Interfaces:
All Known Implementing Classes:
A Chain represents a configured list of
Command s that will be executed in order to perform processing
on a specified Context . Each included Command will be
executed in turn, until either one of them returns
one of the executed Command s throws an exception,
or the end of the chain has been reached. The Chain itself will
return the return value of the last Command that was executed
(if no exception was thrown), or rethrow the thrown exception.
Note that Chain extends Command , so that the two can be used interchangeably when a Command is expected. This makes it easy to assemble workflows in a hierarchical manner by combining subchains into an overall processing chain.
To protect applications from evolution of this interface, specialized implementations of Chain should generally be created by extending the provided base class org.apache.commons.chain.impl.ChainBase ) rather than directly implementing this interface.
Chain implementations should be designed in a thread-safe
manner, suitable for execution on multiple threads simultaneously. In
general, this implies that the state information identifying which
Command is currently being executed should be maintained in a
local variable inside the
execute() method, rather than
in an instance variable. The Command s in a Chain may be
configured (via calls to
addCommand()) at any time before
execute() method of the Chain is first called.
After that, the configuration of the Chain is frozen.
Craig- R. McClanahan
$- Revision: 480477 $ $Date: 2006-11-29 08:34:52 +0000 (Wed, 29 Nov 2006) $
|Method from org.apache.commons.chain.Chain Summary:|
|Method from org.apache.commons.chain.Chain Detail:|
public void addCommand(Command command)
public boolean execute(Context context) throws Exception
Execute the processing represented by this Chain according to the following algorithm.