| | |
| | | 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 |
| | |
| | | |
| | | 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)); |
| | |
| | | { |
| | | LOG.log(Level.INFO, "Error closing zip input stream: "+t, t); |
| | | } |
| | | |
| | | checkAbort(); |
| | | |
| | | setStatus(InstallProgressStep.CONFIGURING_SERVER); |
| | | notifyListeners(getTaskSeparator()); |
| | | |
| | |
| | | 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()) |
| | |
| | | notifyListeners(getTaskSeparator()); |
| | | setStatus(InstallProgressStep.STARTING_SERVER); |
| | | new ServerController(this).startServer(); |
| | | |
| | | checkAbort(); |
| | | } |
| | | |
| | | if (mustConfigureReplication()) |
| | |
| | | notifyListeners(getTaskSeparator()); |
| | | |
| | | configureReplication(); |
| | | |
| | | checkAbort(); |
| | | } |
| | | |
| | | if (mustInitializeSuffixes()) |
| | |
| | | notifyListeners(getTaskSeparator()); |
| | | setStatus(InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES); |
| | | initializeSuffixes(); |
| | | |
| | | checkAbort(); |
| | | } |
| | | |
| | | if (mustCreateAds()) |
| | |
| | | notifyListeners(getTaskSeparator()); |
| | | setStatus(InstallProgressStep.CONFIGURING_ADS); |
| | | updateADS(); |
| | | |
| | | checkAbort(); |
| | | } |
| | | |
| | | if (mustStop()) |
| | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | |
| | | hmRatio.put(InstallProgressStep.FINISHED_SUCCESSFULLY, 100); |
| | | hmRatio.put(InstallProgressStep.FINISHED_CANCELED, 100); |
| | | hmRatio.put(InstallProgressStep.FINISHED_WITH_ERROR, 100); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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() |