Class DefaultCommandExec
- java.lang.Object
-
- com.anrisoftware.globalpom.exec.internal.core.DefaultCommandExec
-
- All Implemented Interfaces:
CommandExec
public class DefaultCommandExec extends Object implements CommandExec
Executes an external command.- Since:
- 1.11
- Author:
- Erwin Mueller, erwin.mueller@deventm.org
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CommandExeccreateCommandExec()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... 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.StringtoString()
-
-
-
Method Detail
-
createCommandExec
public static CommandExec createCommandExec()
- Returns:
- the
CommandExec - See Also:
CommandExecFactory.create()
-
setThreads
public void setThreads(Threads threads)
Description copied from interface:CommandExecSets the threads pool.- Specified by:
setThreadsin interfaceCommandExec- Parameters:
threads- theThreads.
-
setCommandOutput
public void setCommandOutput(CommandOutput output)
Description copied from interface:CommandExecSets that reads the standard output of the command.- Specified by:
setCommandOutputin interfaceCommandExec- Parameters:
output- theCommandOutput.
-
setCommandError
public void setCommandError(CommandOutput error)
Description copied from interface:CommandExecSets that reads the error output of the command.- Specified by:
setCommandErrorin interfaceCommandExec- Parameters:
error- theCommandOutput.
-
setCommandInput
public void setCommandInput(CommandInput input)
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
public void setObserver(Observer... observer)
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.
-
-