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

jvergara
13.06.2007 c89f3bf8b7afbdc7cd45a1c8dc6c1d132931dacd
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();
  }
}