mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

lutoff
15.17.2007 ff3b4829ffd6f5705d3782449535bc2c2cc86eaa
Fix for [Issue 1608]  setup and uninstall don't have -V/--version argument
2 files modified
86 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/Launcher.java 77 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties 9 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -27,6 +27,14 @@
package org.opends.quicksetup;
import static org.opends.server.util.DynamicConstants.BUILD_ID;
import static org.opends.server.util.DynamicConstants.FIX_IDS;
import static org.opends.server.util.DynamicConstants.MAJOR_VERSION;
import static org.opends.server.util.DynamicConstants.MINOR_VERSION;
import static org.opends.server.util.DynamicConstants.POINT_VERSION;
import static org.opends.server.util.DynamicConstants.PRODUCT_NAME;
import static org.opends.server.util.DynamicConstants.VERSION_QUALIFIER;
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.i18n.ResourceProvider;
@@ -82,11 +90,33 @@
  }
  /**
   * 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() {
    boolean printVersion = false;
    if ((args != null) && (args.length > 0))
    {
      for (String arg : args)
      {
        if (arg.equalsIgnoreCase("-V") || arg.equalsIgnoreCase("--version"))
        {
          printVersion = true;
        }
      }
    }
    return printVersion;
  }
  /**
   * 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
   *
   * @return boolean where true indicates that a CLI application
   *         should be launched
   */
  protected boolean isCli() {
    boolean isCli = false;
@@ -243,9 +273,44 @@
  }
  /**
   * Prints a usage statement to terminal and exits
   * Prints the version statement to terminal and exits
   * with an error code.
   */
  private void printVersion()
  {
    String EOL = System.getProperty("line.separator");
    StringBuilder buffer = new StringBuilder();
    buffer.append(PRODUCT_NAME);
    buffer.append(" ");
    buffer.append(MAJOR_VERSION);
    buffer.append(".");
    buffer.append(MINOR_VERSION);
    if ((VERSION_QUALIFIER == null) || (VERSION_QUALIFIER.length() == 0))
    {
      buffer.append(".");
      buffer.append(POINT_VERSION);
    }
    else
    {
      buffer.append(VERSION_QUALIFIER);
    }
    buffer.append(EOL);
    buffer.append("Build " + BUILD_ID);
    buffer.append(EOL);
    if ((FIX_IDS != null) && (FIX_IDS.length() > 0))
    {
      buffer.append("Fix IDs:  " + FIX_IDS);
      buffer.append(EOL);
    }
    System.out.print(buffer);
    return;
  }
  /**
   * Prints a usage statement to terminal and exits with an error
   * code.
   */
  protected abstract void printUsage();
  /**
@@ -276,7 +341,11 @@
   * The main method which is called by the uninstall command lines.
   */
  public void launch() {
    if (shouldPrintUsage()) {
    if (shouldPrintVersion())
    {
      printVersion();
    }
    else if (shouldPrintUsage()) {
      printUsage();
    } else if (isCli()) {
      int exitCode = launchCli(args, createCliApplication());
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -35,6 +35,7 @@
Server.\n\Usage:  {0} {options}\n        where {options} include:\n\
--cli\n\    Specifies to use the command line setup.  If not specified the \
graphical\n\    interface will be launched.\n\
-V, --version\n    Display Directory Server version information.\n\
-?, -H , --help\n    Display this usage information.\n\n\
The following options will only be taken into account if the option --cli \n\
(command line) is specified\n\
@@ -68,6 +69,7 @@
Server.\n\Usage:  {0} {options}\n        where {options} include:\n\
--cli\n\    Specifies to use the command line setup.  If not specified the \
graphical\n\    interface will be launched.\n\
-V, --version\n    Display Directory Server version information.\n\
-?, -H, --help\n    Display this usage information.\n\n\
The following options will only be taken into account if the option --cli \n\
(command line) is specified\n\
@@ -114,7 +116,8 @@
Usage:  {0} {options}\n        where {options} include:\n\
--cli\n\    Specifies to use the command line uninstall.  If not specified the \
graphical\n\    interface will be launched.\n\
-?, -H, --help\n    Display this usage information.\n\n\
-?, -H, --help\n    Display this usage information.\n\
-V, --version\n    Display Directory Server version information.\n\n\
The following options will only be taken into account if the option --cli \n\
(command line) is specified\n\
-s, --silentUninstall\n    Perform a silent uninstall.
@@ -169,7 +172,9 @@
   to a newer version.  If no options are specified on the command line, the \
   graphical version of this tool will launch.  Otherwise the the command line \
   version will be launched.\n\nUsage:  {0} {options} where {options} \
   include:\n\n  -f, --file\n  Specifies an existing OpenDS package (.zip) \
   include:\n\n\
     -V, --version\n    Display Directory Server version information.\n\
     -f, --file\n  Specifies an existing OpenDS package (.zip) \
   file to which the\n  current build will be upgraded using the command line \
   \n  version of this tool\n
upgrade-launcher-launching-gui=Launching graphical upgrade...