org.iperg.part.core
Interface IpCommandHandler


public interface IpCommandHandler

The IpCommandHandler interface defined methods to be implemented by command handlers. A command handler can be added added to an IpObject instance via its addCommandHandler method:

obj.addCommandHandler(handler);

When the object's exec method is later called, the command handlers will be invoked, one after the other, to handle the command expression given as a parameter to exec.

Version:
1.0.0 Initial version
Author:
Olov Stahl - olovs@sics.se

Method Summary
 java.lang.String handleCommand(java.lang.String command, java.lang.String[] args)
          Execute a command and return the result as a string, or null if the command wasn't handled.
 

Method Detail

handleCommand

java.lang.String handleCommand(java.lang.String command,
                               java.lang.String[] args)
                               throws IpException
Execute a command and return the result as a string, or null if the command wasn't handled.

Note that if null is returned, the handler is assumed to have NOT handled the command, which means that another handler may be invoked. Thus, a string value should always be returned if the command was handled. If the command has no real return value, an empty string should be returned:

return new String();

Parameters:
command - The name of the command
args - An array of command arguments
Returns:
A string representing the result of the execution, or null if the command wasn't handled
Throws:
IpException - if the command couldn't be executed for some reason