atg.integrations
Interface CommandHandler

All Known Implementing Classes:
BaseCommandHandler

public interface CommandHandler

A CommandHandler is an interface that allows an implementing class to either process a Command and input to the Command before it is executed, or after it is executed. CommandHandlers can be chained together to achieve layered services, by configuring #getNextCommandHandler()NextCommandHandler with the next Command Handler to invoke and invoking executeCommand() of the NextCommandHandler in the executeCommand() method.

If CommandHandler is doing pre processing then it should do it before invoking the NextCommandHandler, and if it is doing post processing it should do it after invoking the NextCommandHandler

CommandHandlers can take either a Map or List as input to their executeCommand() method.

At the end of any configured chain of CommandHandlers must be a CommandHandler that is capable of executing the Command that was passed to it. That is, there is a CommandHandler that actually executes the Command object.

Examples of CommandHandlers are: post processing by moving data from a results bucket to an exceptions bucket, caching command calls, and auditing.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Method Summary
 CommandResult executeCommand(Command pCommand, java.lang.Object pInput)
          Process the Command and input to the Command before or after invoking the NextCommandHandler.
 CommandHandler getNextCommandHandler()
          Returns Next CommandHandler in the command invocation chain to invoke.
 

Field Detail

CLASS_VERSION

static final java.lang.String CLASS_VERSION
See Also:
Constant Field Values
Method Detail

getNextCommandHandler

CommandHandler getNextCommandHandler()
Returns Next CommandHandler in the command invocation chain to invoke. If this CommandHandler is the end of command invocation chain then this property is not expected to be set.


executeCommand

CommandResult executeCommand(Command pCommand,
                             java.lang.Object pInput)
                             throws CommandInvocationException,
                                    CommandTimeoutException,
                                    InvalidInputException
Process the Command and input to the Command before or after invoking the NextCommandHandler. If this is the end of the invocation chain then this CommandHandler is expected to execute the Command directly.

If this CommandHandler is doing pre processing then it should do it before invoking the executeCommand() of the NextCommandHandler, and if it is doing post processing it should do it after invoking the executeCommand() of the NextCommandHandler

Parameters:
pCommand - the command to execute.
pInput - the input to the command
Returns:
CommandResult
Throws:
CommandInvocationException - if any error occurs, or any exception is thrown while executing the Command.
CommandTimeoutException - if timeout occurs while invoking the command.
InvalidInputException - if input object passed is invalid.