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

kenneth_suter
28.39.2007 72a49cdc969eed0d2a46c6ec37390a351e360015
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -45,6 +45,7 @@
import org.opends.quicksetup.util.Utils;
import org.opends.quicksetup.util.ZipExtractor;
import org.opends.quicksetup.util.ServerController;
import org.opends.quicksetup.util.FileManager;
/**
 * This is an implementation of the Installer class that is used to install
@@ -109,12 +110,16 @@
      setStatus(InstallProgressStep.DOWNLOADING);
      checkAbort();
      InputStream in =
          getZipInputStream(getRatio(InstallProgressStep.EXTRACTING));
      setStatus(InstallProgressStep.EXTRACTING);
      notifyListeners(getTaskSeparator());
      checkAbort();
      createParentDirectoryIfRequired();
      extractZipFiles(in, getRatio(InstallProgressStep.EXTRACTING),
          getRatio(InstallProgressStep.CONFIGURING_SERVER));
@@ -127,6 +132,9 @@
      {
        LOG.log(Level.INFO, "Error closing zip input stream: "+t, t);
      }
      checkAbort();
      setStatus(InstallProgressStep.CONFIGURING_SERVER);
      notifyListeners(getTaskSeparator());
@@ -135,15 +143,24 @@
      writeJavaHome();
      setInstallation(new Installation(getUserData().getServerLocation()));
      checkAbort();
      setStatus(InstallProgressStep.CONFIGURING_SERVER);
      configureServer();
      checkAbort();
      createData();
      checkAbort();
      if (Utils.isWindows() && getUserData().getEnableWindowsService())
      {
          notifyListeners(getTaskSeparator());
          setStatus(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
          enableWindowsService();
          checkAbort();
      }
      if (mustStart())
@@ -151,6 +168,8 @@
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.STARTING_SERVER);
        new ServerController(this).startServer();
        checkAbort();
      }
      if (mustConfigureReplication())
@@ -159,6 +178,8 @@
        notifyListeners(getTaskSeparator());
        configureReplication();
        checkAbort();
      }
      if (mustInitializeSuffixes())
@@ -166,6 +187,8 @@
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES);
        initializeSuffixes();
        checkAbort();
      }
      if (mustCreateAds())
@@ -173,6 +196,8 @@
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.CONFIGURING_ADS);
        updateADS();
        checkAbort();
      }
      if (mustStop())
@@ -182,17 +207,24 @@
        new ServerController(this).stopServer();
      }
      checkAbort();
      setStatus(InstallProgressStep.FINISHED_SUCCESSFULLY);
      notifyListeners(null);
    } catch (ApplicationException ex)
    {
      notifyListeners(getLineBreak());
      notifyListenersOfLog();
      setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
      String html = getFormattedError(ex, true);
      notifyListeners(html);
      LOG.log(Level.SEVERE, "Error installing.", ex);
      if (ApplicationException.Type.CANCEL.equals(ex.getType())) {
        uninstall();
        setStatus(InstallProgressStep.FINISHED_CANCELED);
        notifyListeners(null);
      } else {
        notifyListeners(getLineBreak());
        notifyListenersOfLog();
        setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
        String html = getFormattedError(ex, true);
        notifyListeners(html);
        LOG.log(Level.SEVERE, "Error installing.", ex);
      }
    }
    catch (Throwable t)
    {
@@ -338,6 +370,7 @@
    }
    hmRatio.put(InstallProgressStep.FINISHED_SUCCESSFULLY, 100);
    hmRatio.put(InstallProgressStep.FINISHED_CANCELED, 100);
    hmRatio.put(InstallProgressStep.FINISHED_WITH_ERROR, 100);
  }
@@ -462,6 +495,32 @@
  }
  /**
   * Uninstall what has already been installed.
   */
  private void uninstall() {
    Installation installation = getInstallation();
    FileManager fm = new FileManager(this);
    // Stop the server if necessary
    if (installation.getStatus().isServerRunning()) {
      try {
        new ServerController(installation).stopServer(true);
      } catch (ApplicationException e) {
        LOG.log(Level.INFO, "error stopping server", e);
      }
    }
    uninstallServices();
    try {
      fm.deleteRecursively(installation.getRootDirectory(), null,
              FileManager.DeletionPolicy.DELETE_ON_EXIT_IF_UNSUCCESSFUL);
    } catch (ApplicationException e) {
      LOG.log(Level.INFO, "error deleting files", e);
    }
  }
  /**
   * {@inheritDoc}
   */
  protected String getInstallationPath()