From 6df6635f1250c399a2f39d87d0534301ce4c22d7 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Fri, 31 Aug 2007 15:43:58 +0000
Subject: [PATCH] Exposes the reversion functionality of the upgrader (issue 2169). Originally it was intended to be exposed as a new script but in order to avoid the negativity of having a command devoted to undoing the upgrade and to avoid more scripts in the top-level directory, I've exposed the functionality as 2 new options in the existing upgrade script. I will update the Wiki with documentation for these new options soon.
---
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java | 61 ++++++------------------------
1 files changed, 12 insertions(+), 49 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
index 1949ac8..20d8945 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
@@ -27,16 +27,9 @@
package org.opends.quicksetup.upgrader;
-import org.opends.messages.Message;
-import static org.opends.messages.QuickSetupMessages.*;
-
import org.opends.quicksetup.CliApplicationHelper;
import org.opends.quicksetup.UserDataException;
-import org.opends.server.util.args.ArgumentParser;
-import org.opends.server.util.args.StringArgument;
-import org.opends.server.util.args.ArgumentException;
-import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -47,14 +40,17 @@
static private final Logger LOG =
Logger.getLogger(UpgraderCliHelper.class.getName());
- StringArgument localInstallPackFileNameArg = null;
+ /** Launcher for this CLI invocation. */
+ protected UpgradeLauncher launcher;
/**
- * Default constructor.
+ * Creates a parameterized instance.
+ * @param launcher for this CLI
*/
- public UpgraderCliHelper()
+ public UpgraderCliHelper(UpgradeLauncher launcher)
{
super(System.out, System.err, System.in);
+ this.launcher = launcher;
}
/**
@@ -66,47 +62,14 @@
*/
public UpgradeUserData createUserData(String[] args)
throws UserDataException {
+ // It is assumed that if we got here that the build
+ // exptractor took care of extracting the file and
+ // putting it in tmp/upgrade for us. So there's
+ // not too much to do at this point.
UpgradeUserData uud = new UpgradeUserData();
- ArgumentParser ap = createArgumentParser();
- try {
- ap.parseArguments(args);
- uud.setQuiet(isQuiet());
- uud.setInteractive(isInteractive());
-
- // There is no need to check/validate the file argument
- // since this is done by the BuildExtractor
-
- } catch (ArgumentException e) {
- throw new UserDataException(null, INFO_ERROR_PARSING_OPTIONS.get());
- }
+ uud.setQuiet(launcher.isQuiet());
+ uud.setInteractive(!launcher.isNoPrompt());
return uud;
}
- private ArgumentParser createArgumentParser() {
-
- // TODO: get rid of this method and user launcher.getArgumentParser
-
- Message toolDescription = INFO_UPGRADE_LAUNCHER_DESCRIPTION.get();
- ArgumentParser argParser = createArgumentParser(
- "org.opends.quicksetup.upgrader.Upgrader",
- toolDescription,
- false);
-
- // Initialize all the app specific command-line argument types
- // and register them with the parser.
- try {
- localInstallPackFileNameArg =
- new StringArgument("install package file",
- UpgradeLauncher.FILE_OPTION_SHORT,
- UpgradeLauncher.FILE_OPTION_LONG,
- false, true, "{install package file}", null);
- argParser.addArgument(localInstallPackFileNameArg);
- } catch (ArgumentException e) {
- LOG.log(Level.INFO, "error", e);
- }
-
- return argParser;
- }
-
-
}
--
Gitblit v1.10.0