1 package com.atlassian.plugin.loaders.classloading;
2
3 import com.atlassian.plugin.PluginException;
4
5 import java.io.File;
6 import java.util.Collection;
7
8 /**
9 * Monitors some hypothetical space for deployed plugins. Due to limitations in the plugin system, plugins must
10 * at some point be represented as files, so for situations where plugins are not files (i.e. database-stored
11 * plugins) the scanner is responsible for copying them to the filesystem before they are used)
12 *
13 * @since 2.1.0
14 */
15 public interface Scanner
16 {
17 /**
18 * Scan for new deployment units. On the first scan, all deployment units that the scanner can find will
19 * be returned. Subsequent scans will only return deployment units that are new since the last scan (or
20 * call to reset() or clear())
21 *
22 * @return all new deployment units since the last scan
23 */
24 Collection<DeploymentUnit> scan();
25
26 /**
27 * Gets all deployment units currently being tracked by the scanner. This <i>will not</i> trigger
28 * a scan, meaning that plugins that have been added since the last scan will not be returned.
29 *
30 * @return a collection of all deployment units currently being tracked by the scanner.
31 */
32 Collection<DeploymentUnit> getDeploymentUnits();
33
34 /**
35 * Reset the scanner. This causes it to forget all state about which plugins have (or haven't) been loaded.
36 */
37 void reset();
38
39 /**
40 * Remove the specified deployment unit in such a way as it will not be picked up by subsequent scans, even
41 * if the system is restarted.
42 *
43 * @param unit the deployment unit to remove
44 * @throws PluginException if the unit has not been properly removed: i.e. a restart would mean the unit would
45 * be reloaded.
46 */
47 void remove(DeploymentUnit unit) throws PluginException;
48 }