Keel 2.1RC2

org.keel.clients.cli
Class Keel

java.lang.Object
  extended byorg.keel.clients.cli.Keel

public class Keel
extends java.lang.Object

Basic command-line interface to Keel

Author:
Michael Nash

Field Summary
private static java.lang.String configDir
           
private static java.lang.String configPath
           
protected static int HELP_OPT
           
private static java.lang.String host
           
protected static int INTERACTIVE_OPT
           
protected static int JMS_OPT
           
private static java.lang.String jmsClient
           
private static java.lang.String logPath
           
static java.lang.String mode
           
protected static int MODEL_OPT
           
private static KeelClient myClient
           
private static KeelStarter myStarter
           
protected static org.realityforge.cli.CLOptionDescriptor[] options
          Define the understood options.
private static java.util.Map params
           
private static java.lang.String port
           
private static KeelResponse res
           
private static java.lang.String rolesPath
           
protected static int VERSION_OPT
           
 
Constructor Summary
private Keel()
           
 
Method Summary
private static java.lang.String choose(java.util.Map choices, java.lang.String prompt)
          Prompt with a menu of choices, allowing the user to select one of them and returning the selected item.
private static void clearParams()
           
private static void commandMenu(java.util.ArrayList commandArgs)
           
private static void commandMode(java.util.ArrayList commandArgs)
           
private static void commandModel(java.util.ArrayList arguments)
           
private static void displayCommand(Command c, int nestingLevel)
          Display a command, including any nested elements
private static void displayInput(Input i, int nestingLevel)
          Display an input, including any nested elements
private static void displayOutput(Output o, int nestingLevel)
          Display an output, including any nested elements
private static void doInteractive()
           
private static KeelClient getClient()
           
private static java.lang.String getHost()
           
private static java.lang.String getPort()
           
private static KeelStarter getStarter()
           
private static void interactiveUsage()
          Show a usage/help message for the interactive mode
static void main(java.lang.String[] args)
           
private static void outputModelResponse(KeelResponse res, long executeTime, java.lang.String modelName)
          Outputs the contents of a KeelReponse to the screen in a readible format.
private static void printUsage()
           
private static void printVersion()
           
private static java.lang.String readCommand(java.lang.String prompt)
          Read a command from the user, prompting with the given prompt, and return the string the user typed
private static void receiveInputs(java.util.List commandArgs)
          Request a value for every input in the current response, if any
private static void runCommand(java.lang.String command)
          Run the command the user typed, or display usage if it wasn't a valid command
private static void runModel(java.lang.String modelName)
          Run the model the user has selected, and display the contents of the resulting response
private static void runModelLocal(java.lang.String modelName)
          Run the model the user has selected, and display the contents of the resulting response
private static void selectCommand(java.util.List commandArgs)
          Allow the user to choose a command from the current response and execute it
private static void setParam(java.util.ArrayList commandArgs)
          Request a value for every input in the current response, if any
private static void showParams()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HELP_OPT

protected static final int HELP_OPT
See Also:
Constant Field Values

VERSION_OPT

protected static final int VERSION_OPT
See Also:
Constant Field Values

MODEL_OPT

protected static final int MODEL_OPT
See Also:
Constant Field Values

INTERACTIVE_OPT

protected static final int INTERACTIVE_OPT
See Also:
Constant Field Values

JMS_OPT

protected static final int JMS_OPT
See Also:
Constant Field Values

port

private static java.lang.String port

host

private static java.lang.String host

res

private static KeelResponse res

myClient

private static KeelClient myClient

params

private static java.util.Map params

jmsClient

private static java.lang.String jmsClient

mode

public static java.lang.String mode

configDir

private static java.lang.String configDir

configPath

private static java.lang.String configPath

rolesPath

private static java.lang.String rolesPath

logPath

private static java.lang.String logPath

myStarter

private static KeelStarter myStarter

options

protected static final org.realityforge.cli.CLOptionDescriptor[] options
Define the understood options. Each CLOptionDescriptor contains: - The "long" version of the option. Eg, "help" means that "--help" will be recognised. - The option flags, governing the option's argument(s). - The "short" version of the option. Eg, 'h' means that "-h" will be recognised. - A description of the option.

Constructor Detail

Keel

private Keel()
Method Detail

main

public static void main(java.lang.String[] args)

printVersion

private static void printVersion()

printUsage

private static void printUsage()

doInteractive

private static void doInteractive()

readCommand

private static java.lang.String readCommand(java.lang.String prompt)
Read a command from the user, prompting with the given prompt, and return the string the user typed


commandModel

private static void commandModel(java.util.ArrayList arguments)

runCommand

private static void runCommand(java.lang.String command)
                        throws NestedException
Run the command the user typed, or display usage if it wasn't a valid command

Throws:
NestedException

commandMenu

private static void commandMenu(java.util.ArrayList commandArgs)

commandMode

private static void commandMode(java.util.ArrayList commandArgs)

clearParams

private static void clearParams()

receiveInputs

private static void receiveInputs(java.util.List commandArgs)
Request a value for every input in the current response, if any


setParam

private static void setParam(java.util.ArrayList commandArgs)
Request a value for every input in the current response, if any


showParams

private static void showParams()

selectCommand

private static void selectCommand(java.util.List commandArgs)
Allow the user to choose a command from the current response and execute it


interactiveUsage

private static void interactiveUsage()
Show a usage/help message for the interactive mode


getStarter

private static KeelStarter getStarter()

runModelLocal

private static void runModelLocal(java.lang.String modelName)
Run the model the user has selected, and display the contents of the resulting response


outputModelResponse

private static void outputModelResponse(KeelResponse res,
                                        long executeTime,
                                        java.lang.String modelName)
Outputs the contents of a KeelReponse to the screen in a readible format. This has been refactored and will now execute for both jms and local modes.


runModel

private static void runModel(java.lang.String modelName)
Run the model the user has selected, and display the contents of the resulting response


displayOutput

private static void displayOutput(Output o,
                                  int nestingLevel)
Display an output, including any nested elements


displayInput

private static void displayInput(Input i,
                                 int nestingLevel)
Display an input, including any nested elements


displayCommand

private static void displayCommand(Command c,
                                   int nestingLevel)
Display a command, including any nested elements


getClient

private static KeelClient getClient()
                             throws ModelException
Throws:
ModelException

getPort

private static java.lang.String getPort()

getHost

private static java.lang.String getHost()

choose

private static java.lang.String choose(java.util.Map choices,
                                       java.lang.String prompt)
Prompt with a menu of choices, allowing the user to select one of them and returning the selected item.

Parameters:
choices - A map of values and labels, where the user sees the label
prompt - A string prompt to explain the choices being offered
Returns:
The *value* corresponding to the choice

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.