As mentioned above, the RPC API is intended to be as generic as possible so implementations can support a wide variety of transports and remote systems. However, this flexibility also puts a lot of burden on the implementer. To simplify the process, the atg.integration package includes basic implementations of the Command and CommandHandler interfaces. Rather than implementing the interfaces directly, you can just extend the BaseCommand and BaseCommandHandler classes.

The atg.integrations.BaseCommand class provides an execute() method that implements the logic described in the Command Interface section above. Classes that extend this class must provide their own implementations of the invokeRPC() method.

The atg.integrations.BaseCommandHandler class provides an executeCommand() method that implements the logic described in the CommandHandler Interface section above. Classes that extend this class can override the executeCommand() method to do their pre- or postprocessing as needed. Implementing this method can be simplified by having the executeCommand() method of the subclass call the executeCommand() method of the parent class while adding pre- or postprocessing of its own. For example, a CachingCommandHandler class might look like this:

Public class CachingCommandHandler extends BaseCommandHandler {
 Map sCache = new HashMap(); // Cache of method invocations.
Public CommandResult executeCommand(Command pCommand, Object pInput) {
 if (sCache.containsKey(pInput)) {
 return sCache.get(pInput);
 }
else {
 CommandResult result = super.executeCommand(pCommand, pInput);
 sCache.put(pInput, result);
 return result;
 }
}
}

For more information about BaseCommand and BaseCommandHandler, see the ATG Platform API Reference.