1 package com.atlassian.plugin.loaders;
2
3 import com.atlassian.plugin.ModuleDescriptorFactory;
4 import com.atlassian.plugin.Plugin;
5 import com.atlassian.plugin.PluginException;
6 import com.atlassian.plugin.PluginParseException;
7
8 /**
9 * Handles loading and unloading plugin artifacts from a location
10 */
11 public interface PluginLoader
12 {
13 /**
14 * Loads all plugins that can be installed in the plugin system.
15 * @param moduleDescriptorFactory the factory for module descriptors
16 * @return the list of found plugins, may be empty
17 * @throws PluginParseException if any error occurred loading plugins
18 */
19 Iterable<Plugin> loadAllPlugins(ModuleDescriptorFactory moduleDescriptorFactory) throws PluginParseException;
20
21 /**
22 * Load all newly found plugins that can be installed in the plugin system. Only plugins not previously loaded will
23 * be added.
24 * @param moduleDescriptorFactory the factory for module descriptors
25 * @return a list of newly discovered plugins since the last time plugins were loaded
26 * @throws PluginParseException if any error occurred loading plugins
27 */
28 Iterable<Plugin> loadFoundPlugins(ModuleDescriptorFactory moduleDescriptorFactory) throws PluginParseException;
29
30 /**
31 * @return true if this PluginLoader tracks whether or not plugins are added to it.
32 */
33 boolean supportsAddition();
34
35 /**
36 * @return true if this PluginLoader tracks whether or not plugins are removed from it.
37 */
38 boolean supportsRemoval();
39
40 /**
41 * Remove a specific plugin
42 */
43 void removePlugin(Plugin plugin) throws PluginException;
44
45 /**
46 * @return {@code true} if this plugin loader can load plugins dynamically
47 * @since 3.0
48 */
49 boolean isDynamicPluginLoader();
50 }