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