org.ow2.jasmine.monitoring.mbeancmd
Class CommandDispatcher

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.CommandDispatcher

public class CommandDispatcher
extends java.lang.Object

This is the main class of the archive. It dispatches the processing of the command to the right class. The available commands in the current archive are retrieved by introspection of the archive.


Field Summary
private static java.lang.String COMMAND_DEFINITIONS
          File containing all command definitions.
private static java.util.TreeMap<java.lang.String,java.lang.String> commands
          List of commands.
 
Constructor Summary
protected CommandDispatcher()
          Dummy constructor to avoid the class from being used in any other way than calling the CommandDispatcher.main method.
 
Method Summary
private static void findCommands()
          Retrieves the list of available commands.
static java.lang.String[] getAvailableCommands()
          Returns the names of the available commands in the archive.
static Command getCommand(java.lang.String name)
          Returns an instance of Command.
private static java.lang.String getRadix(java.lang.String fqn)
          Gets the radix of a given function.
static void main(java.lang.String[] args)
          Main method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_DEFINITIONS

private static final java.lang.String COMMAND_DEFINITIONS
File containing all command definitions.

See Also:
Constant Field Values

commands

private static java.util.TreeMap<java.lang.String,java.lang.String> commands
List of commands.

Constructor Detail

CommandDispatcher

protected CommandDispatcher()
Dummy constructor to avoid the class from being used in any other way than calling the CommandDispatcher.main method.

Method Detail

main

public static void main(java.lang.String[] args)
Main method. The class is selected from the first argument. If no class is available to process the command, it dispatches it to the built-in help class.

Parameters:
args - arguments of the command, including the command itself at the first position.

getCommand

public static Command getCommand(java.lang.String name)
Returns an instance of Command.

Parameters:
name - the name of the command.
Returns:
Command instance corresponding to that name.

getAvailableCommands

public static java.lang.String[] getAvailableCommands()
Returns the names of the available commands in the archive.

Returns:
Names of the available commands in the archive, null if no command has been set yet.

getRadix

private static java.lang.String getRadix(java.lang.String fqn)
Gets the radix of a given function.

Parameters:
fqn - Function name.
Returns:
Radix of that function.

findCommands

private static void findCommands()
Retrieves the list of available commands.

See Also:
commands