org.schmant.task.meta
Class RecursiveProcessTask
java.lang.Object
org.schmant.support.AbstractArgumentChecker
org.schmant.task.stub.AbstractTask<T>
org.schmant.task.stub.AbstractActionTask<T>
org.schmant.task.stub.AbstractProcessTask<T>
org.schmant.task.stub.AbstractCallbackRecursiveProcessTask<RecursiveProcessTask>
org.schmant.task.meta.RecursiveProcessTask
- All Implemented Interfaces:
- TaskDependency, ActionTaskConfigurable<RecursiveProcessTask>, ActionTaskSpec<RecursiveProcessTask>, LoggingConfigurable<RecursiveProcessTask>, OverwriteConfigurable<RecursiveProcessTask>, SourceConfigurable<RecursiveProcessTask>, SourceConfigured, TargetConfigurable<RecursiveProcessTask>, TargetConfigured, GeneratorTaskConfigurable<RecursiveProcessTask>, GeneratorTaskSpec<RecursiveProcessTask>, ProcessTaskConfigurable<RecursiveProcessTask>, ProcessTaskSpec<RecursiveProcessTask>, RecursiveActionTaskConfigurable<RecursiveProcessTask>, RecursiveActionTaskSpec<RecursiveProcessTask>, RecursiveProcessTaskConfigurable<RecursiveProcessTask>, RecursiveProcessTaskSpec<RecursiveProcessTask>, Task, TaskRunnable, TaskSpecification<RecursiveProcessTask>
public final class RecursiveProcessTask
- extends AbstractCallbackRecursiveProcessTask<RecursiveProcessTask>
See RecursiveProcessTF
- Since:
- 0.5
- Author:
- Karl Gustafsson
- Task_package:
- org.schmant.task.base
Methods inherited from class org.schmant.task.stub.AbstractTask |
cancel, createTask, getDefaultLogFooter, getDefaultLogHeader, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, setLogFooter, setLogHeader, setReportLevel, setTraceLogging |
getTargetStrategy
public Object getTargetStrategy()
- Since
1.1
, this method returns an Object
rather than a
TargetStrategy
object since this now is either a
TargetStrategy
or a closure.
- Returns:
- The target strategy, a
TargetStrategy
or a closure.
runTask
protected void runTask(Report r,
Task t)
validate
protected Collection<String> validate(Report r)
- Description copied from class:
AbstractActionTask
- Override the method inherited from
AbstractTask
to give a validation
error if no source is set (and AbstractActionTask.isSourcesMandatory()
is true
).
Subclasses may override this to add their own validations.
- Overrides:
validate
in class AbstractCallbackRecursiveProcessTask<RecursiveProcessTask>
- Parameters:
r
- A report to log warning and debug messages to. Validation errors
should not be logged, though. They are logged later.
- Returns:
- A collection of error messages.
getTargetFromTargetStrategy
public Object getTargetFromTargetStrategy(EntityView source,
DirectoryView targetDir,
RelativeLocation rel)
- This method interprets the target strategy into an object that can be
used to calculate the target.
The target strategy may be one of the following:
- A
TargetStrategy
object – The
TargetStrategy.getTarget(org.schmant.task.ProcessTaskSpec, DirectoryView, RelativeLocation)
method is called to get the target.
- A closure taking the following arguments, in this order:
- An
EntityView
– The entity being processed.
- A
DirectoryView
– The target base directory.
- A
RelativeLocation
– The source entity's location
relative to the source base directory.
The closure is evaluated to get the target. It should return something
that can be interpreted into a FutureEntity
.
- Parameters:
targetDir
- The base target directory.rel
- The relative location of the processed entity relative to the
base source directory.
- Returns:
- A target location which should be an object that can be
interpreted into a
FutureEntity
.
callback
protected void callback(Report r,
EntityView ev,
DirectoryView targetDir,
RelativeLocation rel)
- Description copied from class:
AbstractCallbackRecursiveProcessTask
- This callback method is called for every entity returned when iterating
recursively over the sources.
- Specified by:
callback
in class AbstractCallbackRecursiveProcessTask<RecursiveProcessTask>
- Parameters:
r
- The current report.ev
- The entity.targetDir
- The target property.rel
- The entity's location relative to the source it was returned
from. If the source object was a file, the relative location is the
file's name.
getDependencyForTasksScheduledByThisTask
public TaskDependency getDependencyForTasksScheduledByThisTask()
- Description copied from class:
AbstractTask
- This implementation returns
this
. Subclasses that use
TaskExecutor
:s must override this method to
return a dependency object for all of its scheduled tasks.
- Specified by:
getDependencyForTasksScheduledByThisTask
in interface Task
- Overrides:
getDependencyForTasksScheduledByThisTask
in class AbstractTask<RecursiveProcessTask>
- Returns:
this
copyProperties
public void copyProperties(RecursiveProcessTask spec)
- Description copied from class:
AbstractActionTask
- Override the implementation from
AbstractTask
to copy the
source properties. Subclasses must override this to copy their own
properties.
- Specified by:
copyProperties
in interface TaskSpecification<RecursiveProcessTask>
- Overrides:
copyProperties
in class AbstractCallbackRecursiveProcessTask<RecursiveProcessTask>
- Parameters:
spec
- The specification to copy properties to.
toString
public String toString()
- Description copied from class:
AbstractTask
- Default implementation for tasks. Task implementations may override this.
It is used in the default log header that is written (level INFO) before
a task is run.
This implementation just returns the class name.
- Overrides:
toString
in class AbstractProcessTask<RecursiveProcessTask>