|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.server.protocol.shared.chain.impl.ChainBase
Convenience base class for Chain
implementations.
Field Summary | |
protected Command[] |
commands
The list of Command s configured for this Chain , in
the order in which they may delegate processing to the remainder of
the Chain . |
protected boolean |
frozen
Flag indicating whether the configuration of our commands list has been frozen by a call to the execute() method. |
Constructor Summary | |
ChainBase()
Construct a Chain with no configured Command s. |
|
ChainBase(java.util.Collection commands)
Construct a Chain configured with the specified
Command s. |
|
ChainBase(Command command)
Construct a Chain configured with the specified
Command . |
|
ChainBase(Command[] commands)
Construct a Chain configured with the specified
Command s. |
Method Summary | |
void |
addCommand(Command command)
Add a Command to the list of Command s that will
be called in turn when this Chain 's execute()
method is called. |
boolean |
execute(Context context)
Execute the processing represented by this Chain according
to the following algorithm. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Command[] commands
The list of Command
s configured for this Chain
, in
the order in which they may delegate processing to the remainder of
the Chain
.
protected boolean frozen
Flag indicating whether the configuration of our commands list
has been frozen by a call to the execute()
method.
Constructor Detail |
public ChainBase()
public ChainBase(Command command)
Construct a Chain
configured with the specified
Command
.
command
- The Command
to be configured
java.lang.IllegalArgumentException
- if command
is null
public ChainBase(Command[] commands)
Construct a Chain
configured with the specified
Command
s.
commands
- The Command
s to be configured
java.lang.IllegalArgumentException
- if commands
,
or one of the individual Command
elements,
is null
public ChainBase(java.util.Collection commands)
Construct a Chain
configured with the specified
Command
s.
commands
- The Command
s to be configured
java.lang.IllegalArgumentException
- if commands
,
or one of the individual Command
elements,
is null
Method Detail |
public void addCommand(Command command)
Chain
Add a Command
to the list of Command
s that will
be called in turn when this Chain
's execute()
method is called. Once execute()
has been called
at least once, it is no longer possible to add additional
Command
s; instead, an exception will be thrown.
addCommand
in interface Chain
command
- The Command
to be addedpublic boolean execute(Context context) throws java.lang.Exception
Chain
Execute the processing represented by this Chain
according
to the following algorithm.
Command
s in the Chain
,
return false
.execute()
method of each Command
configured on this chain, in the order they were added via calls
to the addCommand()
method, until the end of the
configured Command
s is encountered, or until one of
the executed Command
s returns true
or throws an exception.Command
s whose
execute()
methods, starting with the last one that
was executed. If this Command
instance is also a
Filter
, call its postprocess()
method,
discarding any exception that is thrown.Command
whose execute()
method
was called threw an exception, rethrow that exception.execute()
method of the last Command
that was executed. This will be
true
if the last Command
indicated that
processing of this Context
has been completed, or
false
if none of the called Command
s
returned true
.
execute
in interface Chain
context
- The Context
to be processed by this
Chain
true
if the processing of this Context
has been completed, or false
if the processing
of this Context
should be delegated to a subsequent
Command
in an enclosing Chain
java.lang.Exception
- if thrown by one of the Command
s
in this Chain
but not handled by a postprocess()
method of a Filter
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |