net.chaosserver.bilbo.task
Class RecursiveTask

java.lang.Object
  |
  +--net.chaosserver.bilbo.task.BaseTask
        |
        +--net.chaosserver.bilbo.task.RecursiveTask
All Implemented Interfaces:
Task
Direct Known Subclasses:
LeafFirstRecursiveTask, RootFirstRecursiveTask

public abstract class RecursiveTask
extends BaseTask

Task that will recursively execute against a directory.

The concrete tasks will have methods to deal with only a single directory and this task will traverse the tree executing the subtask against it. The task will fully execute against a directory before moving on to the sub-directories.

Since:
Bilbo 2.0

Field Summary
 
Fields inherited from class net.chaosserver.bilbo.task.BaseTask
settings
 
Constructor Summary
RecursiveTask()
           
 
Method Summary
protected abstract  void execute(File currentDirectory)
          Executes this task against the given directory
protected abstract  void executeRecursive(File currentDirectory)
          Executes this task against the given directory and recursive against all subdirectories.
 void executeSpecific()
          Executes this task against the rootDirectory provided in the settings object.
protected  boolean isRootDirectory(File directory)
          Checks if the given directory is the root directory of the task.
 
Methods inherited from class net.chaosserver.bilbo.task.BaseTask
execute, getHelpResource, getSettings, parseTaskArguments, printHelp, setSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecursiveTask

public RecursiveTask()
Method Detail

executeSpecific

public void executeSpecific()
                     throws TaskException
Executes this task against the rootDirectory provided in the settings object.

This task will at least be executed against the rootDirectory in the settings object. If the recursive flag is on, then it will also be executed against each subdirectory.

Specified by:
executeSpecific in class BaseTask
Throws:
TaskException - if something goes wrong

isRootDirectory

protected boolean isRootDirectory(File directory)
Checks if the given directory is the root directory of the task.

Parameters:
directory - check if this is the root
Returns:
if it is the root directory

executeRecursive

protected abstract void executeRecursive(File currentDirectory)
                                  throws TaskException
Executes this task against the given directory and recursive against all subdirectories.

Parameters:
currentDirectory - the directory to execute the task against
Throws:
TaskException - is something goes wrong

execute

protected abstract void execute(File currentDirectory)
                         throws TaskException
Executes this task against the given directory

Parameters:
currentDirectory - the directory to execute the task against
Throws:
TaskException - is something goes wrong


Copyright © 20030415