From e1e9596f6ae81d9aeb74177cf2792533966f45eb Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Mon, 23 Jul 2007 18:25:05 +0000
Subject: [PATCH] This commit does some initial work in anticipation of the reverter tool:

---
 opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java |   96 +++++++++++++++++++++++++-----------------------
 1 files changed, 50 insertions(+), 46 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
index 2426473..60d6785 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
@@ -32,6 +32,7 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.logging.Logger;
+import java.util.logging.Level;
 
 import org.opends.quicksetup.Launcher;
 import org.opends.quicksetup.CliApplication;
@@ -63,7 +64,6 @@
   static private final Logger LOG =
           Logger.getLogger(InstallLauncher.class.getName());
 
-
   /**
    * The main method which is called by the setup command lines.
    *
@@ -82,6 +82,8 @@
     new InstallLauncher(args).launch();
   }
 
+  private ArgumentParser argParser;
+
   /**
    * Creates a launcher.
    *
@@ -89,43 +91,7 @@
    */
   public InstallLauncher(String[] args) {
     super(args);
-  }
 
-  /**
-   * {@inheritDoc}
-   */
-  protected void guiLaunchFailed(String logFileName) {
-    if (logFileName != null)
-    {
-      System.err.println(getMsg("setup-launcher-gui-launched-failed-details",
-          logFileName));
-    }
-    else
-    {
-      System.err.println(getMsg("setup-launcher-gui-launched-failed"));
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void willLaunchGui() {
-    System.out.println(getMsg("setup-launcher-launching-gui"));
-    System.setProperty("org.opends.quicksetup.Application.class",
-            "org.opends.quicksetup.installer.offline.OfflineInstaller");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected String getFrameTitle() {
-    return getI18n().getMsg("frame-install-title");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void printUsage(boolean toStdErr) {
     String scriptName;
     if (Utils.isWindows()) {
       scriptName = Installation.WINDOWS_SETUP_FILE_NAME;
@@ -133,7 +99,8 @@
       scriptName = Installation.UNIX_SETUP_FILE_NAME;
     }
     System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName);
-    ArgumentParser argParser = new ArgumentParser(getClass().getName(),
+
+    argParser = new ArgumentParser(getClass().getName(),
         getI18n().getMsg("setup-launcher-usage-description"),
         false);
     BooleanArgument   addBaseEntry;
@@ -238,8 +205,6 @@
           MSGID_INSTALLDS_DESCRIPTION_HELP);
       argParser.addArgument(showUsage);
       argParser.setUsageArgument(showUsage);
-      String msg = argParser.getUsage();
-      printUsage(msg, toStdErr);
     }
     catch (Throwable t)
     {
@@ -251,6 +216,44 @@
   /**
    * {@inheritDoc}
    */
+  protected void guiLaunchFailed(String logFileName) {
+    if (logFileName != null)
+    {
+      System.err.println(getMsg("setup-launcher-gui-launched-failed-details",
+          logFileName));
+    }
+    else
+    {
+      System.err.println(getMsg("setup-launcher-gui-launched-failed"));
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public ArgumentParser getArgumentParser() {
+    return this.argParser;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  protected void willLaunchGui() {
+    System.out.println(getMsg("setup-launcher-launching-gui"));
+    System.setProperty("org.opends.quicksetup.Application.class",
+            "org.opends.quicksetup.installer.offline.OfflineInstaller");
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  protected String getFrameTitle() {
+    return getI18n().getMsg("frame-install-title");
+  }
+
+  /**
+   * {@inheritDoc}
+   */
   protected CliApplication createCliApplication() {
     // Setup currently has no implemented CliApplication
     // but rather relies on InstallDS from the server
@@ -264,7 +267,7 @@
    * {@inheritDoc}
    */
   @Override
-  protected int launchCli(String[] args, CliApplication cliApp) {
+  protected int launchCli(CliApplication cliApp) {
     System.setProperty("org.opends.quicksetup.cli", "true");
 
     if (Utils.isWindows()) {
@@ -276,10 +279,10 @@
     }
     ArrayList<String> newArgList = new ArrayList<String>();
     if (args != null) {
-      for (int i = 0; i < args.length; i++) {
-        if (!args[i].equalsIgnoreCase("--cli") &&
-            !args[i].equalsIgnoreCase("-c")) {
-          newArgList.add(args[i]);
+      for (String arg : args) {
+        if (!arg.equalsIgnoreCase("--cli") &&
+                !arg.equalsIgnoreCase("-c")) {
+          newArgList.add(arg);
         }
       }
     }
@@ -292,7 +295,8 @@
 
     String[] newArgs = new String[newArgList.size()];
     newArgList.toArray(newArgs);
-
+    LOG.log(Level.INFO, "Launching 'installMain' with args " +
+            Utils.listToString(newArgList, " "));
     return org.opends.server.tools.InstallDS.installMain(newArgs);
   }
 }

--
Gitblit v1.10.0