Class DirectoryScanner


  • public class DirectoryScanner
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      DirectoryScanner​(Repository repository)
      Build a new DirectoryScanner for the specified repository.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<java.io.File> getFilesToProcess()
      Retrieve the set of all the files that have to be processed.
      long getLastScanDuration()
      Retrieve the last scan duration
      java.util.Date getLastScanEndDate()
      Retrieve the last scan date
      long getLastScanFileCount()
      Retrieve the number of files found in the last scan
      boolean isPartialScan()
      Check if the last scan was interrupted because the maximum number of file per scan was reached.
      boolean isRunning()
      Check if this directory scanner is currently running.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DirectoryScanner

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

      • 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 java.util.Set<java.io.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 java.util.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