atg.integrations
Interface Command

All Known Implementing Classes:
BaseCommand

public interface Command

Command is an interface for the actual end point in the generic RPC Framework that executes RPC. A command exposes two methods for execution execute() and invokeRPC().

The execute() method is the one that determines how this command should actually be executed. It might determine that it is necessary to call a CommandHandler before the command is actually executed if CommandHandler is configured with any CommandHandler. Or, it might determine that no CommandHandler needs to be called and the Command can simply be executed and the results returned to the calling program if no CommandHandler() is configured. The invokeRPC() method is the one that actually executes the command by mapping the Command input onto the RPC defined in the transport layer.

A Command's execute() and invokeRPC() method throw these exceptions; CommandInvocationException and CommandTimeoutException. These exceptions are intended to wrap any underlying exceptions that might be thrown by a particular transport or back end. These exceptions needs to wrap the underlying Exception (as opposed to copying its message) so that stack trace printouts can contain the information from the underlying exception. CommandTimeoutException is a special case of exception, since time out doesn't indicate whether the RPC call is succeeded or not we need to handle timeouts differently and so this exception is provided to allow that. InvalidInputException indicates the input object passed to the Command is invalid.

Also, Command's execute() and invokeRPC() method returns CommandResult which is a transport independent representation of the results from a RPC call.

A Command also contains a context object which is a Properties property. This property is intended to be used as a hook for additional configuration or hints to a transport/backend system that can not be captured in the standard input.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Method Summary
 CommandResult execute(java.lang.Object pInput)
          Executes RPC Call at the configured back end system.
 CommandHandler getCommandHandler()
          Returns CommandHandler property to do pre/post processing of RPC call.
 java.util.Map getContext()
          Returns Hook for extra parameters
 CommandResult invokeRPC(java.lang.Object pInput)
          Actual method that executes the RPC Call at the back end system.
 

Field Detail

CLASS_VERSION

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

getCommandHandler

CommandHandler getCommandHandler()
Returns CommandHandler property to do pre/post processing of RPC call.

Returns:
CommandHandler

getContext

java.util.Map getContext()
Returns Hook for extra parameters

Returns:
the context object

execute

CommandResult execute(java.lang.Object pInput)
                      throws CommandInvocationException,
                             CommandTimeoutException,
                             InvalidInputException
Executes RPC Call at the configured back end system. This method is called by application code to execute a RPC call at the back end. An implementation of this method will be the same across implementing classes. It will check to see if it has a configured CommandHandler If it does then calls the executeCommand() on the configured CommandHandler. Eventually there will be a CommandHandler that will call the invokeRPC() method on this command. If no CommandHandler is configured on this component then the execute() method just calls the invokeRPC() method directly.

Parameters:
pInput - the input Map to pass as a input to RPC Call.
Returns:
the result of invoking the RPC call at the back end.
Throws:
CommandInvocationException - if an error occurs in the middleware or at the back end.
CommandTimeoutException - if timeout occurs while invoking the command.
InvalidInputException - if input object passed is invalid.

invokeRPC

CommandResult invokeRPC(java.lang.Object pInput)
                        throws CommandInvocationException,
                               CommandTimeoutException,
                               InvalidInputException
Actual method that executes the RPC Call at the back end system. This method is expected to actually map the input onto a particular transport

Parameters:
pInput - the input to map onto transport format and pass to back end.
Throws:
CommandInvocationException - if an error occurs in the middleware or at the back end.
CommandTimeoutException - if timeout occurs while invoking the command.
InvalidInputException - if input object passed is invalid.