Class DirectoryScanner

java.lang.Object
com.atlassian.plugin.loaders.DirectoryScanner
All Implemented Interfaces:
Scanner

public class DirectoryScanner extends Object implements Scanner
Scans the filesystem for changed or added plugin files and stores a map of the currently known ones. Files beginning with "." are ignored.
Since:
2.1.0
  • Constructor Details

    • DirectoryScanner

      public DirectoryScanner(File pluginsDirectory)
      Constructor for scanner.
      Parameters:
      pluginsDirectory - the directory that the scanner should monitor for plugins
  • Method Details

    • locateDeploymentUnit

      public DeploymentUnit locateDeploymentUnit(File file)
      Given a file, finds the deployment unit for it if one has already been scanned.
      Parameters:
      file - a jar file.
      Returns:
      the stored deploymentUnit matching the file or null if none exists.
    • clear

      public void clear(File file)
      Tells the Scanner to forget about a file it has loaded so that it will reload it next time it scans.
      Parameters:
      file - a file that may have already been scanned.
    • scan

      public Collection<DeploymentUnit> scan()
      Scans for all files and directories that have been added or modified since the last call to scan. This will ignore all files or directories starting with the '.' character.
      Specified by:
      scan in interface Scanner
      Returns:
      Collection of DeploymentUnits that describe newly added files or directories.
    • getDeploymentUnits

      public Collection<DeploymentUnit> getDeploymentUnits()
      Retrieve all the DeploymentUnits currently stored.
      Specified by:
      getDeploymentUnits in interface Scanner
      Returns:
      the complete unmodifiable list of scanned DeploymentUnits.
    • reset

      public void reset()
      Clears the list of scanned deployment units.
      Specified by:
      reset in interface Scanner
    • remove

      public void remove(DeploymentUnit unit)
      Description copied from interface: Scanner
      Remove the specified deployment unit in such a way as it will not be picked up by subsequent scans, even if the system is restarted.
      Specified by:
      remove in interface Scanner
      Parameters:
      unit - the deployment unit to remove