public class

UpgradeManagerImpl

extends Object
implements Startable UpgradeManager
java.lang.Object
   ↳ com.atlassian.jira.upgrade.UpgradeManagerImpl

Summary

Nested Classes
class UpgradeManagerImpl.Upgrades  
Fields
public static final JobId JOB_ID
public static final JobRunnerKey JOB_RUNNER_KEY
Public Constructors
@Inject UpgradeManagerImpl(JiraLicenseService jiraLicenseService, BuildUtilsInfo buildUtilsInfo, I18nHelper.BeanFactory i18HelperFactory, ApplicationProperties applicationProperties, BuildVersionRegistry buildVersionRegistry, EventPublisher eventPublisher, OfBizDelegator ofBizDelegator, IndexLifecycleManager indexManager, OutlookDateManager outlookDateManager, FeatureManager featureManager, DowngradeUtilsImpl downgradeUtilsInfo, ReindexMessageManager reindexMessageManager, ReindexRequestManager reindexRequestManager, SchedulerService schedulerService, SchedulerHistoryService schedulerHistoryService, EntityEngine entityEngine, ClusterLockService clusterLockService, BuildVersionLicenseCheck licenseCheck, UpgradeConstraints upgradeContstraints)
Public Methods
void addUpgrade(UpgradeTask task)
boolean areDelayedUpgradesRunning()
Returns true if a scheduled upgrade is in progress.
UpgradeManager.Status doUpgrade(UpgradeManagerParams upgradeManagerParams)
Gets all the upgrades (standard, professional and enterprise) that need to be run from the build number stored in the database to the current build number

Get the set of upgradeNumbers which are to be performed for this upgrade.

UpgradeManager.Status doUpgradeIfNeededAndAllowed(String backupPath, UpgradeManagerParams upgradeManagerParams)
Performs the upgrade if one is required and the license is not too old to proceed with the upgrade.
String getExportFilePath()
Export path of the last backup performed by this manager
RunDetails getLastUpgradeResult()
int getPendingDelayedUpgradeCount()
List<UpgradeHistoryItem> getUpgradeHistory()
boolean hasUpgradeTaskRun(Class<? extends UpgradeTask> clazz)
Return true if the upgrade task implemented in the parameter class has completed successfully..
@EventListener void onClearCache(ClearCacheEvent event)
@Nonnull UpgradeManager.Status scheduleDelayedUpgrades(int delayMins, boolean isAllowReindex)
Schedules the execution of delayed upgrades.
void start()
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.
Protected Methods
AutoExport getAutoExport(String defaultBackupPath)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.extension.Startable
From interface com.atlassian.jira.upgrade.UpgradeManager

Fields

public static final JobId JOB_ID

public static final JobRunnerKey JOB_RUNNER_KEY

Public Constructors

@Inject public UpgradeManagerImpl (JiraLicenseService jiraLicenseService, BuildUtilsInfo buildUtilsInfo, I18nHelper.BeanFactory i18HelperFactory, ApplicationProperties applicationProperties, BuildVersionRegistry buildVersionRegistry, EventPublisher eventPublisher, OfBizDelegator ofBizDelegator, IndexLifecycleManager indexManager, OutlookDateManager outlookDateManager, FeatureManager featureManager, DowngradeUtilsImpl downgradeUtilsInfo, ReindexMessageManager reindexMessageManager, ReindexRequestManager reindexRequestManager, SchedulerService schedulerService, SchedulerHistoryService schedulerHistoryService, EntityEngine entityEngine, ClusterLockService clusterLockService, BuildVersionLicenseCheck licenseCheck, UpgradeConstraints upgradeContstraints)

Public Methods

public void addUpgrade (UpgradeTask task)

public boolean areDelayedUpgradesRunning ()

Returns true if a scheduled upgrade is in progress.

Returns
  • if a scheduled upgrade is in progress.

public UpgradeManager.Status doUpgrade (UpgradeManagerParams upgradeManagerParams)

Gets all the upgrades (standard, professional and enterprise) that need to be run from the build number stored in the database to the current build number

Get the set of upgradeNumbers which are to be performed for this upgrade.

Get the Maps of relevant upgrades using {#getRelevantUpgradesFromList}

Iterate over these numbers and if either of the standard, professional or enterprise maps contains an UpgradeTask with this number then do the upgrade

If errors are found, it will cancel the upgrade, and list errors to the console.

For each upgrade that happens successfully, it will increment the build number in the database, so that if one fails, you do not have to repeat all the upgrades that have already run.

If there are no errors from the upgrade, the build number in the database is incremented to the current build number. This is because there may be no upgrades for a particular version & needUpgrade() checks build no in database.

Parameters
upgradeManagerParams contain information needed to upgrade process
Returns
  • a collection of error messages

public UpgradeManager.Status doUpgradeIfNeededAndAllowed (String backupPath, UpgradeManagerParams upgradeManagerParams)

Performs the upgrade if one is required and the license is not too old to proceed with the upgrade.

Parameters
backupPath - a path to the default location of the export, may be null, in which case no auto export will be performed
upgradeManagerParams contain information needed to upgrade process
Returns
  • status of the upgrade process

public String getExportFilePath ()

Export path of the last backup performed by this manager

Returns
  • path to the last backup file

public RunDetails getLastUpgradeResult ()

public int getPendingDelayedUpgradeCount ()

public List<UpgradeHistoryItem> getUpgradeHistory ()

public boolean hasUpgradeTaskRun (Class<? extends UpgradeTask> clazz)

Return true if the upgrade task implemented in the parameter class has completed successfully.. Note: We use the class as the parameter to help when tasks are refactored and reordered etc.

Parameters
clazz The Upgrade Task's implementing class.

@EventListener public void onClearCache (ClearCacheEvent event)

@Nonnull public UpgradeManager.Status scheduleDelayedUpgrades (int delayMins, boolean isAllowReindex)

Schedules the execution of delayed upgrades.

Parameters
delayMins the amount of time in minutes to wait before executing the delayed upgrades.
isAllowReindex set this to true to allow any required reindex to be done.
Returns
  • the status of the upgrade process.

public void start ()

This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Throws
Exception

Protected Methods

protected AutoExport getAutoExport (String defaultBackupPath)