From 8feee36de8e6042f928439b06a03d50018423afe Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 17 Aug 2007 00:53:26 +0000
Subject: [PATCH] The following modifications have the following goals:
---
opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java | 60 ++++++++++++++++++++++++++----------------------------------
1 files changed, 26 insertions(+), 34 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
index 2fcf8be..3398ac5 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
@@ -28,21 +28,19 @@
package org.opends.guitools.uninstaller;
import static org.opends.messages.AdminToolMessages.*;
-import static org.opends.messages.ToolMessages.*;
import org.opends.messages.Message;
-import static org.opends.server.tools.ToolConstants.*;
+import org.opends.messages.ToolMessages;
import java.io.File;
import java.util.logging.Logger;
import org.opends.quicksetup.CliApplication;
-import org.opends.quicksetup.CliApplicationHelper;
import org.opends.quicksetup.Launcher;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.ServerConstants;
+import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
-import org.opends.server.util.args.BooleanArgument;
/**
* This class is called by the uninstall command lines to launch the uninstall
@@ -62,7 +60,7 @@
Logger.getLogger(UninstallLauncher.class.getName());
/**
- * The main method which is called by the setup command lines.
+ * The main method which is called by the uninstall command lines.
*
* @param args the arguments passed by the command lines. In the case
* we want to launch the cli setup they are basically the arguments that we
@@ -81,7 +79,7 @@
new UninstallLauncher(args).launch();
}
- private ArgumentParser argParser;
+ private UninstallerArgumentParser argParser;
/**
* Creates a launcher.
@@ -99,45 +97,39 @@
}
System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName);
- argParser = new ArgumentParser(getClass().getName(),
+ initializeParser();
+ }
+
+ /**
+ * Initialize the contents of the argument parser.
+ */
+ protected void initializeParser()
+ {
+ argParser = new UninstallerArgumentParser(getClass().getName(),
INFO_UNINSTALL_LAUNCHER_USAGE_DESCRIPTION.get(), false);
- BooleanArgument cli;
- BooleanArgument silent;
- BooleanArgument interactive;
- BooleanArgument showUsage;
try
{
- cli = new BooleanArgument("cli", 'c', "cli",
- INFO_UNINSTALLDS_DESCRIPTION_CLI.get());
- argParser.addArgument(cli);
- interactive = new BooleanArgument(
- CliApplicationHelper.INTERACTIVE_OPTION_LONG,
- CliApplicationHelper.INTERACTIVE_OPTION_SHORT,
- CliApplicationHelper.INTERACTIVE_OPTION_LONG,
- INFO_DESCRIPTION_INTERACTIVE.get());
- argParser.addArgument(interactive);
- silent = new BooleanArgument(
- CliApplicationHelper.SILENT_OPTION_LONG,
- CliApplicationHelper.SILENT_OPTION_SHORT,
- CliApplicationHelper.SILENT_OPTION_LONG,
- INFO_UNINSTALLDS_DESCRIPTION_SILENT.get());
- argParser.addArgument(silent);
- showUsage = new BooleanArgument("showusage", OPTION_SHORT_HELP,
- OPTION_LONG_HELP,
- INFO_DESCRIPTION_USAGE.get());
- argParser.addArgument(showUsage);
- argParser.setUsageArgument(showUsage);
+ argParser.initializeGlobalOption(System.err);
}
- catch (Throwable t)
+ catch (ArgumentException ae)
{
- System.out.println("ERROR: "+t);
- t.printStackTrace();
+ Message message =
+ ToolMessages.ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
+ System.err.println(org.opends.server.util.StaticUtils.wrapText(message,
+ Utils.getCommandLineMaxLineWidth()));
}
}
/**
* {@inheritDoc}
*/
+ protected boolean isCli() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
protected void guiLaunchFailed(String logFilePath) {
if (logFilePath != null)
{
--
Gitblit v1.10.0