Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.shell
Class ShellCommandBase

java.lang.Object
  extended by org.hyperic.util.shell.ShellCommandBase
All Implemented Interfaces:
ShellCommandHandler
Direct Known Subclasses:
MultiwordShellCommand, ShellCommand_get, ShellCommand_help, ShellCommand_quit, ShellCommand_set, ShellCommand_sleep, ShellCommand_source

public class ShellCommandBase
extends java.lang.Object
implements ShellCommandHandler


Constructor Summary
ShellCommandBase()
           
 
Method Summary
 java.lang.String getCommandName()
           
 java.io.PrintStream getErrStream()
           
 java.util.ResourceBundle getMessages(java.lang.String string)
          Load and initialize the ResourceBundle according to our default locale.
 java.util.ResourceBundle getMessages(java.lang.String string, java.util.Locale loc)
          Load and initialize the ResourceBundle according to the specified locale.
 java.io.PrintStream getOutStream()
           
 ShellBase getShell()
           
 java.lang.String getSyntax()
          Get a description of the syntax for how a command should be invoked.
 java.lang.String getSyntaxArgs()
           
 java.lang.String getUsageHelp(java.lang.String[] args)
          Get some info on how to invoke this command.
 java.lang.String getUsageShort()
          Get a very brief (40 character) description of the command
 void init(java.lang.String commandName, ShellBase shell)
          Initialize this command handler.
 void processCommand(java.lang.String[] args)
          Handle a command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShellCommandBase

public ShellCommandBase()
Method Detail

getCommandName

public java.lang.String getCommandName()

getShell

public ShellBase getShell()

getOutStream

public java.io.PrintStream getOutStream()

getErrStream

public java.io.PrintStream getErrStream()

init

public void init(java.lang.String commandName,
                 ShellBase shell)
          throws ShellCommandInitException
Description copied from interface: ShellCommandHandler
Initialize this command handler.

Specified by:
init in interface ShellCommandHandler
Parameters:
commandName - The name of the command.
shell - The shell. This is useful for command that need to be able to interpret other commands, like the "help" command, and for commands that need to get additional user input, for example a login command that presents a password prompt.
Throws:
ShellCommandInitException

processCommand

public void processCommand(java.lang.String[] args)
                    throws ShellCommandUsageException,
                           ShellCommandExecException
Description copied from interface: ShellCommandHandler
Handle a command.

Specified by:
processCommand in interface ShellCommandHandler
Parameters:
args - The args to the command.
Throws:
ShellCommandUsageException - If the args are malformed.
ShellCommandExecException - If an error occurred executing the command.

getSyntax

public java.lang.String getSyntax()
Description copied from interface: ShellCommandHandler
Get a description of the syntax for how a command should be invoked.

Specified by:
getSyntax in interface ShellCommandHandler
Returns:
A description of the syntax

getSyntaxArgs

public java.lang.String getSyntaxArgs()

getUsageShort

public java.lang.String getUsageShort()
Description copied from interface: ShellCommandHandler
Get a very brief (40 character) description of the command

Specified by:
getUsageShort in interface ShellCommandHandler
Returns:
A description of the command.

getUsageHelp

public java.lang.String getUsageHelp(java.lang.String[] args)
Description copied from interface: ShellCommandHandler
Get some info on how to invoke this command.

Specified by:
getUsageHelp in interface ShellCommandHandler
Returns:
Some usage information on how this command is expected to be invoked.

getMessages

public java.util.ResourceBundle getMessages(java.lang.String string)
Load and initialize the ResourceBundle according to our default locale.

Parameters:
string - containing the package qualified resourcebundle name.
Returns:
ResourceBundle

getMessages

public java.util.ResourceBundle getMessages(java.lang.String string,
                                            java.util.Locale loc)
Load and initialize the ResourceBundle according to the specified locale.

Parameters:
string - containing the package qualified resourcebundle name.
loc - specific version of the resource bundle.
Returns:
ResourceBundle

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.