com.atlassian.sal.core.upgrade
Class DefaultPluginUpgradeManager

java.lang.Object
  extended by com.atlassian.sal.core.upgrade.DefaultPluginUpgradeManager
All Implemented Interfaces:
LifecycleAware, PluginUpgradeManager, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class DefaultPluginUpgradeManager
extends Object
implements PluginUpgradeManager, LifecycleAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

Processes plugin upgrade operations.

Upgrades are triggered by the start lifecycle event, and plugin enabled.


Constructor Summary
DefaultPluginUpgradeManager(List<PluginUpgradeTask> upgradeTasks, TransactionTemplate transactionTemplate, com.atlassian.plugin.PluginAccessor pluginAccessor, PluginSettingsFactory pluginSettingsFactory, com.atlassian.plugin.event.PluginEventManager pluginEventManager)
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
protected  Map<String,List<PluginUpgradeTask>> getUpgradeTasks()
           
 void onBind(PluginUpgradeTask task, Map props)
          Deprecated. as of 2.0.16 no longer used we now use the eventing framework to run upgrade tasks for plugins that are 'enabled', see onPluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent)
 void onPluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent event)
           
 void onStart()
          Called when the application has started or has been restored from backup
 List<Message> upgrade()
          Finds and upgrades all plugins, that implement PluginUpgradeTask
 List<Message> upgradeInternal()
           
 List<Message> upgradeInternal(com.atlassian.plugin.Plugin plugin)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPluginUpgradeManager

public DefaultPluginUpgradeManager(List<PluginUpgradeTask> upgradeTasks,
                                   TransactionTemplate transactionTemplate,
                                   com.atlassian.plugin.PluginAccessor pluginAccessor,
                                   PluginSettingsFactory pluginSettingsFactory,
                                   com.atlassian.plugin.event.PluginEventManager pluginEventManager)
Method Detail

onBind

@Deprecated
public void onBind(PluginUpgradeTask task,
                              Map props)
Deprecated. as of 2.0.16 no longer used we now use the eventing framework to run upgrade tasks for plugins that are 'enabled', see onPluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent)

Notifies the plugin upgrade manager that a plugin update tasks has been registered.

This method does nothing but logging at the moment. Is is now deprecated since it could result in circular dependency when trying to bind already exposed update tasks to plugin manager that is being created.

Parameters:
task - the upgrade task that is being bound
props - the set of properties that the upgrade task was registered with

onStart

public void onStart()
Description copied from interface: LifecycleAware
Called when the application has started or has been restored from backup

Specified by:
onStart in interface LifecycleAware

onPluginEnabled

public void onPluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent event)

getUpgradeTasks

protected Map<String,List<PluginUpgradeTask>> getUpgradeTasks()
Returns:
map of all upgrade tasks (stored by pluginKey)

upgrade

public List<Message> upgrade()
Description copied from interface: PluginUpgradeManager
Finds and upgrades all plugins, that implement PluginUpgradeTask

Specified by:
upgrade in interface PluginUpgradeManager
Returns:
A list of errors

upgradeInternal

public List<Message> upgradeInternal()

upgradeInternal

public List<Message> upgradeInternal(com.atlassian.plugin.Plugin plugin)

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception


Copyright © 2015 Atlassian. All rights reserved.