org.schmant.task.stub
Class AbstractCallbackRecursiveProcessTask<T extends RecursiveProcessTaskSpec<T>>
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<T>
- All Implemented Interfaces:
- TaskDependency, ActionTaskConfigurable<T>, ActionTaskSpec<T>, LoggingConfigurable<T>, OverwriteConfigurable<T>, SourceConfigurable<T>, SourceConfigured, TargetConfigurable<T>, TargetConfigured, GeneratorTaskConfigurable<T>, GeneratorTaskSpec<T>, ProcessTaskConfigurable<T>, ProcessTaskSpec<T>, RecursiveActionTaskConfigurable<T>, RecursiveActionTaskSpec<T>, RecursiveProcessTaskConfigurable<T>, RecursiveProcessTaskSpec<T>, Task, TaskRunnable, TaskSpecification<T>
- Direct Known Subclasses:
- RecursiveProcessTask
public abstract class AbstractCallbackRecursiveProcessTask<T extends RecursiveProcessTaskSpec<T>>
- extends AbstractProcessTask<T>
- implements RecursiveProcessTaskSpec<T>
This is an abstract base class for recursive process task
implementations. The runInternal(Report)
method iterates over all
sources recursively and calls the
callback(Report, EntityView, DirectoryView, RelativeLocation)
for
each returned entity.
This class interprets the sources and target properties using
InterpretAsDirectoryStrategy
.
- 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, setLogFooter, setLogHeader, setReportLevel, setTraceLogging |
AbstractCallbackRecursiveProcessTask
public AbstractCallbackRecursiveProcessTask()
setDepthFirstIterator
public final T setDepthFirstIterator(boolean b)
- Description copied from interface:
RecursiveActionTaskConfigurable
- Should a depth first iterator be used?
- Specified by:
setDepthFirstIterator
in interface RecursiveActionTaskConfigurable<T extends RecursiveProcessTaskSpec<T>>
- Parameters:
b
- true
if a depth first iterator should be used.
- Returns:
this
setDisableHeaderLogging
public final T setDisableHeaderLogging(boolean b)
- Description copied from interface:
RecursiveActionTaskConfigurable
- Should logging for nested tasks be disabled?
By default, logging is disabled.
- Specified by:
setDisableHeaderLogging
in interface RecursiveActionTaskConfigurable<T extends RecursiveProcessTaskSpec<T>>
- Parameters:
b
- true
if logging for nested tasks should be disabled.
- Returns:
this
isDisableHeaderLogging
protected final boolean isDisableHeaderLogging()
isMoreThanOneSourceAllowed
protected boolean isMoreThanOneSourceAllowed()
- Overridden to return
true
.
- Overrides:
isMoreThanOneSourceAllowed
in class AbstractActionTask<T extends RecursiveProcessTaskSpec<T>>
- Returns:
false
, always
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 AbstractProcessTask<T extends RecursiveProcessTaskSpec<T>>
- 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.
callback
protected abstract void callback(Report r,
EntityView ev,
DirectoryView targetDir,
RelativeLocation rel)
- This callback method is called for every entity returned when iterating
recursively over the sources.
- 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.
runInternal
protected final void runInternal(Report r)
- Description copied from class:
AbstractTask
- Subclasses implement this. The task is
AbstractTask.validate(Report)
:d before
this method is called, see AbstractTask.run()
.
- Specified by:
runInternal
in class AbstractTask<T extends RecursiveProcessTaskSpec<T>>
- Parameters:
r
- The current thread's Report
.
copyProperties
public void copyProperties(T 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<T extends RecursiveProcessTaskSpec<T>>
- Overrides:
copyProperties
in class AbstractProcessTask<T extends RecursiveProcessTaskSpec<T>>
- Parameters:
spec
- The specification to copy properties to.