org.ow2.petals.cli.shell
Class PetalsShell

java.lang.Object
  extended by org.ow2.petals.cli.shell.Shell
      extended by org.ow2.petals.cli.shell.PetalsShell
Direct Known Subclasses:
PetalsShellConsole

public class PetalsShell
extends Shell

This class is the shell implementation for petals CLI for non-interactive use

Author:
sandre

Field Summary
static java.util.regex.Pattern REGEX_COMMENT
          Regular expression that matches comments in scripts
static java.util.regex.Pattern REGEX_VARIABLE
          Regular expression that matches variables in expressions
 
Fields inherited from class org.ow2.petals.cli.shell.Shell
err, in, out
 
Constructor Summary
PetalsShell()
          Creates a new PetalsShell
PetalsShell(java.lang.String[] args)
          Create a new PetalsShell and execute a command line
 
Method Summary
 void evaluate(java.lang.String[] args)
          Evaluate a list of arguments.
 void exit(int status)
          Exit the current Set
 java.lang.String interpolate(java.lang.String str)
          Interpolates variables and special characters in a string
 boolean isComment(java.lang.String line)
          Test whether a line is a comment or not
 
Methods inherited from class org.ow2.petals.cli.shell.Shell
evaluate, getCommands, register
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGEX_COMMENT

public static final java.util.regex.Pattern REGEX_COMMENT
Regular expression that matches comments in scripts


REGEX_VARIABLE

public static final java.util.regex.Pattern REGEX_VARIABLE
Regular expression that matches variables in expressions

Constructor Detail

PetalsShell

public PetalsShell()
            throws ShellException
Creates a new PetalsShell

Throws:
ShellException - when a command cannot be registered
See Also:
Set

PetalsShell

public PetalsShell(java.lang.String[] args)
            throws ShellException
Create a new PetalsShell and execute a command line

Parameters:
configuration - the petals configuration
args - command line arguments
Throws:
ShellException - when a command cannot be registered or an error occurs during the evaluation of command line
Method Detail

interpolate

public java.lang.String interpolate(java.lang.String str)
Description copied from class: Shell
Interpolates variables and special characters in a string

Specified by:
interpolate in class Shell
Parameters:
str - the string to be interpolated
Returns:
a new string with interpolated variables

isComment

public boolean isComment(java.lang.String line)
Description copied from class: Shell
Test whether a line is a comment or not

Specified by:
isComment in class Shell
Parameters:
line - the string to be tested
Returns:
true if the line is a comment, false otherwise

exit

public void exit(int status)
Description copied from class: Shell
Exit the current Set

Specified by:
exit in class Shell
Parameters:
status - the optional result value

evaluate

public void evaluate(java.lang.String[] args)
              throws ShellException,
                     CommandException
Description copied from class: Shell
Evaluate a list of arguments. Do nothing if args id null of empty.

Overrides:
evaluate in class Shell
Parameters:
args - the command line
Throws:
ShellException - when the command was not found
CommandException - when an error occurs during the execution of the command


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.