Package de.japrost.staproma
Class TaskFileWalker
- java.lang.Object
-
- org.apache.commons.io.DirectoryWalker<java.lang.String>
-
- de.japrost.staproma.TaskFileWalker
-
public class TaskFileWalker extends org.apache.commons.io.DirectoryWalker<java.lang.String>
The TaksFileWalker scans the given directory for files and directories to convert them to a Task tree.- Author:
- alexxismachine (Ulrich David)
-
-
Constructor Summary
Constructors Constructor Description TaskFileWalker(Task rootTask, java.io.File startDirectory, org.apache.commons.io.filefilter.IOFileFilter fileFilter)
Instanciate a with the given parameters.TaskFileWalker(Task rootTask, java.io.File startDirectory, org.apache.commons.io.filefilter.IOFileFilter fileFilter, SpmFormatFactory spmFormatFactory, boolean filterCompleted)
Instanciate a with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
crawl()
Start the walk.protected java.io.File[]
filterDirectoryContents(java.io.File directory, int depth, java.io.File[] inFiles)
protected boolean
handleDirectory(java.io.File directory, int depth, java.util.Collection<java.lang.String> results)
protected void
handleFile(java.io.File file, int depth, java.util.Collection<java.lang.String> results)
-
-
-
Constructor Detail
-
TaskFileWalker
public TaskFileWalker(Task rootTask, java.io.File startDirectory, org.apache.commons.io.filefilter.IOFileFilter fileFilter)
Instanciate a with the given parameters. This instance will use theDefaultSpmFactory
and filter completed tasks.- Parameters:
rootTask
- the task to add the found tasks to.startDirectory
- the base directory for the scan.fileFilter
- the file filter to use.
-
TaskFileWalker
public TaskFileWalker(Task rootTask, java.io.File startDirectory, org.apache.commons.io.filefilter.IOFileFilter fileFilter, SpmFormatFactory spmFormatFactory, boolean filterCompleted)
Instanciate a with the given parameters.- Parameters:
rootTask
- the task to add the found tasks to.startDirectory
- the base directory for the scan.fileFilter
- the file filter to use.spmFormatFactory
- the factory to createSpmFormat
s.filterCompleted
- flag if completed tasks should be filtered.
-
-
Method Detail
-
crawl
public void crawl() throws java.io.IOException
Start the walk.- Throws:
java.io.IOException
- on io errors.
-
handleDirectory
protected boolean handleDirectory(java.io.File directory, int depth, java.util.Collection<java.lang.String> results) throws java.io.IOException
- Overrides:
handleDirectory
in classorg.apache.commons.io.DirectoryWalker<java.lang.String>
- Throws:
java.io.IOException
-
handleFile
protected void handleFile(java.io.File file, int depth, java.util.Collection<java.lang.String> results) throws java.io.IOException
- Overrides:
handleFile
in classorg.apache.commons.io.DirectoryWalker<java.lang.String>
- Throws:
java.io.IOException
-
filterDirectoryContents
protected java.io.File[] filterDirectoryContents(java.io.File directory, int depth, java.io.File[] inFiles) throws java.io.IOException
- Overrides:
filterDirectoryContents
in classorg.apache.commons.io.DirectoryWalker<java.lang.String>
- Throws:
java.io.IOException
-
-