コード例 #1
0
  /* Undo updatetool configuration and post-installation setups.*/
  public void unconfigureUpdatetool() throws Exception {
    /* Try to shutdown the notifer. Don't do this on Mac, the notifier command
    does not work on Mac, refer to Issue #7348. */
    if (!OSUtils.isMac() && !OSUtils.isAix()) {
      try {
        String shutdownCommand;
        if (OSUtils.isWindows()) {
          shutdownCommand = productRef.getInstallLocation() + "\\updatetool\\bin\\updatetool.exe";
        } else {
          shutdownCommand = productRef.getInstallLocation() + "/updatetool/bin/updatetool";
        }
        String[] shutdownCommandArray = {shutdownCommand, "--notifier", "--shutdown"};
        LOGGER.log(Level.INFO, Msg.get("SHUTDOWN_NOTIFIER", null));
        ExecuteCommand shutdownExecuteCommand = new ExecuteCommand(shutdownCommandArray);
        shutdownExecuteCommand.setOutputType(ExecuteCommand.ERRORS | ExecuteCommand.NORMAL);
        shutdownExecuteCommand.setCollectOutput(true);
        LOGGER.log(
            Level.FINEST,
            shutdownExecuteCommand.expandCommand(shutdownExecuteCommand.getCommand()));
        shutdownExecuteCommand.execute();
      } catch (Exception e) {
        LOGGER.log(Level.FINEST, e.getMessage());
        // Its okay to ignore this for now.
      }
    } /* End, conditional code for Mac and Aix. */

    /* Now unregister notifer. */
    try {
      String configCommand;
      if (OSUtils.isWindows()) {
        configCommand = productRef.getInstallLocation() + "\\updatetool\\bin\\updatetoolconfig.bat";
      } else {
        configCommand = productRef.getInstallLocation() + "/updatetool/bin/updatetoolconfig";
      }
      String[] configCommandArray = {configCommand, "--unregister"};
      LOGGER.log(Level.INFO, Msg.get("UNREGISTER_NOTIFIER", null));
      ExecuteCommand configExecuteCommand = new ExecuteCommand(configCommandArray);
      configExecuteCommand.setOutputType(ExecuteCommand.ERRORS | ExecuteCommand.NORMAL);
      configExecuteCommand.setCollectOutput(true);
      LOGGER.log(
          Level.FINEST, configExecuteCommand.expandCommand(configExecuteCommand.getCommand()));

      configExecuteCommand.execute();
    } catch (Exception e) {
      LOGGER.log(Level.FINEST, e.getMessage());
      // Its okay to ignore this for now.

    }
  }
コード例 #2
0
  /* Try to stop domain, so that uninstall can cleanup files effectively.
  Currently only tries to stop the default domain.
   */
  private void stopDomain() {
    ExecuteCommand asadminExecuteCommand = null;
    try {

      String[] asadminCommandArray = {
        GlassFishUtils.getGlassfishAdminScriptPath(productRef.getInstallLocation()),
        "stop-domain",
        "domain1"
      };
      LOGGER.log(Level.INFO, Msg.get("STOP_DEFAULT_DOMAIN", null));
      asadminExecuteCommand = new ExecuteCommand(asadminCommandArray);
      asadminExecuteCommand.setOutputType(ExecuteCommand.ERRORS | ExecuteCommand.NORMAL);
      asadminExecuteCommand.setCollectOutput(true);
      LOGGER.log(
          Level.FINEST, asadminExecuteCommand.expandCommand(asadminExecuteCommand.getCommand()));
      asadminExecuteCommand.execute();
    } catch (Exception e) {
    }
    LOGGER.log(Level.FINEST, asadminExecuteCommand.getAllOutput());
  }