Package org.opennms.upgrade.support
Class Upgrade
- java.lang.Object
-
- org.opennms.upgrade.support.Upgrade
-
public class Upgrade extends Object
The Class Upgrade.This is the helper class that is going to be instantiated from outside OpenNMS to perform the upgrade operations.
- Author:
- Alejandro Galue
-
-
Constructor Summary
Constructors Constructor Description Upgrade()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()Execute.protected voidexecuteUpgrade(OnmsUpgrade upg)Execute upgrade.StringgetClassScope()Gets the class scope.protected List<OnmsUpgrade>getUpgradeObjects()Gets the upgrade objects.UpgradeStatusgetUpgradeStatus()Gets the upgrade status.protected booleanisOpennmsRunning()Checks if is OpenNMS running.protected voidlog(String msgFormat, Object... args)Log.static voidmain(String[] args)The main method.protected voidmarkAsExecuted(OnmsUpgrade upg)Mark as executed.voidsetClassScope(String classScope)Sets the class scope.voidsetUpgradeStatus(UpgradeStatus upgradeStatus)Sets the upgrade status.protected booleanwasExecuted(OnmsUpgrade upg)Was executed.
-
-
-
Method Detail
-
getUpgradeStatus
public UpgradeStatus getUpgradeStatus() throws OnmsUpgradeException
Gets the upgrade status.- Returns:
- the upgrade status
- Throws:
OnmsUpgradeException- the OpenNMS upgrade exception
-
setUpgradeStatus
public void setUpgradeStatus(UpgradeStatus upgradeStatus)
Sets the upgrade status.- Parameters:
upgradeStatus- the new upgrade status
-
getClassScope
public String getClassScope()
Gets the class scope.- Returns:
- the class scope
-
setClassScope
public void setClassScope(String classScope)
Sets the class scope.- Parameters:
classScope- the new class scope
-
isOpennmsRunning
protected boolean isOpennmsRunning()
Checks if is OpenNMS running.- Returns:
- true, if is OpenNMS running
-
wasExecuted
protected boolean wasExecuted(OnmsUpgrade upg) throws OnmsUpgradeException
Was executed.- Parameters:
upg- the upgrade implementation class- Returns:
- true, if successful
- Throws:
OnmsUpgradeException- the OpenNMS upgrade exception
-
executeUpgrade
protected void executeUpgrade(OnmsUpgrade upg)
Execute upgrade.- Parameters:
upg- the upgrade implementation class
-
markAsExecuted
protected void markAsExecuted(OnmsUpgrade upg) throws OnmsUpgradeException
Mark as executed.- Parameters:
upg- the upgrade implementation class- Throws:
OnmsUpgradeException- the OpenNMS upgrade exception
-
log
protected void log(String msgFormat, Object... args)
Log.- Parameters:
msgFormat- the message formatargs- the message's arguments
-
getUpgradeObjects
protected List<OnmsUpgrade> getUpgradeObjects() throws OnmsUpgradeException
Gets the upgrade objects.- Returns:
- the upgrade objects
- Throws:
OnmsUpgradeException- the OpenNMS upgrade exception
-
execute
public void execute() throws OnmsUpgradeExceptionExecute.Perform the upgrade operations.
- Throws:
OnmsUpgradeException- the OpenNMS upgrade exception
-
main
public static void main(String[] args) throws OnmsUpgradeException
The main method.This is the class that must be called externally to perform the upgrade.
TODO: be able to pass the class scope (package filter) TODO: be able to pass the execution status file- Parameters:
args- the arguments- Throws:
OnmsUpgradeException- the OpenNMS upgrade exception
-
-