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 <plugin-info> element. eg: <code><param name="build">1</param></code>
16 */
17 public int getBuildNumber();
18
19 /**
20 * @return A short (<50 chars) description of the upgrade action
21 */
22 public 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 public 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 public String getPluginKey();
41 }
42