public class

DirectoryScanner

extends Object
implements Scanner
java.lang.Object
   ↳ com.atlassian.plugin.loaders.DirectoryScanner

Class Overview

Scans the filesystem for changed or added plugin files and stores a map of the currently known ones. Files beginning with "." are ignored.

Summary

Public Constructors
DirectoryScanner(File pluginsDirectory)
Constructor for scanner.
Public Methods
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.
Collection<DeploymentUnit> getDeploymentUnits()
Retrieve all the DeploymentUnits currently stored.
DeploymentUnit locateDeploymentUnit(File file)
Given a file, finds the deployment unit for it if one has already been scanned.
void remove(DeploymentUnit unit)
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.
void reset()
Clears the list of scanned deployment units.
Collection<DeploymentUnit> scan()
Scans for all files and directories that have been added or modified since the last call to scan.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.loaders.classloading.Scanner

Public Constructors

public DirectoryScanner (File pluginsDirectory)

Constructor for scanner.

Parameters
pluginsDirectory the directory that the scanner should monitor for plugins

Public Methods

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.

public Collection<DeploymentUnit> getDeploymentUnits ()

Retrieve all the DeploymentUnits currently stored.

Returns

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.

public void remove (DeploymentUnit unit)

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.

Parameters
unit the deployment unit to remove

public void reset ()

Clears the list of scanned deployment units.

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.

Returns
  • Collection of DeploymentUnits that describe newly added files or directories.