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

kenneth_suter
01.47.2007 2155def10e32885ae6f05fa8556bd9099c400f39
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -32,6 +32,8 @@
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.logging.Logger;
/**
 * Responsible for providing initial evaluation of command line arguments
@@ -39,6 +41,8 @@
 */
public abstract class Launcher {
  static private final Logger LOG = Logger.getLogger(Launcher.class.getName());
  /** Arguments with which this launcher was invoked. */
  protected String[] args;
@@ -107,6 +111,20 @@
  }
  /**
   * Creates an internationaized message based on the input key and
   * properly formatted for the terminal.
   * @param key for the message in the bundle
   * @param args String... arguments for the message
   * @return String message properly formatted for the terminal
   */
  protected String getMsg(String key, String... args)
  {
    return org.opends.server.util.StaticUtils.wrapText(
            getI18n().getMsg(key, args),
        Utils.getCommandLineMaxLineWidth());
  }
  /**
   * Prints a usage message to the terminal and exits
   * with exit code QuickSetupCli.USER_DATA_ERROR.
   * @param i18nMsg localized user message that will
@@ -240,6 +258,7 @@
      printUsage();
    } else if (isCli()) {
      int exitCode = launchCli(args, createCliApplication());
      preExit();
      System.exit(exitCode);
    } else {
      willLaunchGui();
@@ -248,12 +267,21 @@
        guiLaunchFailed();
        exitCode = launchCli(args, createCliApplication());
        if (exitCode != 0) {
          preExit();
          System.exit(exitCode);
        }
      }
    }
  }
  private void preExit() {
    File logFile = QuickSetupLog.getLogFile();
    if (logFile != null) {
      System.out.println(getMsg("general-see-for-details",
            QuickSetupLog.getLogFile().getPath()));
    }
  }
  /**
   * This class is used to avoid displaying the error message related to display
   * problems that we might have when trying to display the SplashWindow.