org.schmant.task.stub
Class AbstractCallbackRecursiveActionTask<T extends RecursiveActionTaskSpec<T>>

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.task.stub.AbstractTask<T>
          extended by org.schmant.task.stub.AbstractActionTask<T>
              extended by org.schmant.task.stub.AbstractCallbackRecursiveActionTask<T>
All Implemented Interfaces:
TaskDependency, ActionTaskConfigurable<T>, ActionTaskSpec<T>, LoggingConfigurable<T>, SourceConfigurable<T>, SourceConfigured, RecursiveActionTaskConfigurable<T>, RecursiveActionTaskSpec<T>, Task, TaskRunnable, TaskSpecification<T>
Direct Known Subclasses:
RecursiveActionTask

public abstract class AbstractCallbackRecursiveActionTask<T extends RecursiveActionTaskSpec<T>>
extends AbstractActionTask<T>
implements RecursiveActionTaskSpec<T>

This is an abstract base class for recursive action task implementations. The runInternal(Report) method iterates over all sources recursively and calls the callback(Report, EntityView, RelativeLocation) for each returned entity.

This class interprets the sources property using InterpretAsDirectoryStrategy.

Since:
0.5
Author:
Karl Gustafsson

Constructor Summary
AbstractCallbackRecursiveActionTask()
           
 
Method Summary
protected abstract  void callback(Report r, EntityView ev, RelativeLocation rel)
          This method is called for each entity returned when iterating over the sources.
 void copyProperties(T spec)
          Override the implementation from AbstractTask to copy the source properties.
protected  boolean isDisableHeaderLogging()
           
protected  boolean isMoreThanOneSourceAllowed()
          This is overridden to return true.
protected  void runInternal(Report r)
          Iterates recursively over all sources (interpreted by InterpretAsDirectoryStrategy) and calls the callback(Report, EntityView, RelativeLocation) method for each returned entity.
 T setDepthFirstIterator(boolean b)
          Should a depth first iterator be used?
 T setDisableHeaderLogging(boolean b)
          Should logging for nested tasks be disabled?
 
Methods inherited from class org.schmant.task.stub.AbstractActionTask
addSource, addSources, clearSources, getRelativeToBase, getSource, getSources, isSourcesMandatory, setRelativeToBase, setSource, setSources, toString, validate
 
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
 
Methods inherited from class org.schmant.support.AbstractArgumentChecker
check, check, check, check
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.schmant.task.TaskSpecification
createTask
 
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable
setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 
Methods inherited from interface org.schmant.task.confable.SourceConfigured
getSource, getSources
 
Methods inherited from interface org.schmant.task.confable.SourceConfigurable
addSource, addSources, clearSources, setRelativeToBase, setSource, setSources
 

Constructor Detail

AbstractCallbackRecursiveActionTask

public AbstractCallbackRecursiveActionTask()
Method Detail

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 RecursiveActionTaskSpec<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 RecursiveActionTaskSpec<T>>
Parameters:
b - true if logging for nested tasks should be disabled.
Returns:
this

isDisableHeaderLogging

protected final boolean isDisableHeaderLogging()

callback

protected abstract void callback(Report r,
                                 EntityView ev,
                                 RelativeLocation rel)
This method is called for each entity returned when iterating over the sources.

Parameters:
r - The current report.
ev - The entity.
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.

isMoreThanOneSourceAllowed

protected boolean isMoreThanOneSourceAllowed()
This is overridden to return true.

Overrides:
isMoreThanOneSourceAllowed in class AbstractActionTask<T extends RecursiveActionTaskSpec<T>>
Returns:
false, always

runInternal

protected final void runInternal(Report r)
Iterates recursively over all sources (interpreted by InterpretAsDirectoryStrategy) and calls the callback(Report, EntityView, RelativeLocation) method for each returned entity.

Specified by:
runInternal in class AbstractTask<T extends RecursiveActionTaskSpec<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 RecursiveActionTaskSpec<T>>
Overrides:
copyProperties in class AbstractActionTask<T extends RecursiveActionTaskSpec<T>>
Parameters:
spec - The specification to copy properties to.