From 3c64e2dd5fdb72bbc12b99ac385d5f69438732b9 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 05 Jan 2016 13:59:21 +0000
Subject: [PATCH] Code cleanups. Added toString() to UpgradeTasks.
---
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java | 85 ++++++++----------------------------------
1 files changed, 16 insertions(+), 69 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java
index 52421a9..d212c22 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeContext.java
@@ -21,13 +21,10 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2013-2014 ForgeRock AS
+ * Portions Copyright 2013-2016 ForgeRock AS
*/
-
package org.opends.server.tools.upgrade;
-
-
import static org.opends.messages.ToolMessages.*;
import javax.security.auth.callback.Callback;
@@ -36,14 +33,11 @@
import javax.security.auth.callback.TextOutputCallback;
import org.forgerock.i18n.LocalizableMessage;
-
-import com.forgerock.opendj.cli.ClientException;
-import com.forgerock.opendj.cli.ReturnCode;
-
import org.opends.server.types.InitializationException;
import org.opends.server.util.BuildVersion;
-
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
/**
* Context information which is passed to upgrade tasks. This might include
@@ -51,44 +45,23 @@
*/
public final class UpgradeContext
{
-
- /**
- * The version we upgrade from.
- */
+ /** The version we upgrade from. */
private final BuildVersion fromVersion;
-
- /**
- * The version we want to upgrade to.
- */
+ /** The version we want to upgrade to. */
private final BuildVersion toVersion;
- /**
- * The call-back handler for interacting with the upgrade application.
- */
+ /** The call-back handler for interacting with the upgrade application. */
private final CallbackHandler handler;
- /**
- * If ignore errors is enabled.
- */
+ /** If ignore errors is enabled. */
private boolean isIgnoreErrorsMode;
-
- /**
- * If accept license is enabled.
- */
+ /** If accept license is enabled. */
private boolean isAcceptLicenseMode;
-
- /**
- * If interactive mode is enabled.
- */
+ /** If interactive mode is enabled. */
private boolean isInteractiveMode;
-
- /**
- * If force upgrade is enabled.
- */
+ /** If force upgrade is enabled. */
private boolean isForceUpgradeMode;
-
-
/**
* Creates a new upgrade context for upgrading from the instance version (as
* obtained from config/buildinfo) to the binary version.
@@ -104,8 +77,6 @@
this(BuildVersion.instanceVersion(), BuildVersion.binaryVersion(), handler);
}
-
-
/**
* Constructor for the upgrade context.
*
@@ -125,8 +96,6 @@
this.handler = handler;
}
-
-
/**
* Returns the old version.
*
@@ -137,8 +106,6 @@
return fromVersion;
}
-
-
/**
* Returns the new version.
*
@@ -149,8 +116,6 @@
return toVersion;
}
-
-
/**
* Returns the ignore error mode.
*
@@ -161,8 +126,6 @@
return isIgnoreErrorsMode;
}
-
-
/**
* Sets the ignore errors mode.
*
@@ -176,8 +139,6 @@
return this;
}
-
-
/**
* Returns the accept license mode.
*
@@ -188,8 +149,6 @@
return isAcceptLicenseMode;
}
-
-
/**
* Sets the accept license mode.
*
@@ -203,8 +162,6 @@
return this;
}
-
-
/**
* Returns the callback handler.
*
@@ -215,8 +172,6 @@
return handler;
}
-
-
/**
* Returns the status of the interactive mode.
*
@@ -227,8 +182,6 @@
return isInteractiveMode;
}
-
-
/**
* Sets the interactive mode.
*
@@ -242,8 +195,6 @@
return this;
}
-
-
/**
* Returns the status of the force upgrade mode.
*
@@ -254,8 +205,6 @@
return isForceUpgradeMode;
}
-
-
/**
* Sets the force upgrade mode.
*
@@ -269,8 +218,6 @@
return this;
}
-
-
/**
* Sends notification message to the application via the call-back handler.
*
@@ -293,8 +240,6 @@
}
}
-
-
/**
* Sends notification message to the application via the call-back handler
* containing specific sub type message.
@@ -320,8 +265,6 @@
}
}
-
-
/**
* Displays a progress callback.
*
@@ -344,8 +287,6 @@
}
}
-
-
/**
* Asks a confirmation to the user. Answer is yes or no.
*
@@ -374,4 +315,10 @@
}
return confirmYNCallback.getSelectedIndex();
}
+
+ @Override
+ public String toString()
+ {
+ return "Upgrade from " + fromVersion + " to " + toVersion;
+ }
}
--
Gitblit v1.10.0