Class UpgradeVersionService
java.lang.Object
com.atlassian.greenhopper.upgrade.UpgradeVersionService
Keeps track of the last upgrade task number to run. Checks if upgrades are currently running.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Long
This MUST to be kept in-sync with the largest build number provided by any upgrade task. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
This can be called to get a list of the history of a plugin runningboolean
boolean
void
init()
void
onDataImportStarted
(com.atlassian.jira.bc.dataimport.ImportStartedEvent event) Reset our cached references tolatestUpgradedVersion
.Called to record when a plugin has started and at what version.void
recordUpgradeTaskEnded
(int buildNumber, long timeTaken) Call this to record that a plugin upgrade task has been completedvoid
recordUpgradeTaskStarted
(int buildNumber) Call this to record that a plugin upgrade task has been startedvoid
setLatestUpgradedVersion
(long upgradeTaskBuildNumber) Record the number of the latest successful upgrade task.boolean
-
Field Details
-
LATEST_VERSION
This MUST to be kept in-sync with the largest build number provided by any upgrade task. If you write an upgrade task you MUST update this value. Notice the word MUST and not should!
-
-
Constructor Details
-
UpgradeVersionService
public UpgradeVersionService()
-
-
Method Details
-
init
@PostConstruct public void init() -
destroy
@PreDestroy public void destroy() -
onDataImportStarted
@EventListener public void onDataImportStarted(com.atlassian.jira.bc.dataimport.ImportStartedEvent event) Reset our cached references tolatestUpgradedVersion
. This is because these references are attached to the lifecycle of the data JIRA is running.- Parameters:
event
- ignored
-
setLatestUpgradedVersion
public void setLatestUpgradedVersion(long upgradeTaskBuildNumber) Record the number of the latest successful upgrade task.- Parameters:
upgradeTaskBuildNumber
- the build number
-
hasLastUpgradeTaskCompleted
public boolean hasLastUpgradeTaskCompleted()- Returns:
- has the latest upgrade task we know about been successfully completed
-
getLatestUpgradeTaskRun
- Returns:
- the build number of the latest upgrade task to have completed successfully;
null
signifies that no upgrade task has appeared to have run before (and hence this is the first time installing JIRA Agile or the data is completely fresh).
-
hasAnyUpgradeTaskRunBefore
public boolean hasAnyUpgradeTaskRunBefore()- Returns:
- when we first examine the data JIRA is running, is there any evidence of JIRA Agile upgrade tasks being run before
-
versionLooksKosher
public boolean versionLooksKosher()- Returns:
- true if the version of JIRA Agile looks kosher from an upgrade and plugin version point of view
-
recordPluginStarted
Called to record when a plugin has started and at what version. If the plugin has changed since the last time it was run it will return information about that- Returns:
- information about the current run version of GH
-
getCurrentPluginRunInfo
- Returns:
- the current plugin run info, which can tell if there has been a down grade
-
getPluginRunHistory
This can be called to get a list of the history of a plugin running- Returns:
- the list of plugin run history
-
recordUpgradeTaskStarted
public void recordUpgradeTaskStarted(int buildNumber) Call this to record that a plugin upgrade task has been started- Parameters:
buildNumber
- the build number of the upgrade task
-
recordUpgradeTaskEnded
public void recordUpgradeTaskEnded(int buildNumber, long timeTaken) Call this to record that a plugin upgrade task has been completed- Parameters:
buildNumber
- the build number of the upgrade task
-
getUpgradeHistory
- Returns:
- a history of the plugin upgrade that have run
-