Interface CommandExec
-
- All Known Implementing Classes:
DefaultCommandExec,ScriptCommandExec
public interface CommandExecExecutes an external command.- Since:
- 1.11
- Author:
- Erwin Mueller, erwin.mueller@deventm.org
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Future<ProcessTask>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... code)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.
-
-
-
Method Detail
-
setThreads
void setThreads(Threads threads)
Sets the threads pool.- Parameters:
threads- theThreads.
-
setCommandOutput
void setCommandOutput(CommandOutput output)
Sets that reads the standard output of the command.- Parameters:
output- theCommandOutput.
-
setCommandError
void setCommandError(CommandOutput error)
Sets that reads the error output of the command.- Parameters:
error- theCommandOutput.
-
setCommandInput
void setCommandInput(CommandInput input)
Sets that writes to the standard input of the command.- Parameters:
input- theCommandInput.
-
setExitCode
void setExitCode(int... code)
Sets the valid command code(s).- Parameters:
code- the valid command code(s).
-
setDestroyOnTimeout
void setDestroyOnTimeout(boolean flag)
Sets to destroy the executed command on timeout.- Parameters:
flag- sets totrueto destroy the executed command on timeout.
-
setObserver
void setObserver(Observer... observer)
Sets the additional observer(s) for the command task.- Parameters:
observer- theObserverobserver(s).
-
exec
Future<ProcessTask> exec(CommandLine commandLine, PropertyChangeListener... listeners) throws CommandExecException
Executes the command specified by the command line.- 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.
-
-