1 package com.atlassian.plugin;
2
3 import java.util.Map;
4
5 /**
6 * Interface that represents a configuration state for plugins and plugin modules. The configuration state (enabled
7 * or disabled) is separate from the plugins and modules themselves because a plugin may have multiple
8 * states depending on the context.
9 * @author anatoli
10 *
11 */
12 public interface PluginManagerState
13 {
14 /**
15 * Get the map of all states.
16 * @return The map that maps plugins and modules' keys to a state (Boolean.True/Boolean.False). State stored in this map represents only
17 * the <i>differences</i> between the current state and the default state configured in the plugin(module).
18 */
19 Map<String, Boolean> getMap();
20
21 /**
22 * Whether or not a plugin is enabled, calculated from it's current state AND default state.
23 */
24 boolean isEnabled(final Plugin plugin);
25
26 /**
27 * Whether or not a given plugin module is enabled in this state, calculated from it's current state AND default state.
28 */
29 boolean isEnabled(final ModuleDescriptor<?> pluginModule);
30
31 /**
32 * Get state map of the given plugin and its modules
33 * @param plugin
34 * @return The map that maps the plugin and its modules' keys to plugin state (Boolean.TRUE/Boolean.FALSE). State stored in this map represents only
35 * the <i>differences</i> between the current state and the default state configured in the plugin(module).
36 */
37 Map<String, Boolean> getPluginStateMap(final Plugin plugin);
38
39 }