com.atlassian.sal.core.upgrade
Class DefaultPluginUpgradeManager

java.lang.Object
  extended by com.atlassian.sal.core.upgrade.DefaultPluginUpgradeManager
All Implemented Interfaces:
LifecycleAware, PluginUpgradeManager

public class DefaultPluginUpgradeManager
extends Object
implements PluginUpgradeManager, LifecycleAware

Processes plugin upgrade operations. Upgrades are triggered by the start lifecycle event. NOTE: Currently, this implementation only runs upgrade tasks when the plugins system is initialized or restarted. If your plugin is disabled and it provides an upgrade task and a user then enables your plugin, the upgrade task will not run until the plugins system or application is restarted.


Constructor Summary
DefaultPluginUpgradeManager(List<PluginUpgradeTask> upgradeTasks, TransactionTemplate transactionTemplate, com.atlassian.plugin.PluginAccessor pluginAccessor, PluginSettingsFactory pluginSettingsFactory)
           
 
Method Summary
protected  Map<String,List<PluginUpgradeTask>> getUpgradeTasks()
           
 void onBind(PluginUpgradeTask task, Map props)
          Deprecated.  
 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()
           
 
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)
Method Detail

onBind

@Deprecated
public void onBind(PluginUpgradeTask task,
                              Map props)
Deprecated. 

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

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()


Copyright © 2011 Atlassian. All Rights Reserved.