org.apache.directory.server.protocol.shared.chain.impl
Class ChainBase

java.lang.Object
  extended by org.apache.directory.server.protocol.shared.chain.impl.ChainBase
All Implemented Interfaces:
Chain, Command
Direct Known Subclasses:
DomainNameServiceChain

public class ChainBase
extends java.lang.Object
implements Chain

Convenience base class for Chain implementations.

Version:
$Revision: 434432 $ $Date: 2006-08-24 18:52:26 +0200 (Thu, 24 Aug 2006) $
Author:
Apache Directory Project

Field Summary
protected  Command[] commands
          The list of Commands 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 Commands.
ChainBase(java.util.Collection commands)
          Construct a Chain configured with the specified Commands.
ChainBase(Command command)
          Construct a Chain configured with the specified Command.
ChainBase(Command[] commands)
          Construct a Chain configured with the specified Commands.
 
Method Summary
 void addCommand(Command command)
          Add a Command to the list of Commands 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

commands

protected Command[] commands

The list of Commands configured for this Chain, in the order in which they may delegate processing to the remainder of the Chain.


frozen

protected boolean frozen

Flag indicating whether the configuration of our commands list has been frozen by a call to the execute() method.

Constructor Detail

ChainBase

public ChainBase()

Construct a Chain with no configured Commands.


ChainBase

public ChainBase(Command command)

Construct a Chain configured with the specified Command.

Parameters:
command - The Command to be configured
Throws:
java.lang.IllegalArgumentException - if command is null

ChainBase

public ChainBase(Command[] commands)

Construct a Chain configured with the specified Commands.

Parameters:
commands - The Commands to be configured
Throws:
java.lang.IllegalArgumentException - if commands, or one of the individual Command elements, is null

ChainBase

public ChainBase(java.util.Collection commands)

Construct a Chain configured with the specified Commands.

Parameters:
commands - The Commands to be configured
Throws:
java.lang.IllegalArgumentException - if commands, or one of the individual Command elements, is null
Method Detail

addCommand

public void addCommand(Command command)
Description copied from interface: Chain

Add a Command to the list of Commands 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 Commands; instead, an exception will be thrown.

Specified by:
addCommand in interface Chain
Parameters:
command - The Command to be added

execute

public boolean execute(Context context)
                throws java.lang.Exception
Description copied from interface: Chain

Execute the processing represented by this Chain according to the following algorithm.

Specified by:
execute in interface Chain
Specified by:
execute in interface Command
Parameters:
context - The Context to be processed by this Chain
Returns:
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
Throws:
java.lang.Exception - if thrown by one of the Commands in this Chain but not handled by a postprocess() method of a Filter
java.lang.IllegalArgumentException - if context is null


Copyright © 2003-2010 Apache Software Foundation. All Rights Reserved.