org.apache.maven.it.util.cli.shell
Class Shell

java.lang.Object
  extended by org.apache.maven.it.util.cli.shell.Shell
Direct Known Subclasses:
BourneShell, CmdShell, CommandShell

public class Shell
extends Object

Class that abstracts the Shell functionality, with subclases for shells that behave particularly, like

Since:
1.2
Author:
Carlos Sanchez

Constructor Summary
Shell()
           
 
Method Summary
 List getCommandLine(String executable, String[] arguments)
          Get the command line for the provided executable and arguments in this shell
 String[] getShellArgs()
          Get the shell arguments
 String getShellCommand()
          Get the command to execute the shell
 List getShellCommandLine(String executable, String[] arguments)
          Get the full command line to execute, including shell command, shell arguments, executable and executable arguments
 void setShellArgs(String[] shellArgs)
          Set the shell arguments when calling a command line (not the executable arguments) (eg.
 void setShellCommand(String shellCommand)
          Set the command to execute the shell (eg.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shell

public Shell()
Method Detail

setShellCommand

public void setShellCommand(String shellCommand)
Set the command to execute the shell (eg. COMMAND.COM, /bin/bash,...)

Parameters:
shellCommand -

getShellCommand

public String getShellCommand()
Get the command to execute the shell

Returns:

setShellArgs

public void setShellArgs(String[] shellArgs)
Set the shell arguments when calling a command line (not the executable arguments) (eg. /X /C for CMD.EXE)

Parameters:
shellArgs -

getShellArgs

public String[] getShellArgs()
Get the shell arguments

Returns:

getCommandLine

public List getCommandLine(String executable,
                           String[] arguments)
Get the command line for the provided executable and arguments in this shell

Parameters:
executable - executable that the shell has to call
arguments - arguments for the executable, not the shell
Returns:
List with one String object with executable and arguments quoted as needed

getShellCommandLine

public List getShellCommandLine(String executable,
                                String[] arguments)
Get the full command line to execute, including shell command, shell arguments, executable and executable arguments

Parameters:
executable - executable that the shell has to call
arguments - arguments for the executable, not the shell
Returns:
List of String objects, whose array version is suitable to be used as argument of Runtime.getRuntime().exec()


Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.