com.atlassian.plugin.manager
Class DefaultPluginPersistentState

java.lang.Object
  extended by com.atlassian.plugin.manager.DefaultPluginPersistentState
All Implemented Interfaces:
PluginPersistentState, java.io.Serializable

public final class DefaultPluginPersistentState
extends java.lang.Object
implements java.io.Serializable, PluginPersistentState

Immutable implementation of the PluginPersistentState interface.

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.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.plugin.manager.PluginPersistentState
PluginPersistentState.Builder, PluginPersistentState.Util
 
Constructor Summary
DefaultPluginPersistentState()
          Deprecated. create PluginPersistentState instances using the PluginPersistentState.Builder
DefaultPluginPersistentState(java.util.Map<java.lang.String,java.lang.Boolean> map)
          Deprecated. create PluginPersistentState instances using the PluginPersistentState.Builder
DefaultPluginPersistentState(PluginPersistentState state)
          Deprecated. 
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Boolean> getMap()
          Get the map of all states.
 PluginRestartState getPluginRestartState(java.lang.String pluginKey)
          Gets whether the plugin is expected to be upgraded, installed, or removed on next restart
 java.util.Map<java.lang.String,java.lang.Boolean> getPluginStateMap(Plugin plugin)
          Get state map of the given plugin and its modules
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPluginPersistentState

@Deprecated
public DefaultPluginPersistentState()
Deprecated. create PluginPersistentState instances using the PluginPersistentState.Builder

Creates an empty PluginPersistentState.


DefaultPluginPersistentState

@Deprecated
public DefaultPluginPersistentState(java.util.Map<java.lang.String,java.lang.Boolean> map)
Deprecated. create PluginPersistentState instances using the PluginPersistentState.Builder

Creates a PluginPersistentState with the supplied states.

Parameters:
map - of the plugin states using the Plugin.getKey() as the key.

DefaultPluginPersistentState

@Deprecated
public DefaultPluginPersistentState(PluginPersistentState state)
Deprecated. 

Copy constructor. Doesn't make sense to use as the map is immutable. Just use the

Parameters:
state -
Method Detail

getMap

public java.util.Map<java.lang.String,java.lang.Boolean> getMap()
Description copied from interface: PluginPersistentState
Get the map of all states.

Specified by:
getMap in interface PluginPersistentState
Returns:
The map that maps plugins and modules' keys to a state (Boolean.True/Boolean.False). State stored in this map represents only the differences between the current state and the default state configured in the plugin(module).

isEnabled

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

Specified by:
isEnabled in interface PluginPersistentState

isEnabled

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

Specified by:
isEnabled in interface PluginPersistentState

getPluginStateMap

public java.util.Map<java.lang.String,java.lang.Boolean> getPluginStateMap(Plugin plugin)
Description copied from interface: PluginPersistentState
Get state map of the given plugin and its modules

Specified by:
getPluginStateMap in interface PluginPersistentState
Returns:
The map that maps the plugin and its modules' keys to plugin state (Boolean.TRUE/Boolean.FALSE). State stored in this map represents only the differences between the current state and the default state configured in the plugin(module).

getPluginRestartState

public PluginRestartState getPluginRestartState(java.lang.String pluginKey)
Description copied from interface: PluginPersistentState
Gets whether the plugin is expected to be upgraded, installed, or removed on next restart

Specified by:
getPluginRestartState in interface PluginPersistentState
Parameters:
pluginKey - The plugin to query
Returns:
The state of the plugin on restart


Copyright © 2013 Atlassian. All Rights Reserved.