com.atlassian.confluence.upgrade
Class AbstractUpgradeManager

java.lang.Object
  extended by com.atlassian.confluence.upgrade.AbstractUpgradeManager
All Implemented Interfaces:
UpgradeManager
Direct Known Subclasses:
DefaultUpgradeManager

public abstract class AbstractUpgradeManager
extends java.lang.Object
implements UpgradeManager


Field Summary
protected  java.util.Comparator<java.lang.String> buildNumberComp
           
protected static org.apache.log4j.Logger log
          Deprecated. 
 
Constructor Summary
AbstractUpgradeManager()
           
 
Method Summary
protected  void doUpgrade()
           
protected  java.lang.String getConfiguredBuildNumber()
          This is the build number of the current version that the user is running under.
protected abstract  java.lang.String getDatabaseBuildNumber()
          This is the build number of the data in the database.
 java.util.List<UpgradeError> getErrors()
           
protected abstract  java.lang.String getRealBuildNumber()
          The is the build number of the new version of Confluence being upgraded to.
 java.util.List<UpgradeTask> getSchemaUpgradeTasks()
           
 java.util.List<UpgradeTask> getUpgradeTasks()
           
 boolean isUpgraded()
           
 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  java.util.List<java.lang.String> runUpgradePrerequisites()
          Runs all upgrade prerequisites.
 void setApplicationConfig(com.atlassian.config.ApplicationConfiguration applicationConfig)
           
protected  void setConfiguredBuildNumber(java.lang.String buildNumber)
           
protected abstract  void setDatabaseBuildNumber(java.lang.String databaseBuildNumber)
          Once the upgrade is complete, we'll need to set the new database build number in the database.
 void setPreSchemaUpgradeTasks(java.util.List<UpgradeTask> preSchemaUpgradeTasks)
           
 void setSchemaHelper(SchemaHelper schemaHelper)
           
 void setSchemaUpgradeTasks(java.util.List<UpgradeTask> upgradeTasks)
           
 void setUpgradeTasks(java.util.List<UpgradeTask> upgradeTasks)
           
 void upgrade(com.atlassian.johnson.JohnsonEventContainer agentJohnson)
           
protected  void upgradeFinished()
          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.
protected  void upgradeSchema()
           
protected  void upgradeStarted()
           
protected  void upgradeTaskFailed(UpgradeTask upgradeTask, java.lang.Throwable e)
           
protected  void upgradeTaskSucceeded(UpgradeTask upgradeTask)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

@Deprecated
protected static final org.apache.log4j.Logger log
Deprecated. 

buildNumberComp

protected final java.util.Comparator<java.lang.String> buildNumberComp
Constructor Detail

AbstractUpgradeManager

public AbstractUpgradeManager()
Method Detail

setApplicationConfig

public void setApplicationConfig(com.atlassian.config.ApplicationConfiguration applicationConfig)

setSchemaHelper

public void setSchemaHelper(SchemaHelper schemaHelper)

upgrade

public void upgrade(com.atlassian.johnson.JohnsonEventContainer agentJohnson)
             throws UpgradeException
Specified by:
upgrade in interface UpgradeManager
Throws:
UpgradeException

doUpgrade

protected void doUpgrade()
                  throws java.lang.Throwable
Throws:
java.lang.Throwable

upgradeSchema

protected void upgradeSchema()
                      throws com.atlassian.config.ConfigurationException,
                             UpgradeException
Throws:
com.atlassian.config.ConfigurationException
UpgradeException

upgradeTaskSucceeded

protected void upgradeTaskSucceeded(UpgradeTask upgradeTask)
                             throws com.atlassian.config.ConfigurationException
Throws:
com.atlassian.config.ConfigurationException

upgradeTaskFailed

protected void upgradeTaskFailed(UpgradeTask upgradeTask,
                                 java.lang.Throwable e)

upgradeStarted

protected void upgradeStarted()
                       throws java.lang.Exception
Throws:
java.lang.Exception

setPreSchemaUpgradeTasks

public void setPreSchemaUpgradeTasks(java.util.List<UpgradeTask> preSchemaUpgradeTasks)

setUpgradeTasks

public void setUpgradeTasks(java.util.List<UpgradeTask> upgradeTasks)

getUpgradeTasks

public java.util.List<UpgradeTask> getUpgradeTasks()

setSchemaUpgradeTasks

public void setSchemaUpgradeTasks(java.util.List<UpgradeTask> upgradeTasks)

getSchemaUpgradeTasks

public java.util.List<UpgradeTask> getSchemaUpgradeTasks()

getErrors

public java.util.List<UpgradeError> getErrors()
Specified by:
getErrors in interface UpgradeManager

runUpgradePrerequisites

protected abstract java.util.List<java.lang.String> runUpgradePrerequisites()
Runs all upgrade prerequisites.

Returns:
an empty list if all upgrade prerequisites pass, otherwise, returns a list consisting of one or more failure messages.

getConfiguredBuildNumber

protected java.lang.String getConfiguredBuildNumber()
This is the build number of the current version that the user is running under. This version is stored in their confluence home confluence.cfg.xml file


setConfiguredBuildNumber

protected void setConfiguredBuildNumber(java.lang.String buildNumber)
                                 throws com.atlassian.config.ConfigurationException
Throws:
com.atlassian.config.ConfigurationException

needUpgrade

public boolean needUpgrade()
Specified by:
needUpgrade in interface UpgradeManager

upgradeFinished

protected void upgradeFinished()
                        throws java.lang.Exception
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.

Throws:
java.lang.Exception

getRealBuildNumber

protected abstract java.lang.String getRealBuildNumber()
The is the build number of the new version of Confluence being upgraded to. This number can be found in the default.properties of the new expanded WAR


getDatabaseBuildNumber

protected abstract java.lang.String getDatabaseBuildNumber()
This is the build number of the data in the database. If the version of the database data can not be determined, this method should return the same value as getConfiguredBuildNumber().


setDatabaseBuildNumber

protected abstract void setDatabaseBuildNumber(java.lang.String databaseBuildNumber)
                                        throws java.lang.Exception
Once the upgrade is complete, we'll need to set the new database build number in the database.

Throws:
java.lang.Exception

permitDatabaseUpgrades

protected boolean permitDatabaseUpgrades()
                                  throws UpgradeException
This is used to guard against database upgrades being performed multiple times on the same database. By default, assume a non-clustered setup and allow database upgrades.

Throws:
UpgradeException

postUpgrade

protected void postUpgrade()

isUpgraded

public boolean isUpgraded()
Specified by:
isUpgraded in interface UpgradeManager
Returns:
true if the UpgradeManager was able to successfully upgrade this instance, or if no upgrade was necessary; otherwise false.


Copyright © 2003-2010 Atlassian. All Rights Reserved.