View Javadoc
1   package com.atlassian.sal.api.upgrade;
2   
3   import com.atlassian.sal.api.message.Message;
4   
5   import java.util.Collection;
6   
7   /**
8    * A task that needs to be executed to upgrade the existing data
9    *
10   * @since 2.0
11   */
12  public interface PluginUpgradeTask {
13      /**
14       * @return The new build number that this upgrade will upgrade to
15       * Build number is specified in atlassian-plugin.xml inside &lt;plugin-info&gt; element. eg: <code>&lt;param name="build"&gt;1&lt;/param&gt;</code>
16       */
17      int getBuildNumber();
18  
19      /**
20       * @return A short (under 50 chars) description of the upgrade action
21       */
22      String getShortDescription();
23  
24  
25      /**
26       * Perform the upgrade task. An exception should be thrown if the upgrade fails and cannot be recovered from. A
27       * collection of error or warning messages should be returned if there a problems with the upgrade that are not
28       * severe enough to halt the execution of the entire upgrade process. An exception should be thrown if the upgrade
29       * process cannot continue.
30       *
31       * @return a collection of warnings about the upgrade
32       * @throws Exception if the upgrade fails
33       */
34      Collection<Message> doUpgrade() throws Exception;
35  
36      /**
37       * @return key of the plugin that this upgrade task applies to.
38       * Find the key as an attribute of top level element in atlassian-plugin.xml
39       */
40      String getPluginKey();
41  }
42