atg.integrations
Class BaseCommand

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.integrations.BaseCommand
All Implemented Interfaces:
Command, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public abstract class BaseCommand
extends GenericService
implements Command

Base Command class that specific implementations can extend. This class provides default implementations of all methods except for the invokeRPC(Object).


Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
BaseCommand()
           
 
Method Summary
 void doStartService()
          This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 CommandResult execute(java.lang.Object pInput)
          Application code should call this method to execute a RPC call

This method will check to see if there is a CommandHandler configured on this component and if so, will call the executeCommand() on that particular CommandHandler.

 CommandHandler getCommandHandler()
          The CommandHandler that will be called by this RPC Client to handle the execution of a Command.
 java.util.Map getContext()
          Contextual information that can be passed.
abstract  CommandResult invokeRPC(java.lang.Object pInput)
          Abstract method.
 void setCommandHandler(CommandHandler pCommandHandler)
          Set the CommandHandler property.
 void setContext(java.util.Map pContext)
          Set the Conext property.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

BaseCommand

public BaseCommand()
Method Detail

getCommandHandler

public CommandHandler getCommandHandler()
The CommandHandler that will be called by this RPC Client to handle the execution of a Command. When execute() is called on this component it checks this property for a configured CommandHandler.

Specified by:
getCommandHandler in interface Command
Returns:
The CommandHandler

setCommandHandler

public void setCommandHandler(CommandHandler pCommandHandler)
Set the CommandHandler property.

Parameters:
pCommandHandler -

getContext

public java.util.Map getContext()
Contextual information that can be passed. By default, thiis class will not populate any information into this object. Applications can use this property as an extension point.

Specified by:
getContext in interface Command
Returns:
the context object

setContext

public void setContext(java.util.Map pContext)
Set the Conext property.

Parameters:
pContext -

doStartService

public void doStartService()
                    throws ServiceException
Description copied from class: GenericService
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. The Service should override this method to start any processes it requires.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

execute

public CommandResult execute(java.lang.Object pInput)
                      throws CommandInvocationException,
                             CommandTimeoutException,
                             InvalidInputException
Application code should call this method to execute a RPC call

This method will check to see if there is a CommandHandler configured on this component and if so, will call the executeCommand() on that particular CommandHandler.

If no CommandHandler is configured then the invokeRPC(Object) method is called.

This method has PerformanceMonitor code associated with it. If the PerformanceMonitor is enabled, this method will generate statistics on how long it takes to execute the Command.

Specified by:
execute in interface Command
Parameters:
pInput - input object to pass to the command
Returns:
a CommandResult object
Throws:
CommandInvocationException - if an error occurs
CommandTimeoutException - if time expires for the command.
InvalidInputException - if input object passed is invalid.

invokeRPC

public abstract CommandResult invokeRPC(java.lang.Object pInput)
                                 throws CommandInvocationException,
                                        CommandTimeoutException,
                                        InvalidInputException
Abstract method. Classes that extend this class should override this method and provide an implementation that actually executes the RPC method that this Command backs.

Specified by:
invokeRPC in interface Command
Parameters:
pInput - object
Returns:
CommandResult object
Throws:
CommandInvocationException - if an error occurs
CommandTimeoutException - if time expires for the command.
InvalidInputException - if input object passed is invalid.