com.tivoli.twg.engine.cli
Interface ICliBundle


public interface ICliBundle

A tag interface for any class that wants to be a provider for CLI commands.

Classes that implement this interface may be registered with the CliService to provide CLI behavior.

The CliService will reflect on registered classes for any method that matches one of the described signatures. If a user specifies a command (as a string), the method matching the command name (with the appropriate signature) is searched for and executed (if found). The CliService that invokes the ICliBundle methods will always be in the same JVM.

Commands may be written to handle character streams for stdout. The expected method signature for a character stream command is:

public int commandName(Locale locale, String[] args, Writer out) throws Exception;

where:

Exit codes (int values) are passed to the client shell upon termination.

Common exit codes are:

Additional positive non-overlapping codes can be defined in specific bundle implementations for more specific conditions.


Field Summary
static int COMMAND_EXCEPTION
          Command implementation exception occured
static int FAIL
          General request of action failed
static int NOT_FOUND
          Command or bundle not found
static int OK
          Successfull command execution code
static int SECURITY_FAILURE
          Unauthorized client security failure
static int USAGE
          Usage error code
 
Method Summary
 int help(java.util.Locale locale, java.lang.String[] args, java.io.Writer out)
          Bundle help command which must be implemented by all bundles
 

Field Detail

OK

public static final int OK
Successfull command execution code

See Also:
Constant Field Values

USAGE

public static final int USAGE
Usage error code

See Also:
Constant Field Values

NOT_FOUND

public static final int NOT_FOUND
Command or bundle not found

See Also:
Constant Field Values

SECURITY_FAILURE

public static final int SECURITY_FAILURE
Unauthorized client security failure

See Also:
Constant Field Values

COMMAND_EXCEPTION

public static final int COMMAND_EXCEPTION
Command implementation exception occured

See Also:
Constant Field Values

FAIL

public static final int FAIL
General request of action failed

See Also:
Constant Field Values
Method Detail

help

public int help(java.util.Locale locale,
                java.lang.String[] args,
                java.io.Writer out)
         throws java.lang.Exception
Bundle help command which must be implemented by all bundles

Returns:
int - client exit code
Throws:
java.lang.Exception