Class ScriptCommandExec
java.lang.Object
com.anrisoftware.globalpom.exec.internal.script.ScriptCommandExec
- All Implemented Interfaces:
CommandExec
Executes a script created from a loaded template.
- Since:
- 2.0
- Author:
- Erwin Mueller, erwin.mueller@deventm.org
-
Method Summary
Modifier and TypeMethodDescriptionstatic CommandExeccreateScriptCommandExec(CommandExecFactory execFactory) exec(CommandLine commandLine, PropertyChangeListener... listeners) Executes the command specified by the command line.voidsetCommandError(CommandOutput error) Sets that reads the error output of the command.voidsetCommandInput(CommandInput input) Sets that writes to the standard input of the command.voidsetCommandOutput(CommandOutput output) Sets that reads the standard output of the command.voidsetDestroyOnTimeout(boolean flag) Sets to destroy the executed command on timeout.voidsetExitCode(int... codes) Sets the valid command code(s).voidsetObserver(Observer... observer) Sets the additional observer(s) for the command task.voidsetThreads(Threads threads) Sets the threads pool.toString()
-
Method Details
-
createScriptCommandExec
- Parameters:
execFactory- theCommandExecFactory- Returns:
- the
CommandExec - See Also:
-
setThreads
Description copied from interface:CommandExecSets the threads pool.- Specified by:
setThreadsin interfaceCommandExec- Parameters:
threads- theThreads.
-
setCommandOutput
Description copied from interface:CommandExecSets that reads the standard output of the command.- Specified by:
setCommandOutputin interfaceCommandExec- Parameters:
output- theCommandOutput.
-
setCommandError
Description copied from interface:CommandExecSets that reads the error output of the command.- Specified by:
setCommandErrorin interfaceCommandExec- Parameters:
error- theCommandOutput.
-
setCommandInput
Description copied from interface:CommandExecSets that writes to the standard input of the command.- Specified by:
setCommandInputin interfaceCommandExec- Parameters:
input- theCommandInput.
-
setExitCode
public void setExitCode(int... codes) Description copied from interface:CommandExecSets the valid command code(s).- Specified by:
setExitCodein interfaceCommandExec- Parameters:
codes- the valid command code(s).
-
setDestroyOnTimeout
public void setDestroyOnTimeout(boolean flag) Description copied from interface:CommandExecSets to destroy the executed command on timeout.- Specified by:
setDestroyOnTimeoutin interfaceCommandExec- Parameters:
flag- sets totrueto destroy the executed command on timeout.
-
setObserver
Description copied from interface:CommandExecSets the additional observer(s) for the command task.- Specified by:
setObserverin interfaceCommandExec- Parameters:
observer- theObserverobserver(s).
-
exec
public Future<ProcessTask> exec(CommandLine commandLine, PropertyChangeListener... listeners) throws CommandExecException Description copied from interface:CommandExecExecutes the command specified by the command line.- Specified by:
execin interfaceCommandExec- Parameters:
commandLine- theDefaultCommandLine.listeners- thePropertyChangeListenerlisteners that are informed when the command finishes.- Returns:
- the
FutureofProcessTask. - Throws:
CommandExecException- if there was an error executing the command; if the command was not found; if the exit code of the command is not valid.
-
toString
-