com.atlassian.plugin
Interface PluginController

All Known Subinterfaces:
PluginManager
All Known Implementing Classes:
DefaultPluginManager, DefaultPluginManager

public interface PluginController

Interface to control the state of the plugin system


Method Summary
 void disablePlugin(String key)
          Disables the plugin with the given key.
 void disablePluginModule(String completeKey)
          Disable a plugin module by key.
 void disablePluginWithoutPersisting(String key)
          Disables the plugin with the given key without persisting the disabled state.
 void enablePlugin(String key)
          Deprecated. since 2.5.0, use {#link enablePlugins(String... keys)} instead
 void enablePluginModule(String completeKey)
          Enable a plugin module by key.
 void enablePlugins(String... keys)
          Enable a set of plugins by key.
 String installPlugin(PluginArtifact pluginArtifact)
          Deprecated. Since 2.3.0, use installPlugins(PluginArtifact...) instead
 Set<String> installPlugins(PluginArtifact... pluginArtifacts)
          Installs multiple plugins and returns the list of plugin keys.
 void revertRestartRequiredChange(String pluginKey)
          Restores the state of any plugin requiring a restart that had been removed, upgraded, or installed.
 int scanForNewPlugins()
          Search all loaders and add any new plugins you find.
 void uninstall(Plugin plugin)
          Uninstall the plugin, disabling it first.
 

Method Detail

enablePlugin

void enablePlugin(String key)
Deprecated. since 2.5.0, use {#link enablePlugins(String... keys)} instead

Enable a plugin by key.

Parameters:
key - The plugin key.

enablePlugins

void enablePlugins(String... keys)
Enable a set of plugins by key. This will implicitly and recursively enable all dependent plugins

Parameters:
keys - The plugin keys. Must not be null.
Since:
2.5.0

disablePlugin

void disablePlugin(String key)
Disables the plugin with the given key.

Calling this method will persist the disabled state so that the plugin will also be disabled on next startup. This would normally be used when a user manually disables a plugin.

If you extend DefaultPluginManager and override this method, you will also need to override disablePluginWithoutPersisting(String).

Parameters:
key - The plugin key.
See Also:
disablePluginWithoutPersisting(String)

disablePluginWithoutPersisting

void disablePluginWithoutPersisting(String key)
Disables the plugin with the given key without persisting the disabled state.

Calling this method will NOT persist the disabled state so that the framework will try to enable the plugin on next startup. This is used when a plugin has errors on startup.

If you extend DefaultPluginManager and override disablePlugin(String), you will also need to override this method.

Parameters:
key - The plugin key.
Since:
2.3.0
See Also:
disablePlugin(String)

enablePluginModule

void enablePluginModule(String completeKey)
Enable a plugin module by key.

Parameters:
completeKey - The "complete key" of the plugin module.

disablePluginModule

void disablePluginModule(String completeKey)
Disable a plugin module by key.

Parameters:
completeKey - The "complete key" of the plugin module.

installPlugin

String installPlugin(PluginArtifact pluginArtifact)
                     throws PluginParseException
Deprecated. Since 2.3.0, use installPlugins(PluginArtifact...) instead

Installs a plugin and returns the plugin key

Parameters:
pluginArtifact - The plugin artifact to install
Returns:
The plugin key
Throws:
PluginParseException - if the plugin is not a valid plugin

installPlugins

Set<String> installPlugins(PluginArtifact... pluginArtifacts)
                           throws PluginParseException
Installs multiple plugins and returns the list of plugin keys. All plugin artifacts must be for valid plugins or none will be installed.

Parameters:
pluginArtifacts - The list of plugin artifacts to install
Returns:
A list of plugin keys
Throws:
PluginParseException - if any plugin is not a valid plugin
Since:
2.3.0

uninstall

void uninstall(Plugin plugin)
               throws PluginException
Uninstall the plugin, disabling it first.

Parameters:
plugin - The plugin.
Throws:
PluginException - if there was some problem uninstalling the plugin.

revertRestartRequiredChange

void revertRestartRequiredChange(String pluginKey)
                                 throws PluginException
Restores the state of any plugin requiring a restart that had been removed, upgraded, or installed. If marked as removed, the mark will be deleted. If marked as upgrade, an attempt to restore the original plugin artifact will be made. If marked as install, the artifact will be deleted.

Parameters:
pluginKey - The plugin key
Throws:
PluginException - if there was some problem reverting the plugin state.
IllegalArgumentException - if the plugin key is null or cannot be resolved to a plugin
Since:
2.5.0

scanForNewPlugins

int scanForNewPlugins()
                      throws PluginParseException
Search all loaders and add any new plugins you find.

Returns:
The number of new plugins found.
Throws:
PluginParseException


Copyright © 2011 Atlassian. All Rights Reserved.