Class 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)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.commons.io.DirectoryWalker

        org.apache.commons.io.DirectoryWalker.CancelException
    • 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)  
      • Methods inherited from class org.apache.commons.io.DirectoryWalker

        checkIfCancelled, handleCancelled, handleDirectoryEnd, handleDirectoryStart, handleEnd, handleIsCancelled, handleRestricted, handleStart, walk
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 the DefaultSpmFactory 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 create SpmFormats.
        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 class org.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 class org.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 class org.apache.commons.io.DirectoryWalker<java.lang.String>
        Throws:
        java.io.IOException