Rio Project 4.2 API Documentation



org.rioproject.tools.cli
Class CLI

java.lang.Object
  extended by org.rioproject.tools.cli.CLI

public class CLI
extends Object

The CLI class is a utility that provides a Command Line Interface (CLI) for interfacing with the Rio components

Author:
Dennis Reedy

Nested Class Summary
protected static class CLI.EasterEggHandler
          Handle easter eggs command
protected static class CLI.EmptyHandler
          Empty impl
protected static class CLI.HelpHandler
          Handle the help command
static class CLI.HttpHandler
          Handle http command
protected static class CLI.JConsoleHandler
          Handle jconsole command
static class CLI.LoginCallbackHandler
           
static class CLI.OptionHandlerDesc
          Command line option handler descriptor
protected static class CLI.SettingsHandler
          Handle the Set command
static class CLI.StatsHandler
          Handle stats command
static class CLI.StopHandler
          Handle the destroy command
 
Field Summary
protected  String cliName
           
static String COMPONENT
           
protected static CLI instance
           
static Logger logger
           
protected  Map<String,CLI.OptionHandlerDesc> optionMap
           
protected  String prompt
           
 
Constructor Summary
protected CLI()
           
 
Method Summary
protected static void ensureSecurityManager()
          Utility routine that sets a security manager if one isn't already present.
 Configuration getConfiguration()
          Get the Configuration
static CLI getInstance()
           
 String getInteractiveUsage()
          Get usage for an interactive session
 OptionHandler getOptionHandler(String option)
          Get an OptionHandler for an option
 PrintStream getOutput()
           
 ServiceFinder getServiceFinder()
          Get the ServiceFinder
static String[] initCLI(String[] args)
          Initialize the CLI, parsing arguments, loading configuration and creating optional OptionHandler instances
protected  void loadOptionHandlers(Configuration config)
           
static void main(String[] args)
           
 boolean validCommand(String command)
          Validate command argument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT

public static final String COMPONENT
See Also:
Constant Field Values

logger

public static Logger logger

cliName

protected String cliName

prompt

protected String prompt

optionMap

protected final Map<String,CLI.OptionHandlerDesc> optionMap

instance

protected static CLI instance
Constructor Detail

CLI

protected CLI()
Method Detail

getInstance

public static CLI getInstance()

ensureSecurityManager

protected static void ensureSecurityManager()
Utility routine that sets a security manager if one isn't already present.


getInteractiveUsage

public String getInteractiveUsage()
Get usage for an interactive session

Returns:
A formatted String for displaying usage of an interactive session

validCommand

public boolean validCommand(String command)
Validate command argument

Parameters:
command - The command to validate, must not be null
Returns:
If the command is valid, return true, otherwise return false for an invalid command
Throws:
NullPointerException - if the command parameter is null

getOutput

public PrintStream getOutput()

getOptionHandler

public OptionHandler getOptionHandler(String option)
Get an OptionHandler for an option

Parameters:
option - The option to use, must not be null
Returns:
An OptionHandler for the option. A new OptionHandler is created each time. If an OptionHandler cannot be found for the provided option name, return null
Throws:
NullPointerException - if the option parameter is null

loadOptionHandlers

protected void loadOptionHandlers(Configuration config)
                           throws ConfigurationException
Throws:
ConfigurationException

getServiceFinder

public ServiceFinder getServiceFinder()
Get the ServiceFinder

Returns:
The ServiceFinder

getConfiguration

public Configuration getConfiguration()
Get the Configuration

Returns:
The SystemConfiguration

initCLI

public static String[] initCLI(String[] args)
                        throws Throwable
Initialize the CLI, parsing arguments, loading configuration and creating optional OptionHandler instances

Parameters:
args - Command line arguments to parse, must not be null
Returns:
Array of string args to be parsed
Throws:
Throwable - if anything at all happens that is not supposed to happen

main

public static void main(String[] args)

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.