com.atlassian.bamboo.upgrade
Class AbstractUpgradeManager

java.lang.Object
  extended by com.atlassian.bamboo.upgrade.AbstractUpgradeManager
All Implemented Interfaces:
UpgradeManager
Direct Known Subclasses:
BootstrapUpgradeManagerImpl, UpgradeManagerImpl

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


Field Summary
protected  java.util.Comparator<java.lang.String> applicationBuildNumberComparator
           
protected  com.atlassian.config.ApplicationConfiguration applicationConfig
           
protected  java.lang.String fileName
           
protected  java.lang.String newBuildNumber
           
protected  com.opensymphony.xwork.TextProvider textProvider
           
protected  java.util.SortedMap<java.lang.String,UpgradeTask> upgradeTasks
           
protected  UpgradeUtilityBean upgradeUtilityBean
           
protected  java.lang.String xPathExpression
           
 
Constructor Summary
protected AbstractUpgradeManager(com.atlassian.config.ApplicationConfiguration applicationConfig, java.lang.String newBuildNumber, java.lang.String fileName, java.lang.String xPathExpression)
           
 
Method Summary
protected  void classifyUpgradeTask(java.lang.String bambooBuildNumber, UpgradeTask task)
           
protected  UpgradeTask createUpgradeTask(java.lang.String className)
           
protected  java.util.SortedMap<java.lang.String,UpgradeTask> createUpgradeTasks(java.lang.String xPathExpression, java.lang.String buildNumberLo, java.lang.String buildNumberHi)
           
 java.lang.String getBuildNumber()
          This gets the pre-build number
protected  org.dom4j.Document getUpgradeDocument()
           
 java.util.SortedMap<java.lang.String,UpgradeTask> getUpgradeTasks()
          Gets a map of upgrade tasks which need to run.
 boolean isFullReindexWhenUpgradesFinish()
           
 boolean needUpgrade()
          Determines whether we need to run the upgrade or not.
protected  void populateRelevantUpgrades(java.lang.String buildNumberLo, java.lang.String buildNumberHi)
           
protected  java.lang.String runUpgradeTask(UpgradeTask task, java.util.List<java.lang.String> errors)
           
protected  void setBuildNumber(java.lang.String buildNumber)
           
 void setFullReindexWhenUpgradesFinish(boolean fullReindexWhenUpgradesFinish)
           
 void setTextProvider(com.opensymphony.xwork.TextProvider textProvider)
           
 void setUpgradeUtilityBean(UpgradeUtilityBean upgradeUtilityBean)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.upgrade.UpgradeManager
doUpgrade
 

Field Detail

applicationBuildNumberComparator

protected final java.util.Comparator<java.lang.String> applicationBuildNumberComparator

newBuildNumber

protected final java.lang.String newBuildNumber

fileName

protected final java.lang.String fileName

xPathExpression

protected final java.lang.String xPathExpression

upgradeTasks

protected final java.util.SortedMap<java.lang.String,UpgradeTask> upgradeTasks

applicationConfig

protected final com.atlassian.config.ApplicationConfiguration applicationConfig

upgradeUtilityBean

protected UpgradeUtilityBean upgradeUtilityBean

textProvider

protected com.opensymphony.xwork.TextProvider textProvider
Constructor Detail

AbstractUpgradeManager

protected AbstractUpgradeManager(@NotNull
                                 com.atlassian.config.ApplicationConfiguration applicationConfig,
                                 @NotNull
                                 java.lang.String newBuildNumber,
                                 @NotNull
                                 java.lang.String fileName,
                                 @NotNull
                                 java.lang.String xPathExpression)
Method Detail

needUpgrade

public boolean needUpgrade()
Description copied from interface: UpgradeManager
Determines whether we need to run the upgrade or not.

Specified by:
needUpgrade in interface UpgradeManager
Returns:
boolean whether the build was successful or not

getBuildNumber

@NotNull
public java.lang.String getBuildNumber()
Description copied from interface: UpgradeManager
This gets the pre-build number

Specified by:
getBuildNumber in interface UpgradeManager
Returns:
the current build number (in application config file)

setBuildNumber

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

isFullReindexWhenUpgradesFinish

public boolean isFullReindexWhenUpgradesFinish()

setFullReindexWhenUpgradesFinish

public void setFullReindexWhenUpgradesFinish(boolean fullReindexWhenUpgradesFinish)
                                      throws com.atlassian.config.ConfigurationException
Throws:
com.atlassian.config.ConfigurationException

populateRelevantUpgrades

protected void populateRelevantUpgrades(@NotNull
                                        java.lang.String buildNumberLo,
                                        @NotNull
                                        java.lang.String buildNumberHi)
                                 throws com.atlassian.upgrade.UpgradeException
Throws:
com.atlassian.upgrade.UpgradeException

classifyUpgradeTask

protected void classifyUpgradeTask(@NotNull
                                   java.lang.String bambooBuildNumber,
                                   @NotNull
                                   UpgradeTask task)
                            throws com.atlassian.upgrade.UpgradeException
Throws:
com.atlassian.upgrade.UpgradeException

createUpgradeTasks

protected java.util.SortedMap<java.lang.String,UpgradeTask> createUpgradeTasks(@NotNull
                                                                               java.lang.String xPathExpression,
                                                                               @NotNull
                                                                               java.lang.String buildNumberLo,
                                                                               @NotNull
                                                                               java.lang.String buildNumberHi)
                                                                        throws com.atlassian.upgrade.UpgradeException
Throws:
com.atlassian.upgrade.UpgradeException

createUpgradeTask

protected UpgradeTask createUpgradeTask(java.lang.String className)
                                 throws com.atlassian.upgrade.UpgradeException
Throws:
com.atlassian.upgrade.UpgradeException

getUpgradeDocument

protected org.dom4j.Document getUpgradeDocument()
                                         throws org.dom4j.DocumentException
Throws:
org.dom4j.DocumentException

runUpgradeTask

protected java.lang.String runUpgradeTask(@NotNull
                                          UpgradeTask task,
                                          @NotNull
                                          java.util.List<java.lang.String> errors)

getUpgradeTasks

public java.util.SortedMap<java.lang.String,UpgradeTask> getUpgradeTasks()
Gets a map of upgrade tasks which need to run.

Returns:
SortedMap map of upgrade tasks, keys are the string representations of the build number.

setUpgradeUtilityBean

public void setUpgradeUtilityBean(UpgradeUtilityBean upgradeUtilityBean)

setTextProvider

public void setTextProvider(com.opensymphony.xwork.TextProvider textProvider)


Copyright © 2012 Atlassian. All Rights Reserved.