Class DirectoryScanner

java.lang.Object
com.jalios.jcms.fileprocessor.DirectoryScanner

public class DirectoryScanner extends Object
This class perform a scan of the repository base directory.

It lists all the files to process.

This scanner will not process more files in once scan than the number specified in the repository configuration through property "maxFilesPerScan", which default value is 50000.
The remaining files will be processed during the next invocation to the scanner.

  • Constructor Details

    • DirectoryScanner

      public DirectoryScanner(Repository repository)
      Build a new DirectoryScanner for the specified repository.
      Parameters:
      repository - the repository for which this DirectoryScanner will work
  • Method Details

    • scan

      public void scan()
      Scan recursively the repository's directory and maintains in memory all files that have to be process, it associates FILE_CREATE_OR_UPDATE operation.
    • isRunning

      public boolean isRunning()
      Check if this directory scanner is currently running.
      Returns:
      true if it is running, false otherwise
    • getFilesToProcess

      public Set<File> getFilesToProcess()
      Retrieve the set of all the files that have to be processed.
      Returns:
      all files to process
    • isPartialScan

      public boolean isPartialScan()
      Check if the last scan was interrupted because the maximum number of file per scan was reached.
      Returns:
      true if the directory scan was interrupted, false if it completed till the end.
      Since:
      jcms-7.0
    • getLastScanEndDate

      public Date getLastScanEndDate()
      Retrieve the last scan date
      Returns:
      a date or null if no scan occured
    • getLastScanDuration

      public long getLastScanDuration()
      Retrieve the last scan duration
      Returns:
      a duration in millis
    • getLastScanFileCount

      public long getLastScanFileCount()
      Retrieve the number of files found in the last scan
      Returns:
      a file count