org.apache.jsieve.commands
Class AbstractCommand

java.lang.Object
  extended by org.apache.jsieve.commands.AbstractCommand
All Implemented Interfaces:
ExecutableCommand
Direct Known Subclasses:
AbstractBodyCommand, AbstractPrologCommand, Log

public abstract class AbstractCommand
extends java.lang.Object
implements ExecutableCommand

Abstract class AbstractCommand defines a framework of common behavior for Sieve Commands.


Constructor Summary
AbstractCommand()
          Constructor for AbstractCommand.
 
Method Summary
 java.lang.Object execute(MailAdapter mail, Arguments arguments, Block block, SieveContext context)
           Method execute executes a basic Sieve Command after first invoking framework methods to validate that Sieve is in a legal state to invoke the Command and that the Command arguments are legal.
protected abstract  java.lang.Object executeBasic(MailAdapter mail, Arguments arguments, Block block, SieveContext context)
          Abstract method executeBasic invokes a Sieve Command.
protected  void updateState(SieveContext context)
          Framework method updateState is invoked after a Sieve Command has executed to update the Sieve state.
protected  void validateArguments(Arguments arguments, SieveContext context)
          Framework method validateArguments is invoked before a Sieve Command is executed to validate its arguments.
protected  void validateBlock(Block block, SieveContext context)
          Framework method validateBlock is invoked before a Sieve Command is executed to validate its Block.
protected  void validateState(SieveContext context)
          Framework method validateState is invoked before a Sieve Command is executed to validate its state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCommand

public AbstractCommand()
Constructor for AbstractCommand.

Method Detail

validateState

protected void validateState(SieveContext context)
                      throws CommandException
Framework method validateState is invoked before a Sieve Command is executed to validate its state. Subclass methods are expected to override or extend this method to perform their own validation as appropriate.

Parameters:
context - SieveContext giving contextual information, not null
Throws:
CommandException

updateState

protected void updateState(SieveContext context)
Framework method updateState is invoked after a Sieve Command has executed to update the Sieve state. Subclass methods are expected to override or extend this method to update state as appropriate.

Parameters:
context - not null

validateArguments

protected void validateArguments(Arguments arguments,
                                 SieveContext context)
                          throws SieveException
Framework method validateArguments is invoked before a Sieve Command is executed to validate its arguments. Subclass methods are expected to override or extend this method to perform their own validation as appropriate.

Parameters:
arguments -
context - SieveContext giving contextual information, not null
Throws:
SieveException

validateBlock

protected void validateBlock(Block block,
                             SieveContext context)
                      throws SieveException
Framework method validateBlock is invoked before a Sieve Command is executed to validate its Block. Subclass methods are expected to override or extend this method to perform their own validation as appropriate.

Parameters:
block -
context - ScriptCoordinate giving positional information, not null
Throws:
SieveException

execute

public java.lang.Object execute(MailAdapter mail,
                                Arguments arguments,
                                Block block,
                                SieveContext context)
                         throws SieveException

Method execute executes a basic Sieve Command after first invoking framework methods to validate that Sieve is in a legal state to invoke the Command and that the Command arguments are legal. After invocation, a framework method is invoked to update the state.

Also,

Specified by:
execute in interface ExecutableCommand
Parameters:
mail - - The mail against which the Command is executed.
arguments - - The Command arguments
block - - An optional Block to be evaluated
context - SieveContext containing contextual information, not null
Returns:
Object - The result of evaluating the Command
Throws:
SieveException
See Also:
Executable.execute(MailAdapter, SieveContext)

executeBasic

protected abstract java.lang.Object executeBasic(MailAdapter mail,
                                                 Arguments arguments,
                                                 Block block,
                                                 SieveContext context)
                                          throws SieveException
Abstract method executeBasic invokes a Sieve Command.

Parameters:
mail -
arguments -
block -
context - SieveContext giving contextual information, not null
Returns:
Object
Throws:
SieveException


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.