public interface

PluginController

com.atlassian.plugin.PluginController
Known Indirect Subclasses

Class Overview

Interface to control the state of the plugin system

Summary

Public Methods
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)
This method is 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)
This method is 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.

Public Methods

public 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.

public void disablePluginModule (String completeKey)

Disable a plugin module by key.

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

public 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.

public void enablePlugin (String key)

This method is deprecated.
since 2.5.0, use {#link enablePlugins(String... keys)} instead

Enable a plugin by key.

Parameters
key The plugin key.

public void enablePluginModule (String completeKey)

Enable a plugin module by key.

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

public 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.

public String installPlugin (PluginArtifact pluginArtifact)

This method is 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

public Set<String> installPlugins (PluginArtifact... pluginArtifacts)

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

public void revertRestartRequiredChange (String pluginKey)

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

public int scanForNewPlugins ()

Search all loaders and add any new plugins you find.

Returns
  • The number of new plugins found.

public void uninstall (Plugin plugin)

Uninstall the plugin, disabling it first.

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