com.atlassian.plugin
Class PluginManagerState

java.lang.Object
  extended by com.atlassian.plugin.PluginManagerState
All Implemented Interfaces:
java.io.Serializable

public class PluginManagerState
extends java.lang.Object
implements java.io.Serializable

Represents a configuration state for plugins and plugin modules. The configuration state (enabled or disabled) is separate from the plugins and modules themselves because a plugin may have multiple states depending on the context.

The state stored in this object represents only the differences between the desired state and the default state configured in the plugin. So if "getPluginState()" or "getPluginModuleState()" return null, then the manager should assume that the default state applies instead.

Please note that this method is not threadsafe. Access to instances should be synchronised.

See Also:
Serialized Form

Constructor Summary
PluginManagerState()
           
PluginManagerState(java.util.Map<java.lang.String,java.lang.Boolean> map)
           
PluginManagerState(PluginManagerState state)
           
 
Method Summary
 void addState(java.util.Map<java.lang.String,java.lang.Boolean> state)
          Add the plugin state.
 java.util.Map<java.lang.String,java.lang.Boolean> getMap()
          Get the map of all states.
 java.util.Map<java.lang.String,java.lang.Boolean> getPluginStateMap(Plugin plugin)
           
 java.lang.Boolean getState(java.lang.String key)
          Get the state of a given plugin.
 boolean isEnabled(ModuleDescriptor<?> pluginModule)
          Whether or not a given plugin module is enabled in this state, calculated from it's current state AND default state.
 boolean isEnabled(Plugin plugin)
          Whether or not a plugin is enabled, calculated from it's current state AND default state.
 void removeState(java.lang.String key)
          Remove a plugin's state.
 void setState(PluginManagerState state)
          reset all plugin's state.
 void setState(java.lang.String key, java.lang.Boolean enabled)
          Set a plugins state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginManagerState

public PluginManagerState()

PluginManagerState

public PluginManagerState(java.util.Map<java.lang.String,java.lang.Boolean> map)

PluginManagerState

public PluginManagerState(PluginManagerState state)
Method Detail

getState

public java.lang.Boolean getState(java.lang.String key)
Get the state of a given plugin.


getMap

public java.util.Map<java.lang.String,java.lang.Boolean> getMap()
Get the map of all states.


isEnabled

public boolean isEnabled(Plugin plugin)
Whether or not a plugin is enabled, calculated from it's current state AND default state.


isEnabled

public boolean isEnabled(ModuleDescriptor<?> pluginModule)
Whether or not a given plugin module is enabled in this state, calculated from it's current state AND default state.


setState

public void setState(java.lang.String key,
                     java.lang.Boolean enabled)
Set a plugins state.


setState

public void setState(PluginManagerState state)
reset all plugin's state.


addState

public void addState(java.util.Map<java.lang.String,java.lang.Boolean> state)
Add the plugin state.


removeState

public void removeState(java.lang.String key)
Remove a plugin's state.


getPluginStateMap

public java.util.Map<java.lang.String,java.lang.Boolean> getPluginStateMap(Plugin plugin)


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.