com.sun.mfwk.cli
Class MfCliCommand

java.lang.Object
  extended bycom.sun.mfwk.cli.MfCliCommand
All Implemented Interfaces:
com.sun.cacao.commandstream.Command
Direct Known Subclasses:
MfCliAgentModule, MfCliCibModule, MfCliOpStatusJobModule, MfCliPerfJobModule

public abstract class MfCliCommand
extends java.lang.Object
implements com.sun.cacao.commandstream.Command


Field Summary
 
Fields inherited from interface com.sun.cacao.commandstream.Command
ENV_CMD_DOMAIN_KEY, ENV_CMD_NAME_KEY, ERROR_CODE, SUCCESS_CODE
 
Constructor Summary
MfCliCommand()
          Default constructor.
MfCliCommand(javax.management.MBeanServer mbs)
          Constructs a new BaseCommand acting upon an MBean server.
 
Method Summary
 int execute(java.lang.String arguments, java.io.InputStream in, java.io.OutputStream out, java.io.OutputStream err, java.util.Map env)
          Executes this command based on the specified arguments, input/output streams and environment.
 javax.management.MBeanServer getMBeanServer()
          Returns the MBean server this command is bound to.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MfCliCommand

public MfCliCommand()
Default constructor.


MfCliCommand

public MfCliCommand(javax.management.MBeanServer mbs)
Constructs a new BaseCommand acting upon an MBean server.

Method Detail

getMBeanServer

public javax.management.MBeanServer getMBeanServer()
Returns the MBean server this command is bound to.

Returns:
MBeanServer the MBean server bound to this command

execute

public int execute(java.lang.String arguments,
                   java.io.InputStream in,
                   java.io.OutputStream out,
                   java.io.OutputStream err,
                   java.util.Map env)
            throws java.lang.Exception
Executes this command based on the specified arguments, input/output streams and environment. Returns an exit code or raises an exception.

This method may be invoked simultaneously by several threads. It is the responsability of the class implementing this method to manage thread-safety.

Specified by:
execute in interface com.sun.cacao.commandstream.Command
Parameters:
arguments - the set of arguments as a String array
in - the byte input stream of the client thread
out - the byte output stream of the client thread
err - the byte error stream of the client thread
env - the client environment
Returns:
int an exit code (preferably between 0 and 255)
Throws:
java.lang.Exception - when the execution fails
See Also:
Command.execute(java.lang.String,InputStream in, OutputStream out, OutputStream err, Map env)