com.atlassian.jira.plugin
Class DefaultPluginInstallationManager

java.lang.Object
  extended by com.atlassian.jira.plugin.DefaultPluginInstallationManager
All Implemented Interfaces:
PluginInstallationManager

public final class DefaultPluginInstallationManager
extends Object
implements PluginInstallationManager

An implementation of the InstallablePluginManager that uses a property set to store the information about which plugins should be installed/upgraded/removed during the next restart.

Since:
v3.13

Constructor Summary
DefaultPluginInstallationManager(ApplicationProperties appProperties, JiraPropertySetFactory propertySetFactory, com.atlassian.plugin.PluginStateStore store)
           
 
Method Summary
 void cancelPluginUpdate(String key)
          Cancel any scheduled changes - install, upgrade or uninstall - for the plugin identified by the key.
 void configurePluginPath(String pluginsPath)
          Configure the manager to store installed, pending, and uninstalled plugins under the given path.
 com.atlassian.plugin.loaders.PluginLoader getInstalledPluginsLoader()
           
 String installPlugin(com.atlassian.plugin.PluginJar pluginJar, com.atlassian.plugin.PluginAccessor pluginAccessor)
          Schedule the plugin to be installed or upgraded, if it is a newer version of a plugin that is already installed, during the next startup cycle.
 boolean isConfigured()
           
 boolean isStarted()
           
 void processUpdates()
          This method is to be called during the JIRA startup process.
protected  void removeStateFromStore(com.atlassian.plugin.PluginStateStore stateStore, String key)
           
 void uninstall(com.atlassian.plugin.Plugin plugin)
          Schedule the plugin to be uninstalled during the next startup cycle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPluginInstallationManager

public DefaultPluginInstallationManager(ApplicationProperties appProperties,
                                        JiraPropertySetFactory propertySetFactory,
                                        com.atlassian.plugin.PluginStateStore store)
Method Detail

isStarted

public boolean isStarted()

isConfigured

public final boolean isConfigured()
Specified by:
isConfigured in interface PluginInstallationManager
Returns:
true if the manager has been configured with a plugin path, false otherwise. The manager can be configured by calling the configurePluginPath() method.

configurePluginPath

public void configurePluginPath(String pluginsPath)
Description copied from interface: PluginInstallationManager
Configure the manager to store installed, pending, and uninstalled plugins under the given path. After this method is called, the methods for scheduling plugins changes can be used.

Specified by:
configurePluginPath in interface PluginInstallationManager
Parameters:
pluginsPath - path to store plugin jars under

getInstalledPluginsLoader

public com.atlassian.plugin.loaders.PluginLoader getInstalledPluginsLoader()
Specified by:
getInstalledPluginsLoader in interface PluginInstallationManager
Returns:
If this manager is configured, returns a PluginLoader that scans the installed plugins directory. Otherwise, returns a PluginLoader that doesn't do any scanning or discovery of plugins.

installPlugin

public String installPlugin(com.atlassian.plugin.PluginJar pluginJar,
                            com.atlassian.plugin.PluginAccessor pluginAccessor)
                     throws com.atlassian.plugin.PluginParseException
Description copied from interface: PluginInstallationManager
Schedule the plugin to be installed or upgraded, if it is a newer version of a plugin that is already installed, during the next startup cycle.

Specified by:
installPlugin in interface PluginInstallationManager
Parameters:
pluginJar - Plugin jar to be installed.
pluginAccessor - Plugin accessor to determine if the pluginJar is a newer version of an already installed plugin
Returns:
Plugin key retrieved from the plugin metadata.
Throws:
com.atlassian.plugin.PluginParseException - Thrown if the pluginJar cannot be opened or if it does not contain plugin metadata or the plugin metadata is in an invalid format.

uninstall

public void uninstall(com.atlassian.plugin.Plugin plugin)
               throws com.atlassian.plugin.PluginException
Description copied from interface: PluginInstallationManager
Schedule the plugin to be uninstalled during the next startup cycle.

Specified by:
uninstall in interface PluginInstallationManager
Parameters:
plugin - Plugin to be uninstalled
Throws:
com.atlassian.plugin.PluginException - if the plugin cannot be uninstalled

cancelPluginUpdate

public void cancelPluginUpdate(String key)
Description copied from interface: PluginInstallationManager
Cancel any scheduled changes - install, upgrade or uninstall - for the plugin identified by the key.

Specified by:
cancelPluginUpdate in interface PluginInstallationManager
Parameters:
key - Key of the plugin for which updates should be cancelled.

processUpdates

public void processUpdates()
                    throws com.atlassian.plugin.PluginException
Description copied from interface: PluginInstallationManager
This method is to be called during the JIRA startup process. It causes all pending changes to be made and must be called before the PluginManager is started so that newly installed/upgrade plugins will be available for loading and any uninstalled plugins will not be loaded.

Specified by:
processUpdates in interface PluginInstallationManager
Throws:
com.atlassian.plugin.PluginException - Thrown if there is a problem with installing/upgrading/uninstalling one of the plugins

removeStateFromStore

protected void removeStateFromStore(com.atlassian.plugin.PluginStateStore stateStore,
                                    String key)


Copyright © 2002-2009 Atlassian. All Rights Reserved.