public abstract class AbstractUpgradeManager extends Object implements UpgradeManager, org.springframework.beans.factory.InitializingBean, UpgradeTaskInfoService, org.springframework.beans.factory.BeanFactoryAware
| Modifier and Type | Field and Description |
|---|---|
static Comparator<UpgradeTask> |
UPGRADE_TASK_COMPARATOR |
MINIMUM_SUPPORTED_UPGRADE_BUILD_NUMBER, MINIMUM_SUPPORTED_UPGRADE_VERSION| Constructor and Description |
|---|
AbstractUpgradeManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
static void |
assertNoDuplicateBuildNumbers(Iterable<UpgradeTask> upgradeTasks) |
protected void |
beforeUpgrade() |
boolean |
configuredBuildNumberNewerThan(String buildNumber)
Returns true if the passed build number is less than the configured build number - that is, the version of
the currently running Confluence is newer than the version passed.
|
void |
entireUpgradeFinished()
Called when all immediate and deferred upgrade actions have been performed *if* an upgrade was needed.
|
protected abstract void |
finalizeIfNeeded() |
protected List<UpgradeTask> |
getAllUpgradeTasks() |
Collection<UpgradeTaskInfo> |
getAllUpgradeTasksInfo()
While this could just return the list of UpgradeTasks directly (since UpgradeTask implements UpgradeTaskInfo),
we re-wrap them here to prevent plugins from casting them to UpgradeTask and trying to execute them.
|
protected String |
getConfiguredBuildNumber() |
protected abstract String |
getDatabaseBuildNumber() |
List<UpgradeError> |
getErrors() |
String |
getExportBuildNumber(boolean isSpaceExport)
Tells the earliest version the exports will be compatible with.
|
String |
getOldestSpaceImportAllowed()
Calculates the oldest build number from which a space can be imported.
|
List<DeferredUpgradeTask> |
getPluginDependentUpgradeTasks() |
Map<String,PluginExportCompatibility> |
getPluginExportCompatibility(boolean isSpaceExport)
Returns the list of plugins with data (especially plugins with Active Objects data) and
tells how backward-compatible they are.
|
List<UpgradeTask> |
getPreSchemaUpgradeTasks() |
protected abstract String |
getRealBuildNumber() |
List<UpgradeTask> |
getSchemaUpgradeTasks() |
List<UpgradeTask> |
getUpgradeTasks() |
protected List<UpgradeTask> |
getUpgradeTasksToRun() |
protected void |
initialUpgradeFinished()
Once all upgrade tasks have been completed without error, make sure the build number stored in the applications main configuration file and database now matches
the build number of this version of the release.
|
boolean |
isUpgraded() |
protected boolean |
neededSchemaUpgrade() |
boolean |
needUpgrade() |
protected boolean |
permitDatabaseUpgrades()
This is used to guard against database upgrades being performed multiple times on the same database.
|
protected void |
postUpgrade() |
protected abstract void |
releaseSchemaReferences() |
protected abstract List<UpgradeError> |
runUpgradePrerequisites()
Runs all upgrade prerequisites.
|
protected void |
runUpgradeTasks(List<UpgradeTask> upgradeTasks) |
void |
setApplicationConfig(com.atlassian.config.ApplicationConfiguration applicationConfig) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
protected void |
setConfiguredBuildNumber(String buildNumber) |
protected abstract void |
setDatabaseBuildNumber(String databaseBuildNumber)
Once the upgrade is complete, we'll need to set the new database build number in the database.
|
void |
setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor) |
void |
setPluginDependentUpgradeTaskNames(List<String> upgradeTaskNames) |
void |
setPluginDependentUpgradeTasks(List<DeferredUpgradeTask> upgradeTasks) |
void |
setPreSchemaUpgradeTaskNames(List<String> preSchemaUpgradeTaskNames) |
void |
setPreSchemaUpgradeTasks(List<UpgradeTask> preSchemaUpgradeTasks) |
void |
setSchemaUpgradeTaskNames(List<String> upgradeTaskNames) |
void |
setSchemaUpgradeTasks(List<UpgradeTask> upgradeTasks) |
void |
setUpgradeTaskNames(List<String> upgradeTaskNames) |
void |
setUpgradeTasks(List<UpgradeTask> upgradeTasks) |
boolean |
taskNewerThan(String buildNumber,
UpgradeTask upgradeTask)
Returns true if the build number for the task is greater than the passed build number.
|
protected abstract void |
updateSchemaIfNeeded() |
void |
upgrade(com.atlassian.johnson.JohnsonEventContainer agentJohnson) |
protected void |
upgradeStarted() |
protected void |
upgradeTaskSucceeded(UpgradeTask upgradeTask) |
protected abstract void |
validateSchemaUpdateIfNeeded() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetDatabaseBuildNumberpublic static final Comparator<UpgradeTask> UPGRADE_TASK_COMPARATOR
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwarepublic void setApplicationConfig(com.atlassian.config.ApplicationConfiguration applicationConfig)
public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanprotected abstract void validateSchemaUpdateIfNeeded()
throws com.atlassian.config.ConfigurationException
com.atlassian.config.ConfigurationExceptionprotected abstract void updateSchemaIfNeeded()
throws com.atlassian.config.ConfigurationException
com.atlassian.config.ConfigurationExceptionprotected abstract void releaseSchemaReferences()
public void upgrade(com.atlassian.johnson.JohnsonEventContainer agentJohnson)
throws UpgradeException
upgrade in interface UpgradeManagerUpgradeExceptionprotected boolean neededSchemaUpgrade()
protected abstract void finalizeIfNeeded()
throws UpgradeException
UpgradeExceptionprotected void runUpgradeTasks(List<UpgradeTask> upgradeTasks) throws UpgradeException
UpgradeExceptionprotected List<UpgradeTask> getAllUpgradeTasks()
public Collection<UpgradeTaskInfo> getAllUpgradeTasksInfo()
getAllUpgradeTasksInfo in interface UpgradeTaskInfoServiceUpgradeTaskInfo objects, one for each UpgradeTask in the system,
in no particular order.protected List<UpgradeTask> getUpgradeTasksToRun()
protected void upgradeTaskSucceeded(UpgradeTask upgradeTask) throws Exception
Exceptionprotected void upgradeStarted()
public List<UpgradeTask> getPreSchemaUpgradeTasks()
public void setPreSchemaUpgradeTasks(List<UpgradeTask> preSchemaUpgradeTasks)
public void setPreSchemaUpgradeTaskNames(List<String> preSchemaUpgradeTaskNames)
public void setUpgradeTasks(List<UpgradeTask> upgradeTasks)
public void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)
public static void assertNoDuplicateBuildNumbers(Iterable<UpgradeTask> upgradeTasks) throws IllegalStateException
IllegalStateExceptionpublic List<UpgradeTask> getUpgradeTasks()
public void setSchemaUpgradeTasks(List<UpgradeTask> upgradeTasks)
public void setSchemaUpgradeTaskNames(List<String> upgradeTaskNames)
public List<UpgradeTask> getSchemaUpgradeTasks()
public List<UpgradeError> getErrors()
getErrors in interface UpgradeManagerpublic void setPluginDependentUpgradeTasks(List<DeferredUpgradeTask> upgradeTasks)
public void setPluginDependentUpgradeTaskNames(List<String> upgradeTaskNames)
public List<DeferredUpgradeTask> getPluginDependentUpgradeTasks()
protected abstract List<UpgradeError> runUpgradePrerequisites()
protected String getConfiguredBuildNumber()
protected void setConfiguredBuildNumber(String buildNumber) throws com.atlassian.config.ConfigurationException
com.atlassian.config.ConfigurationExceptionpublic boolean needUpgrade()
needUpgrade in interface UpgradeManagerpublic boolean configuredBuildNumberNewerThan(String buildNumber)
UpgradeManagerconfiguredBuildNumberNewerThan in interface UpgradeManagerpublic boolean taskNewerThan(String buildNumber, UpgradeTask upgradeTask)
UpgradeManagertaskNewerThan in interface UpgradeManagerprotected void initialUpgradeFinished()
throws Exception
Note that this method is called "initialUpgradeFinished" because any deferred pluginDependentUpgradeTasks may still have to run, so the upgrade process is not yet complete.
Exception - when setting the database or configuration build number failspublic void entireUpgradeFinished()
UpgradeManagerentireUpgradeFinished in interface UpgradeManagerprotected abstract String getRealBuildNumber()
protected abstract String getDatabaseBuildNumber()
getConfiguredBuildNumber().protected abstract void setDatabaseBuildNumber(String databaseBuildNumber) throws Exception
databaseBuildNumber - The new database build numberException - when there is any problem setting the database build numberprotected boolean permitDatabaseUpgrades()
throws UpgradeException
UpgradeException - If the implementation of this method encounters any errors.protected void beforeUpgrade()
throws UpgradeException
UpgradeExceptionprotected void postUpgrade()
public boolean isUpgraded()
isUpgraded in interface UpgradeManagerpublic String getOldestSpaceImportAllowed()
UpgradeManagergetOldestSpaceImportAllowed in interface UpgradeManagerpublic String getExportBuildNumber(boolean isSpaceExport)
UpgradeManagergetExportBuildNumber in interface UpgradeManagerisSpaceExport - true if the export is about a space, false for a global export.public Map<String,PluginExportCompatibility> getPluginExportCompatibility(boolean isSpaceExport)
UpgradeManagerReturns the list of plugins with data (especially plugins with Active Objects data) and tells how backward-compatible they are.
If at least one plugin isn't compatible, the importer silently doesn't import any data.
What is a compatible version?
The data is exported as-is in XML and reimported in an earlier version. If the earlier version of the plugin is able to read the data without fault, then it is compatible. Note that there is no downgrade task, obviously.
getPluginExportCompatibility in interface UpgradeManagerisSpaceExport - true if the export is about a space, false for a global export.Copyright © 2003–2022 Atlassian. All rights reserved.