From c89f3bf8b7afbdc7cd45a1c8dc6c1d132931dacd Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 13 Nov 2007 17:06:35 +0000
Subject: [PATCH] Fix for issue 2582.
---
opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java | 89 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
index f9e676c..bff9bca 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
@@ -28,6 +28,8 @@
package org.opends.guitools.uninstaller;
import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.messages.ToolMessages.ERR_ERROR_PARSING_ARGS;
+
import org.opends.messages.Message;
import org.opends.messages.ToolMessages;
@@ -37,6 +39,7 @@
import org.opends.quicksetup.Launcher;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.QuickSetupLog;
+import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.args.ArgumentException;
@@ -101,6 +104,38 @@
}
/**
+ * {@inheritDoc}
+ */
+ public void launch() {
+ // Validate user provided data
+ try
+ {
+ argParser.parseArguments(args);
+ if (argParser.isVersionArgumentPresent())
+ {
+ System.exit(ReturnCode.PRINT_VERSION.getReturnCode());
+ }
+ else if (argParser.isUsageArgumentPresent())
+ {
+ System.exit(ReturnCode.SUCCESSFUL.getReturnCode());
+ }
+ else
+ {
+ super.launch();
+ }
+ }
+ catch (ArgumentException ae)
+ {
+ Message message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
+ System.err.println(message);
+ System.err.println();
+ System.err.println(argParser.getUsage());
+
+ System.exit(ReturnCode.USER_DATA_ERROR.getReturnCode());
+ }
+ }
+
+ /**
* Initialize the contents of the argument parser.
*/
protected void initializeParser()
@@ -165,4 +200,58 @@
return INFO_FRAME_UNINSTALL_TITLE.get();
}
+ /**
+ * Indicates whether or not the launcher should print a usage
+ * statement based on the content of the arguments passed into
+ * the constructor.
+ * @return boolean where true indicates usage should be printed
+ */
+ protected boolean shouldPrintUsage() {
+ return argParser.isUsageArgumentPresent() &&
+ !argParser.usageOrVersionDisplayed();
+ }
+
+ /**
+ * Indicates whether or not the launcher should print a usage
+ * statement based on the content of the arguments passed into
+ * the constructor.
+ * @return boolean where true indicates usage should be printed
+ */
+ protected boolean isQuiet() {
+ return argParser.isQuiet();
+ }
+
+ /**
+ * Indicates whether or not the launcher should print a usage
+ * statement based on the content of the arguments passed into
+ * the constructor.
+ * @return boolean where true indicates usage should be printed
+ */
+ protected boolean isNoPrompt() {
+ return !argParser.isInteractive();
+ }
+
+ /**
+ * Indicates whether or not the launcher should print a version
+ * statement based on the content of the arguments passed into
+ * the constructor.
+ * @return boolean where true indicates version should be printed
+ */
+ protected boolean shouldPrintVersion() {
+ return argParser.isVersionArgumentPresent() &&
+ !argParser.usageOrVersionDisplayed();
+ }
+
+ /**
+ * Indicates whether the launcher will launch a command line versus
+ * a graphical application based on the contents of the arguments
+ * passed into the constructor.
+ *
+ * @return boolean where true indicates that a CLI application
+ * should be launched
+ */
+ protected boolean isCli() {
+ return argParser.isCli();
+ }
+
}
--
Gitblit v1.10.0