Class UpgradeVersionService

java.lang.Object
com.atlassian.greenhopper.upgrade.UpgradeVersionService

@Service public class UpgradeVersionService extends Object
Keeps track of the last upgrade task number to run. Checks if upgrades are currently running.
  • Field Details

    • LATEST_VERSION

      public static final Long 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 to latestUpgradedVersion. 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

      @Nullable public Long 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

      public UpgradeVersionService.PluginRunInfo 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

      public UpgradeVersionService.PluginRunInfo getCurrentPluginRunInfo()
      Returns:
      the current plugin run info, which can tell if there has been a down grade
    • getPluginRunHistory

      public List<UpgradeVersionService.PluginRunInfo> 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

      public List<UpgradeVersionService.UpgradeHistoryDetail> getUpgradeHistory()
      Returns:
      a history of the plugin upgrade that have run