org.schmant.task.template.process
Class AbstractExtProcessTask<T extends AbstractExtProcessTask<T>>
java.lang.Object
org.schmant.support.AbstractArgumentChecker
org.schmant.task.stub.AbstractTask<T>
org.schmant.task.template.process.AbstractExtProcessTask<T>
- All Implemented Interfaces:
- TaskDependency, LoggingConfigurable<T>, Task, TaskRunnable, TaskSpecification<T>, ExtProcessConfigured, ExtProcessTask<T>
- Direct Known Subclasses:
- AbstractExtJvmTask, AntTask, ExtJarSignerTask, ExtProcessTask
public abstract class AbstractExtProcessTask<T extends AbstractExtProcessTask<T>>
- extends AbstractTask<T>
- implements ExtProcessTask<T>
Abstract base class for tasks running an external program.
- Since:
- 0.5
- Author:
- Karl Gustafsson
Methods inherited from class org.schmant.task.stub.AbstractTask |
cancel, createTask, getDefaultLogFooter, getDefaultLogHeader, getDependencyForTasksScheduledByThisTask, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, runInternal, setLogFooter, setLogHeader, setReportLevel, setTraceLogging, toString, validate |
AbstractExtProcessTask
public AbstractExtProcessTask()
getProcessResult
public ProcessResult getProcessResult()
- Get the result of the external program.
- Specified by:
getProcessResult
in interface ExtProcessTask<T extends AbstractExtProcessTask<T>>
- Returns:
- The result of the external program.
getArguments
protected final List<String> getArguments()
isFailOnErrors
public final boolean isFailOnErrors()
- Specified by:
isFailOnErrors
in interface ExtProcessConfigured
getWorkingDirectory
public final Object getWorkingDirectory()
- Specified by:
getWorkingDirectory
in interface ExtProcessConfigured
getEnvironmentVariables
public final List<String> getEnvironmentVariables()
- Specified by:
getEnvironmentVariables
in interface ExtProcessConfigured
isInheritEnvironmentVariables
public final boolean isInheritEnvironmentVariables()
- Specified by:
isInheritEnvironmentVariables
in interface ExtProcessConfigured
getStdoutStrategy
public final ProcessOutputStrategy getStdoutStrategy()
- Specified by:
getStdoutStrategy
in interface ExtProcessConfigured
getStderrStrategy
public final ProcessOutputStrategy getStderrStrategy()
- Specified by:
getStderrStrategy
in interface ExtProcessConfigured
addArgumentsToCommandList
protected void addArgumentsToCommandList(ArgumentList al)
- Add the program arguments to the list (which will be modified by this
operation).
- Parameters:
al
- The list of program arguments. Modified by this call.
execAndWait
protected ProcessResult execAndWait(ArgumentList al)
throws InterruptedException
- Run the external program. This method configures the process with
environment variables, etc.
- Parameters:
al
- A list of the command to run and its arguments.
- Returns:
- The result of the process.
- Throws:
InterruptedException
- If the thread is interrupted.
copyProperties
public void copyProperties(T spec)
- Description copied from class:
AbstractTask
- Copy the properties to the target object.
Subclasses must override this to copy their properties. The
overriding method must call super.copyProperties
.
- Specified by:
copyProperties
in interface TaskSpecification<T extends AbstractExtProcessTask<T>>
- Overrides:
copyProperties
in class AbstractTask<T extends AbstractExtProcessTask<T>>
- Parameters:
spec
- The specification to copy properties to.