com.atlassian.plugin.loaders
Class RosterFileScanner

java.lang.Object
  extended by com.atlassian.plugin.loaders.RosterFileScanner
All Implemented Interfaces:
Scanner

public class RosterFileScanner
extends Object
implements Scanner

A Scanner which polls a file containing a list of file names to define its content.

Since:
3.0.24

Constructor Summary
RosterFileScanner(File rosterFile)
          Create a roster file scanner which loads the given roster file to locate plugins.
 
Method Summary
 Collection<DeploymentUnit> getDeploymentUnits()
          Gets all deployment units currently being tracked by the scanner.
static String getListSuffix()
          The suffix for a roster file containing a simple plugin list.
static boolean isKnownRosterFileFormat(File rosterFile)
          Check whether a proposed roster file is in a known format.
 void remove(DeploymentUnit deploymentUnit)
          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()
          Reset the scanner.
 Collection<DeploymentUnit> scan()
          Scan for new deployment units.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RosterFileScanner

public RosterFileScanner(File rosterFile)
Create a roster file scanner which loads the given roster file to locate plugins.

The provided roster file format is determined by its file suffix. Currently supported suffixes are - getListSuffix(): a list of file paths, one per line If the format is not recognized, an IllegalArgumentException is thrown. This can be checked before construction using isKnownRosterFileFormat(File).

Parameters:
rosterFile - the file to load the plugin roster from.
Throws:
IllegalArgumentException - if the suffix of rosterFile is not a supported file format
Method Detail

scan

public Collection<DeploymentUnit> scan()
Description copied from interface: Scanner
Scan for new deployment units. On the first scan, all deployment units that the scanner can find will be returned. Subsequent scans will only return deployment units that are new since the last scan (or call to reset() or clear())

Specified by:
scan in interface Scanner
Returns:
all new deployment units since the last scan

getDeploymentUnits

public Collection<DeploymentUnit> getDeploymentUnits()
Description copied from interface: Scanner
Gets all deployment units currently being tracked by the scanner. This will not trigger a scan, meaning that plugins that have been added since the last scan will not be returned.

Specified by:
getDeploymentUnits in interface Scanner
Returns:
a collection of all deployment units currently being tracked by the scanner.

reset

public void reset()
Description copied from interface: Scanner
Reset the scanner. This causes it to forget all state about which plugins have (or haven't) been loaded.

Specified by:
reset in interface Scanner

remove

public void remove(DeploymentUnit deploymentUnit)
            throws PluginException
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:
deploymentUnit - the deployment unit to remove
Throws:
PluginException - if the unit has not been properly removed: i.e. a restart would mean the unit would be reloaded.

getListSuffix

public static String getListSuffix()
The suffix for a roster file containing a simple plugin list.

Roster files with this suffix have one literal path per line. Relative paths are resolved relative to the directory containing the list file. Entries are considered distinct or not based on the path used in the file - no canonicalization is forced.

Returns:
the suffix used for roster files containing just a list of plugin jar files.

isKnownRosterFileFormat

public static boolean isKnownRosterFileFormat(File rosterFile)
Check whether a proposed roster file is in a known format.

Parameters:
rosterFile - the roster file to check.
Returns:
true if the format of the roster file is known.
See Also:
RosterFileScanner


Copyright © 2015 Atlassian. All rights reserved.