info.magnolia.commands.chain
Class ChainBase

java.lang.Object
  extended by info.magnolia.commands.chain.ChainBase
All Implemented Interfaces:
Chain, Command, Cloneable

public class ChainBase
extends Object
implements Chain

Replacement for org.apache.commons.chain.impl.ChainBase. Base Chain implementation.


Field Summary
protected  List<Command> commands
           
protected  boolean frozen
           
 
Fields inherited from interface info.magnolia.commands.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
ChainBase()
           
ChainBase(Collection<Command> commands)
           
ChainBase(Command... commands)
           
ChainBase(Command command)
           
 
Method Summary
 void addCommand(Command command)
           
 Command clone()
          This method allows to create new clone of a command, so the instances in the CommandManager's catalogs are masters, and the execution always uses clone created by this method.
NOTE: CommandsManager clone the command instances by standard Java cloning mechanism.
 boolean execute(Context context)
           
 List<Command> getCommands()
          Returns unmodifiable list of commands.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commands

protected List<Command> commands

frozen

protected boolean frozen
Constructor Detail

ChainBase

public ChainBase()

ChainBase

public ChainBase(Command command)

ChainBase

public ChainBase(Command... commands)

ChainBase

public ChainBase(Collection<Command> commands)
Method Detail

addCommand

public void addCommand(Command command)
Specified by:
addCommand in interface Chain

execute

public boolean execute(Context context)
                throws Exception
Specified by:
execute in interface Command
Throws:
Exception

getCommands

public List<Command> getCommands()
Returns unmodifiable list of commands.


clone

public Command clone()
              throws CloneNotSupportedException
Description copied from interface: Command
This method allows to create new clone of a command, so the instances in the CommandManager's catalogs are masters, and the execution always uses clone created by this method.
NOTE: CommandsManager clone the command instances by standard Java cloning mechanism. If deep copy is needed then you have to override clone method of command.

Specified by:
clone in interface Command
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.