| | |
| | | |
| | | 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 |
| | |
| | | */ |
| | | public abstract class Launcher { |
| | | |
| | | static private final Logger LOG = Logger.getLogger(Launcher.class.getName()); |
| | | |
| | | /** Arguments with which this launcher was invoked. */ |
| | | protected String[] args; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | printUsage(); |
| | | } else if (isCli()) { |
| | | int exitCode = launchCli(args, createCliApplication()); |
| | | preExit(); |
| | | System.exit(exitCode); |
| | | } else { |
| | | willLaunchGui(); |
| | |
| | | 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. |