Class that abstracts the Shell functionality,
with subclases for shells that behave particularly, like
addShellArg
public void addShellArg(String arg)
clearArguments
public void clearArguments()
clone
public Object clone()
getCommandLine
public List getCommandLine(String executable,
String[] arguments)
Get the command line for the provided executable and arguments in this shell
executable
- executable that the shell has to callarguments
- arguments for the executable, not the shell
- List with one String object with executable and arguments quoted as needed
getExecutable
public String getExecutable()
getOriginalCommandLine
public List getOriginalCommandLine(String executable,
String[] arguments)
getOriginalExecutable
public String getOriginalExecutable()
getShellArgs
public String[] getShellArgs()
Get the shell arguments
getShellArgsList
public List getShellArgsList()
getShellCommand
public String getShellCommand()
Get the command to execute the shell
getShellCommandLine
public List getShellCommandLine(String[] arguments)
Get the full command line to execute, including shell command, shell arguments,
executable and executable arguments
arguments
- arguments for the executable, not the shell
- List of String objects, whose array version is suitable to be used as argument
of Runtime.getRuntime().exec()
getWorkingDirectory
public File getWorkingDirectory()
isDoubleQuotedArgumentEscaped
protected boolean isDoubleQuotedArgumentEscaped()
isDoubleQuotedExecutableEscaped
protected boolean isDoubleQuotedExecutableEscaped()
isQuotedArgumentsEnabled
public boolean isQuotedArgumentsEnabled()
isQuotedExecutableEnabled
public boolean isQuotedExecutableEnabled()
isSingleQuotedArgumentEscaped
protected boolean isSingleQuotedArgumentEscaped()
isSingleQuotedExecutableEscaped
protected boolean isSingleQuotedExecutableEscaped()
setDoubleQuotedArgumentEscaped
protected void setDoubleQuotedArgumentEscaped(boolean doubleQuotedArgumentEscaped)
setDoubleQuotedExecutableEscaped
protected void setDoubleQuotedExecutableEscaped(boolean doubleQuotedExecutableEscaped)
setExecutable
public void setExecutable(String executable)
Sets the executable to run.
setQuotedArgumentsEnabled
public void setQuotedArgumentsEnabled(boolean quotedArgumentsEnabled)
setQuotedExecutableEnabled
public void setQuotedExecutableEnabled(boolean quotedExecutableEnabled)
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)
setShellCommand
public void setShellCommand(String shellCommand)
Set the command to execute the shell (eg. COMMAND.COM, /bin/bash,...)
setSingleQuotedArgumentEscaped
protected void setSingleQuotedArgumentEscaped(boolean singleQuotedArgumentEscaped)
setSingleQuotedExecutableEscaped
protected void setSingleQuotedExecutableEscaped(boolean singleQuotedExecutableEscaped)
setWorkingDirectory
public void setWorkingDirectory(File workingDir)
Sets execution directory.
setWorkingDirectory
public void setWorkingDirectory(String path)
Sets execution directory.