opends/src/messages/messages/quicksetup.properties
@@ -662,7 +662,7 @@ the key store contains certificates. INFO_PREVIOUS_BUTTON_LABEL=< Previous INFO_PREVIOUS_BUTTON_TOOLTIP=Go to Previous Step INFO_PROGRESS_CANCEL=Waiting to cancel operation. INFO_PROGRESS_CANCELING=Canceling INFO_PROGRESS_COLOR=000,000,000 INFO_PROGRESS_CONFIGURING=Configuring Directory Server INFO_PROGRESS_CONFIGURING_REPLICATION=Configuring Replication @@ -698,8 +698,12 @@ INFO_PROGRESS_EXTRACTING=Extracting %s INFO_PROGRESS_IMPORT_AUTOMATICALLY_GENERATED=Importing \ Automatically-Generated Data (%s Entries): INFO_PROGRESS_IMPORT_AUTOMATICALLY_GENERATED_NON_VERBOSE=Importing \ Automatically-Generated Data (%s Entries) INFO_PROGRESS_IMPORTING_LDIF=Importing LDIF file %s: INFO_PROGRESS_IMPORTING_LDIFS=Importing LDIF files %s: INFO_PROGRESS_IMPORTING_LDIF_NON_VERBOSE=Importing LDIF file %s INFO_PROGRESS_IMPORTING_LDIFS_NON_VERBOSE=Importing LDIF files %s INFO_PROGRESS_INITIALIZING_ADS=Initializing Registration information INFO_PROGRESS_INITIALIZING_SCHEMA=Initializing schema information INFO_PROGRESS_INITIALIZING_SUFFIX=Initializing base DN %s with the contents \ @@ -710,8 +714,10 @@ INFO_PROGRESS_SERVER_STOPPED=Server stopped. INFO_PROGRESS_SERVER_WAITING_TO_STOP=Waiting for Server to stop... INFO_PROGRESS_STARTING=Starting Directory Server: INFO_PROGRESS_STARTING_NON_VERBOSE=Starting Directory Server INFO_PROGRESS_STEP=Progress INFO_PROGRESS_STOPPING=Stopping Directory Server: INFO_PROGRESS_STOPPING_NON_VERBOSE=Stopping Directory Server INFO_PROGRESS_TITLE=Progress INFO_PROGRESS_UNCONFIGURING_ADS_ON_REMOTE=Reverting Registration \ Configuration on %s opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -78,6 +78,8 @@ private ApplicationTrustManager trustManager; private boolean notifyListeners = true; /** Formats progress messages. */ protected ProgressMessageFormatter formatter; @@ -219,11 +221,11 @@ /** * This method notifies the ProgressUpdateListeners that there was an * update in the installation progress. * @param ratioWhenCompleted the integer that specifies which percentage of * the whole installation has been completed. * @param ratio the integer that specifies which percentage of the whole * installation has been completed. */ public void notifyListenersDone(Integer ratioWhenCompleted) { notifyListeners(ratioWhenCompleted, public void notifyListenersDone(Integer ratio) { notifyListeners(ratio, getSummary(getCurrentProgressStep()), getFormattedDoneWithLineBreak()); } @@ -231,6 +233,18 @@ /** * This method notifies the ProgressUpdateListeners that there was an * update in the installation progress. * @param ratio the integer that specifies which percentage of the whole * installation has been completed. */ public void notifyListenersRatioChange(Integer ratio) { notifyListeners(ratio, getSummary(getCurrentProgressStep()), null); } /** * This method notifies the ProgressUpdateListeners that there was an * update in the installation progress. * @param ratio the integer that specifies which percentage of * the whole installation has been completed. * @param currentPhaseSummary the localized summary message for the @@ -241,8 +255,11 @@ public void notifyListeners(Integer ratio, Message currentPhaseSummary, Message newLogDetail) { listenerDelegate.notifyListeners(getCurrentProgressStep(), if (notifyListeners) { listenerDelegate.notifyListeners(getCurrentProgressStep(), ratio, currentPhaseSummary, newLogDetail); } } /** @@ -250,12 +267,12 @@ * update in the installation progress. * @param ratio the integer that specifies which percentage of * the whole installation has been completed. * @param currentPhaseSummary the localized summary message for the * current installation progress in formatted form. * @param newLogDetail the localized additional log message. */ public void notifyListeners(Integer ratio, Message currentPhaseSummary) { public void notifyListenersWithPoints(Integer ratio, Message newLogDetail) { notifyListeners(ratio, getSummary(getCurrentProgressStep()), formatter.getFormattedWithPoints(currentPhaseSummary)); formatter.getFormattedWithPoints(newLogDetail)); } /** @@ -764,12 +781,23 @@ } /** * Returns <CODE>true</CODE> if the application is running in verbose mode and * <CODE>false</CODE> otherwise. * @return <CODE>true</CODE> if the application is running in verbose mode and * <CODE>false</CODE> otherwise. */ public boolean isVerbose() { return getUserData().isVerbose(); } /** * Returns the error stream to be used by the application when launching * command lines. * @return the error stream to be used by the application when launching * command lines. */ protected ErrorPrintStream getApplicationErrorStream() public ErrorPrintStream getApplicationErrorStream() { return err; } @@ -780,10 +808,35 @@ * @return the output stream to be used by the application when launching * command lines. */ protected OutputPrintStream getApplicationOutputStream() public OutputPrintStream getApplicationOutputStream() { return out; } /** * Notifies the progress update listeners of the application of the message * we received. * @return <CODE>true</CODE> if we must notify the application listeners * of the message and <CODE>false</CODE> otherwise. */ public boolean isNotifyListeners() { return notifyListeners; } /** * Tells whether we must notify the listeners or not of the message * received. * @param notifyListeners the boolean that informs of whether we have * to notify the listeners or not. */ public void setNotifyListeners(boolean notifyListeners) { this.notifyListeners = notifyListeners; } /** * This class is used to notify the ProgressUpdateListeners of events * that are written to the standard error. It is used in WebStartInstaller @@ -795,7 +848,7 @@ * ProgressUpdateListeners with the formatted messages. * */ protected class ErrorPrintStream extends ApplicationPrintStream { public class ErrorPrintStream extends ApplicationPrintStream { /** * Default constructor. @@ -825,7 +878,7 @@ * ProgressUpdateListeners with the formatted messages. * */ protected class OutputPrintStream extends ApplicationPrintStream public class OutputPrintStream extends ApplicationPrintStream { /** @@ -853,8 +906,6 @@ private boolean isFirstLine; private boolean notifyListeners = true; /** * Format a string before sending a listener notification. * @param string to format @@ -878,23 +929,20 @@ @Override public void println(String msg) { if (notifyListeners) MessageBuilder mb = new MessageBuilder(); if (isFirstLine) { MessageBuilder mb = new MessageBuilder(); if (isFirstLine) mb.append(formatString(msg)); } else { if (!Utils.isCli()) { mb.append(formatString(msg)); } else { if (!Utils.isCli()) { mb.append(getLineBreak()); } mb.append(formatString(msg)); mb.append(getLineBreak()); } notifyListeners(mb.toMessage()); mb.append(formatString(msg)); } notifyListeners(mb.toMessage()); LOG.log(Level.INFO, "server: " + msg); isFirstLine = false; } @@ -917,27 +965,5 @@ } println(new String(b, off, len)); } /** * Notifies the progress update listeners of the application of the message * we received. * @return <CODE>true</CODE> if we must notify the application listeners * of the message and <CODE>false</CODE> otherwise. */ public boolean isNotifyListeners() { return notifyListeners; } /** * Tells whether we must notify the listeners or not of the message * received. * @param notifyListeners the boolean that informs of whether we have * to notify the listeners or not. */ public void setNotifyListeners(boolean notifyListeners) { this.notifyListeners = notifyListeners; } } } opends/src/quicksetup/org/opends/quicksetup/UserData.java
@@ -84,6 +84,8 @@ private boolean quiet; private boolean verbose; private boolean interactive; private boolean forceOnError; @@ -100,6 +102,7 @@ startServer = true; enableWindowsService = false; forceOnError = true; verbose = false; LinkedList<String> baseDn = new LinkedList<String>(); baseDn.add("dc=example,dc=com"); @@ -473,6 +476,23 @@ } /** * Sets whether or not this session should be verbose. * @param verbose where true indicates this sesssion should be verbose */ public void setVerbose(boolean verbose) { this.verbose = verbose; } /** * Indicates whether or not the user has requested verbose mode. * * @return boolean where true indicates this session should be verbose. */ public boolean isVerbose() { return this.verbose; } /** * Sets whether or not we must continue when there is a non critical error. * @param forceOnError where true indicates to continue uninstall if there is * a non critical error. opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
@@ -49,6 +49,7 @@ import org.opends.quicksetup.event.ProgressUpdateListener; import org.opends.quicksetup.installandupgrader.ui.WelcomePanel; import org.opends.quicksetup.installer.Installer; import org.opends.quicksetup.installer.SetupLauncher; import org.opends.quicksetup.installer.offline.OfflineInstaller; import org.opends.quicksetup.installer.webstart.WebStartInstaller; import org.opends.quicksetup.ui.FieldName; @@ -56,7 +57,6 @@ import org.opends.quicksetup.ui.QuickSetup; import org.opends.quicksetup.ui.QuickSetupDialog; import org.opends.quicksetup.ui.QuickSetupStepPanel; import org.opends.quicksetup.upgrader.UpgradeLauncher; import org.opends.quicksetup.upgrader.UpgradeWizardStep; import org.opends.quicksetup.upgrader.Upgrader; import org.opends.quicksetup.util.ProgressMessageFormatter; @@ -83,7 +83,7 @@ if (!QuickSetupLog.isInitialized()) QuickSetupLog.initLogFileHandler( File.createTempFile( UpgradeLauncher.LOG_FILE_PREFIX, SetupLauncher.LOG_FILE_PREFIX, QuickSetupLog.LOG_FILE_SUFFIX)); } catch (IOException e) { System.err.println(INFO_ERROR_INITIALIZING_LOG.get()); opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -754,6 +754,15 @@ protected void configureServer() throws ApplicationException { notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CONFIGURING.get())); writeOpenDSJavaHome(); if (Utils.isWebStart()) { setInstallation(new Installation(getUserData().getServerLocation())); } checkAbort(); ArrayList<String> argList = new ArrayList<String>(); argList.add("-C"); argList.add(getConfigurationClassName()); @@ -874,6 +883,7 @@ } LOG.log(Level.INFO, "configure DS cmd: "+cmd); final InstallerHelper helper = new InstallerHelper(); setNotifyListeners(false); InvokeThread thread = new InvokeThread() { public void run() @@ -894,6 +904,10 @@ ReturnCode.CONFIGURATION_ERROR, getThrowableMsg(INFO_ERROR_CONFIGURING.get(), t), t); } finally { setNotifyListeners(true); } isOver = true; } public void abort() @@ -902,7 +916,7 @@ } }; invokeLongOperation(thread); notifyListeners(getFormattedDoneWithLineBreak()); checkAbort(); try @@ -910,7 +924,6 @@ SecurityOptions.CertificateType certType = sec.getCertificateType(); if (certType != SecurityOptions.CertificateType.NO_CERTIFICATE) { notifyListeners(getLineBreak()); notifyListeners(getFormattedWithPoints( INFO_PROGRESS_UPDATING_CERTIFICATES.get())); } @@ -1002,7 +1015,7 @@ } if (certType != SecurityOptions.CertificateType.NO_CERTIFICATE) { notifyListeners(getFormattedDone()); notifyListeners(getFormattedDoneWithLineBreak()); } } catch (Throwable t) @@ -1066,8 +1079,7 @@ final String[] args = new String[argList.size()]; argList.toArray(args); getApplicationOutputStream().setNotifyListeners(false); getApplicationErrorStream().setNotifyListeners(false); setNotifyListeners(false); InvokeThread thread = new InvokeThread() { @@ -1091,8 +1103,7 @@ } finally { getApplicationOutputStream().setNotifyListeners(true); getApplicationErrorStream().setNotifyListeners(true); setNotifyListeners(true); } isOver = true; } @@ -1102,7 +1113,7 @@ } }; invokeLongOperation(thread); notifyListeners(getFormattedDone()); notifyListeners(getFormattedDoneWithLineBreak()); } /** @@ -1116,17 +1127,41 @@ MessageBuilder mb = new MessageBuilder(); if (ldifPaths.size() > 1) { mb.append(getFormattedProgress(INFO_PROGRESS_IMPORTING_LDIFS.get( if (isVerbose()) { mb.append(getFormattedProgress(INFO_PROGRESS_IMPORTING_LDIFS.get( getStringFromCollection(ldifPaths, ", ")))); mb.append(getLineBreak()); } else { mb.append(getFormattedWithPoints( INFO_PROGRESS_IMPORTING_LDIFS_NON_VERBOSE.get( getStringFromCollection(ldifPaths, ", ")))); } } else { mb.append(getFormattedProgress(INFO_PROGRESS_IMPORTING_LDIF.get( if (isVerbose()) { mb.append(getFormattedProgress(INFO_PROGRESS_IMPORTING_LDIF.get( ldifPaths.getFirst()))); mb.append(getLineBreak()); } else { mb.append(getFormattedWithPoints( INFO_PROGRESS_IMPORTING_LDIF_NON_VERBOSE.get( ldifPaths.getFirst()))); } } mb.append(getLineBreak()); notifyListeners(mb.toMessage()); if (!isVerbose()) { setNotifyListeners(false); } ArrayList<String> argList = new ArrayList<String>(); argList.add("-C"); argList.add(getConfigurationClassName()); @@ -1177,6 +1212,13 @@ ReturnCode.CONFIGURATION_ERROR, getThrowableMsg(INFO_ERROR_IMPORTING_LDIF.get(), t), t); } finally { if (!isVerbose()) { setNotifyListeners(true); } } isOver = true; } public void abort() @@ -1185,6 +1227,10 @@ } }; invokeLongOperation(thread); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } /** @@ -1196,14 +1242,28 @@ LinkedList<File> templatePaths = createTemplateFiles(); int nEntries = getUserData().getNewSuffixOptions().getNumberEntries(); MessageBuilder mb = new MessageBuilder(); mb.append(getFormattedProgress( if (isVerbose()) { mb.append(getFormattedProgress( INFO_PROGRESS_IMPORT_AUTOMATICALLY_GENERATED.get( String.valueOf(nEntries)))); mb.append(getLineBreak()); mb.append(getLineBreak()); } else { mb.append(getFormattedWithPoints( INFO_PROGRESS_IMPORT_AUTOMATICALLY_GENERATED_NON_VERBOSE.get( String.valueOf(nEntries)))); } notifyListeners(mb.toMessage()); for (File templatePath : templatePaths) { if (!isVerbose()) { setNotifyListeners(false); } final ArrayList<String> argList = new ArrayList<String>(); argList.add("-C"); argList.add(getConfigurationClassName()); @@ -1247,6 +1307,13 @@ listToString(argList, " "), t.getLocalizedMessage()), t), t); } finally { if (!isVerbose()) { setNotifyListeners(true); } } isOver = true; } public void abort() @@ -1255,6 +1322,10 @@ } }; invokeLongOperation(thread); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } } @@ -1275,8 +1346,11 @@ String ldapUrl = getLdapUrl(auth); String dn = auth.getDn(); String pwd = auth.getPwd(); notifyListeners(getFormattedWithPoints( if (isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_UNCONFIGURING_ADS_ON_REMOTE.get(getHostDisplay(auth)))); } try { if (auth.useSecureConnection()) @@ -1327,8 +1401,10 @@ getUserData())); } } notifyListeners(getFormattedDone()); notifyListeners(getLineBreak()); if (isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } catch (Throwable t) { @@ -1375,8 +1451,7 @@ { } } notifyListeners(getFormattedDone()); notifyListeners(getLineBreak()); notifyListeners(getFormattedDoneWithLineBreak()); } } @@ -1524,8 +1599,7 @@ { } } notifyListeners(getFormattedDone()); notifyListeners(getLineBreak()); notifyListeners(getFormattedDoneWithLineBreak()); checkAbort(); if (getUserData().getReplicationOptions().getType() @@ -1646,8 +1720,7 @@ catch (Throwable t) { } notifyListeners(getFormattedDone()); notifyListeners(getLineBreak()); notifyListeners(getFormattedDoneWithLineBreak()); checkAbort(); } } @@ -1870,18 +1943,27 @@ { case CREATE_BASE_ENTRY: currentProgressStep = InstallProgressStep.CREATING_BASE_ENTRY; notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } createBaseEntry(); break; case IMPORT_FROM_LDIF_FILE: currentProgressStep = InstallProgressStep.IMPORTING_LDIF; notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } importLDIF(); break; case IMPORT_AUTOMATICALLY_GENERATED_DATA: currentProgressStep = InstallProgressStep.IMPORTING_AUTOMATICALLY_GENERATED; notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } importAutomaticallyGenerated(); break; } @@ -2158,8 +2240,11 @@ initial ADS there and register the server with itself. */ if (! adsContext.hasAdminData()) { notifyListeners(getFormattedWithPoints( if (isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_CREATING_ADS_ON_REMOTE.get(getHostDisplay(auth)))); } adsContext.createAdminData(null); ServerDescriptor server @@ -2167,14 +2252,20 @@ server.updateAdsPropertiesWithServerProperties(); adsContext.registerServer(server.getAdsProperties()); createdRemoteAds = true; notifyListeners(getFormattedDone()); notifyListeners(getLineBreak()); if (isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } checkAbort(); } } /* Act on local server depending on if using remote or local ADS */ notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CREATING_ADS.get())); if (isVerbose()) { notifyListeners( getFormattedWithPoints(INFO_PROGRESS_CREATING_ADS.get())); } localCtx = createLocalContext(); // if (isRemoteServer) // { @@ -2204,8 +2295,10 @@ ServerDescriptor.seedAdsTrustStore(localCtx, adsContext.getTrustedCertificates()); } notifyListeners(getFormattedDone()); notifyListeners(getLineBreak()); if (isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } checkAbort(); /* Add global administrator if the user specified one. */ @@ -2213,13 +2306,18 @@ { try { notifyListeners(getFormattedWithPoints( if (isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_CREATING_ADMINISTRATOR.get())); } adsContext.createAdministrator(getAdministratorProperties( getUserData())); if (isRemoteServer && !createdRemoteAds) createdAdministrator = true; notifyListeners(getFormattedDone()); notifyListeners(getLineBreak()); if (isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } checkAbort(); } catch (ADSContextException ade) opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -105,27 +105,47 @@ checkAbort(); writeOpenDSJavaHome(); if (Utils.isWindows() && getUserData().getEnableWindowsService()) { if (isVerbose()) { notifyListeners(getTaskSeparator()); setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE); enableWindowsService(); checkAbort(); } setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE); enableWindowsService(); checkAbort(); } if (mustStart()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.STARTING_SERVER); new ServerController(this).startServer(); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STARTING_NON_VERBOSE.get())); } new ServerController(this).startServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } else { notifyListeners(getLineBreak()); } checkAbort(); } if (mustCreateAds()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.CONFIGURING_ADS); updateADS(); checkAbort(); @@ -133,7 +153,10 @@ if (mustConfigureReplication()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.CONFIGURING_REPLICATION); configureReplication(); checkAbort(); @@ -141,7 +164,10 @@ if (mustInitializeSuffixes()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep( InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES); initializeSuffixes(); @@ -150,9 +176,21 @@ if (mustStop()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.STOPPING_SERVER); new ServerController(this).stopServer(); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STOPPING_NON_VERBOSE.get())); } new ServerController(this).stopServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } checkAbort(); @@ -172,7 +210,16 @@ Installation installation = getInstallation(); if (installation.getStatus().isServerRunning()) { try { new ServerController(installation).stopServer(true); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STOPPING_NON_VERBOSE.get())); } new ServerController(installation).stopServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } catch (Throwable t) { LOG.log(Level.INFO, "error stopping server", t); } @@ -193,7 +240,16 @@ Installation installation = getInstallation(); if (installation.getStatus().isServerRunning()) { try { new ServerController(installation).stopServer(true); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STOPPING_NON_VERBOSE.get())); } new ServerController(installation).stopServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } catch (Throwable t2) { LOG.log(Level.INFO, "error stopping server", t2); } @@ -247,13 +303,31 @@ protected void uninstall() { notifyListeners(getTaskSeparator()); if (!isVerbose()) { notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CANCELING.get())); } else { notifyListeners( getFormattedProgressWithLineBreak(INFO_SUMMARY_CANCELING.get())); } Installation installation = getInstallation(); FileManager fm = new FileManager(this); // Stop the server if necessary if (installation.getStatus().isServerRunning()) { try { new ServerController(installation).stopServer(true); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STOPPING_NON_VERBOSE.get())); } new ServerController(installation).stopServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } catch (ApplicationException e) { LOG.log(Level.INFO, "error stopping server", e); } @@ -326,6 +400,11 @@ LOG.log(Level.INFO, "Error deleting databases", e); } if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } /** opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -119,7 +119,10 @@ getZipInputStream(getRatio(InstallProgressStep.EXTRACTING)); setCurrentProgressStep(InstallProgressStep.EXTRACTING); notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } checkAbort(); @@ -140,16 +143,10 @@ checkAbort(); setCurrentProgressStep(InstallProgressStep.CONFIGURING_SERVER); notifyListeners(getTaskSeparator()); // Write java home before calling Installation class. The installation // class does a call to start-ds to get information about the build. writeOpenDSJavaHome(); setInstallation(new Installation(getUserData().getServerLocation())); checkAbort(); setCurrentProgressStep(InstallProgressStep.CONFIGURING_SERVER); if (isVerbose()) { notifyListeners(getTaskSeparator()); } configureServer(); checkAbort(); @@ -160,23 +157,45 @@ if (Utils.isWindows() && getUserData().getEnableWindowsService()) { if (isVerbose()) { notifyListeners(getTaskSeparator()); setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE); enableWindowsService(); checkAbort(); } setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE); enableWindowsService(); checkAbort(); } if (mustStart()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.STARTING_SERVER); new ServerController(this).startServer(); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STARTING_NON_VERBOSE.get())); } new ServerController(this).startServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } else { notifyListeners(getLineBreak()); } checkAbort(); } if (mustCreateAds()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.CONFIGURING_ADS); updateADS(); checkAbort(); @@ -184,7 +203,10 @@ if (mustConfigureReplication()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.CONFIGURING_REPLICATION); configureReplication(); checkAbort(); @@ -192,7 +214,10 @@ if (mustInitializeSuffixes()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep( InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES); initializeSuffixes(); @@ -201,9 +226,21 @@ if (mustStop()) { notifyListeners(getTaskSeparator()); if (isVerbose()) { notifyListeners(getTaskSeparator()); } setCurrentProgressStep(InstallProgressStep.STOPPING_SERVER); new ServerController(this).stopServer(); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STOPPING_NON_VERBOSE.get())); } new ServerController(this).stopServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } checkAbort(); @@ -223,7 +260,16 @@ Installation installation = getInstallation(); if (installation.getStatus().isServerRunning()) { try { new ServerController(installation).stopServer(true); if (!isVerbose()) { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_STOPPING_NON_VERBOSE.get())); } new ServerController(installation).stopServer(!isVerbose()); if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } catch (Throwable t) { LOG.log(Level.INFO, "error stopping server", t); } @@ -414,7 +460,7 @@ INFO_ERROR_ZIPINPUTSTREAMNULL.get(zipName), null); } notifyListeners(getFormattedDone()); notifyListeners(getFormattedDoneWithLineBreak()); return in; } @@ -524,6 +570,15 @@ if (downloadedBits) { notifyListeners(getTaskSeparator()); if (!isVerbose()) { notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CANCELING.get())); } else { notifyListeners( getFormattedProgressWithLineBreak(INFO_SUMMARY_CANCELING.get())); } Installation installation = getInstallation(); FileManager fm = new FileManager(this); @@ -547,6 +602,15 @@ } else { if (!isVerbose()) { notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CANCELING.get())); } else { notifyListeners( getFormattedProgressWithLineBreak(INFO_SUMMARY_CANCELING.get())); } File serverRoot = new File(getUserData().getServerLocation()); if (serverRoot.exists()) { @@ -559,6 +623,10 @@ } } } if (!isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); } } /** opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -511,7 +511,7 @@ if (!destination.exists()) { if (Utils.insureParentsExist(destination)) { if (application != null) { if ((application != null) && application.isVerbose()) { application.notifyListeners(application.getFormattedWithPoints( INFO_PROGRESS_COPYING_FILE.get( objectFile.getAbsolutePath(), @@ -542,7 +542,7 @@ } } if (application != null) { if ((application != null) && application.isVerbose()) { application.notifyListeners( application.getFormattedDoneWithLineBreak()); } @@ -630,7 +630,7 @@ File file = getObjectFile(); boolean isFile = file.isFile(); if (application != null) { if ((application != null) && application.isVerbose()) { if (isFile) { application.notifyListeners(application.getFormattedWithPoints( INFO_PROGRESS_DELETING_FILE.get(file.getAbsolutePath()))); @@ -685,7 +685,7 @@ errMsg, null); } if (application != null) { if ((application != null) && application.isVerbose()) { application.notifyListeners( application.getFormattedDoneWithLineBreak()); } opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java
@@ -264,7 +264,7 @@ return Message.raw( Constants.LINE_SEPARATOR+ "-----------------------------------------------------------------"+ Constants.LINE_SEPARATOR); Constants.LINE_SEPARATOR+Constants.LINE_SEPARATOR); } /** opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -113,6 +113,11 @@ StandardOutputSuppressor.suppress(); } if (suppressOutput && (application != null)) { application.setNotifyListeners(false); } try { if (application != null) { MessageBuilder mb = new MessageBuilder(); @@ -228,6 +233,10 @@ if (suppressOutput && StandardOutputSuppressor.isSuppressed()) { StandardOutputSuppressor.unsuppress(); } if (suppressOutput && (application != null)) { application.setNotifyListeners(false); } } } @@ -260,209 +269,218 @@ * This methods starts the server. * @param verify boolean indicating whether this method will attempt to * connect to the server after starting to verify that it is listening. * @param suppressOutput indicating that ouput to standard output streams * from the server should be suppressed. * @return OperationOutput object containing output from the start server * command invocation. * @return boolean indicating that ouput to standard output streams * from the server should be suppressed. * @throws org.opends.quicksetup.ApplicationException if something goes wrong. */ private OperationOutput startServer(boolean verify, boolean suppressOuput) throws ApplicationException private OperationOutput startServer(boolean verify, boolean suppressOutput) throws ApplicationException { OperationOutput output = new OperationOutput(); if (suppressOuput && !StandardOutputSuppressor.isSuppressed()) { if (suppressOutput && !StandardOutputSuppressor.isSuppressed()) { StandardOutputSuppressor.suppress(); } try { if (application != null) { MessageBuilder mb = new MessageBuilder(); mb.append(application.getFormattedProgress( INFO_PROGRESS_STARTING.get())); mb.append(application.getLineBreak()); application.notifyListeners(mb.toMessage()); } LOG.log(Level.INFO, "starting server"); ArrayList<String> argList = new ArrayList<String>(); argList.add(Utils.getScriptPath( Utils.getPath(installation.getServerStartCommandFile()))); String[] args = new String[argList.size()]; argList.toArray(args); ProcessBuilder pb = new ProcessBuilder(args); pb.directory(installation.getBinariesDirectory()); Map<String, String> env = pb.environment(); env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home")); // Upgrader's classpath contains jars located in the temporary // directory that we don't want locked by the directory server // when it starts. Since we're just calling the start-ds script // it will figure out the correct classpath for the server. env.remove("CLASSPATH"); try if (suppressOutput && (application != null)) { String startedId = getStartedId(); Process process = pb.start(); application.setNotifyListeners(false); } BufferedReader err = try { if (application != null) { MessageBuilder mb = new MessageBuilder(); mb.append(application.getFormattedProgress( INFO_PROGRESS_STARTING.get())); mb.append(application.getLineBreak()); application.notifyListeners(mb.toMessage()); } LOG.log(Level.INFO, "starting server"); ArrayList<String> argList = new ArrayList<String>(); argList.add(Utils.getScriptPath( Utils.getPath(installation.getServerStartCommandFile()))); String[] args = new String[argList.size()]; argList.toArray(args); ProcessBuilder pb = new ProcessBuilder(args); pb.directory(installation.getBinariesDirectory()); Map<String, String> env = pb.environment(); env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home")); // Upgrader's classpath contains jars located in the temporary // directory that we don't want locked by the directory server // when it starts. Since we're just calling the start-ds script // it will figure out the correct classpath for the server. env.remove("CLASSPATH"); try { String startedId = getStartedId(); Process process = pb.start(); BufferedReader err = new BufferedReader(new InputStreamReader(process.getErrorStream())); BufferedReader out = BufferedReader out = new BufferedReader(new InputStreamReader(process.getInputStream())); StartReader errReader = new StartReader(err, startedId, true); StartReader outputReader = new StartReader(out, startedId, false); StartReader errReader = new StartReader(err, startedId, true); StartReader outputReader = new StartReader(out, startedId, false); long finishedTime = 0; while (!errReader.isFinished() || !outputReader.isFinished()) { try { Thread.sleep(100); } catch (InterruptedException ie) { } if (errReader.startedIdFound() || outputReader.startedIdFound()) { /* When we start the server in windows and we are not running it * under a windows service, the readers are kept open forever. * Once we find that is finished, wait at most 7 seconds. */ if (finishedTime == 0) { finishedTime = System.currentTimeMillis(); } else { if (System.currentTimeMillis() - finishedTime > 7000) { break; } } } } // Collect any messages found in the output List<Message> errors = errReader.getMessages(); if (errors != null) { for(Message error : errors) { output.addErrorMessage(error); } } List<Message> messages = outputReader.getMessages(); if (messages != null) { for (Message msg : messages) { // NOTE: this may not be the best place to drop these. // However upon startup the server seems to log all messages, // regardless of whether or not they signal an error condition, // to its error log. output.addErrorMessage(msg); } } // Check if something wrong occurred reading the starting of the server ApplicationException ex = errReader.getException(); if (ex == null) { ex = outputReader.getException(); } if (ex != null) { // This is meaningless right now since we throw // the exception below, but in case we change out // minds later or add the ability to return exceptions // in the output only instead of throwing... output.setException(ex); throw ex; } else if (verify) { /* * There are no exceptions from the readers and they are marked as * finished. This means that the server has written in its output the * message id informing that it started. So it seems that everything * went fine. * * However we can have issues with the firewalls or do not have rights * to connect. Just check if we can connect to the server. * Try 5 times with an interval of 1 second between try. */ boolean connected = false; Configuration config = installation.getCurrentConfiguration(); int port = config.getPort(); String ldapUrl = "ldap://localhost:" + port; // See if the application has prompted for credentials. If // not we'll just try to connect anonymously. String userDn = null; String userPw = null; if (application != null) { userDn = application.getUserData().getDirectoryManagerDn(); userPw = application.getUserData().getDirectoryManagerPwd(); } if (userDn == null || userPw == null) { userDn = null; userPw = null; } for (int i=0; i<5 && !connected; i++) long finishedTime = 0; while (!errReader.isFinished() || !outputReader.isFinished()) { try { Utils.createLdapContext( ldapUrl, userDn, userPw, 3000, null); connected = true; } catch (NamingException ne) Thread.sleep(100); } catch (InterruptedException ie) { } if (!connected) if (errReader.startedIdFound() || outputReader.startedIdFound()) { /* When we start the server in windows and we are not running it * under a windows service, the readers are kept open forever. * Once we find that is finished, wait at most 7 seconds. */ if (finishedTime == 0) { finishedTime = System.currentTimeMillis(); } else { if (System.currentTimeMillis() - finishedTime > 7000) { break; } } } } // Collect any messages found in the output List<Message> errors = errReader.getMessages(); if (errors != null) { for(Message error : errors) { output.addErrorMessage(error); } } List<Message> messages = outputReader.getMessages(); if (messages != null) { for (Message msg : messages) { // NOTE: this may not be the best place to drop these. // However upon startup the server seems to log all messages, // regardless of whether or not they signal an error condition, // to its error log. output.addErrorMessage(msg); } } // Check if something wrong occurred reading the starting of the server ApplicationException ex = errReader.getException(); if (ex == null) { ex = outputReader.getException(); } if (ex != null) { // This is meaningless right now since we throw // the exception below, but in case we change out // minds later or add the ability to return exceptions // in the output only instead of throwing... output.setException(ex); throw ex; } else if (verify) { /* * There are no exceptions from the readers and they are marked as * finished. This means that the server has written in its output the * message id informing that it started. So it seems that everything * went fine. * * However we can have issues with the firewalls or do not have rights * to connect. Just check if we can connect to the server. * Try 5 times with an interval of 1 second between try. */ boolean connected = false; Configuration config = installation.getCurrentConfiguration(); int port = config.getPort(); String ldapUrl = "ldap://localhost:" + port; // See if the application has prompted for credentials. If // not we'll just try to connect anonymously. String userDn = null; String userPw = null; if (application != null) { userDn = application.getUserData().getDirectoryManagerDn(); userPw = application.getUserData().getDirectoryManagerPwd(); } if (userDn == null || userPw == null) { userDn = null; userPw = null; } for (int i=0; i<5 && !connected; i++) { try { Thread.sleep(1000); Utils.createLdapContext( ldapUrl, userDn, userPw, 3000, null); connected = true; } catch (Throwable t) catch (NamingException ne) { } if (!connected) { try { Thread.sleep(1000); } catch (Throwable t) { } } } if (!connected) { if (Utils.isWindows()) { throw new ApplicationException( ReturnCode.START_ERROR, INFO_ERROR_STARTING_SERVER_IN_WINDOWS.get( String.valueOf(port)), null); } else { throw new ApplicationException( ReturnCode.START_ERROR, INFO_ERROR_STARTING_SERVER_IN_UNIX.get( String.valueOf(port)), null); } } } if (!connected) { if (Utils.isWindows()) { throw new ApplicationException( ReturnCode.START_ERROR, INFO_ERROR_STARTING_SERVER_IN_WINDOWS.get( String.valueOf(port)), null); } else { throw new ApplicationException( ReturnCode.START_ERROR, INFO_ERROR_STARTING_SERVER_IN_UNIX.get( String.valueOf(port)), null); } } } } catch (IOException ioe) { throw new ApplicationException( } catch (IOException ioe) { throw new ApplicationException( ReturnCode.START_ERROR, getThrowableMsg(INFO_ERROR_STARTING_SERVER.get(), ioe), ioe); } } finally { if (suppressOuput && StandardOutputSuppressor.isSuppressed()) { getThrowableMsg(INFO_ERROR_STARTING_SERVER.get(), ioe), ioe); } } finally { if (suppressOutput && StandardOutputSuppressor.isSuppressed()) { StandardOutputSuppressor.unsuppress(); } } if (suppressOutput && (application != null)) { application.setNotifyListeners(true); } } return output; } opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
@@ -276,7 +276,15 @@ if (application != null) { Message progressSummary = INFO_PROGRESS_EXTRACTING.get(Utils.getPath(destination)); application.notifyListeners(ratioBeforeCompleted, progressSummary); if (application.isVerbose()) { application.notifyListenersWithPoints(ratioBeforeCompleted, progressSummary); } else { application.notifyListenersRatioChange(ratioBeforeCompleted); } } LOG.log(Level.INFO, "extracting " + Utils.getPath(destination)); if (Utils.insureParentsExist(destination)) @@ -313,7 +321,10 @@ throw new IOException("Could not create parent path: " + destination); } if (application != null) { application.notifyListenersDone(ratioWhenCompleted); if (application.isVerbose()) { application.notifyListenersDone(ratioWhenCompleted); } } } opends/src/server/org/opends/server/tools/InstallDS.java
@@ -404,7 +404,6 @@ cmd = Utils.getPath(binDir, Installation.UNIX_STATUSCLI_FILE_NAME); } printlnProgress(); printlnProgress(); printProgress(INFO_INSTALLDS_STATUS_COMMAND_LINE.get(cmd)); printlnProgress(); @@ -558,7 +557,7 @@ * {@inheritDoc} */ public boolean isVerbose() { return true; return argParser.verboseArg.isPresent(); } /** @@ -575,6 +574,7 @@ uData.setConfigurationClassName(argParser.configClassArg.getValue()); uData.setConfigurationFile(argParser.configFileArg.getValue()); uData.setQuiet(isQuiet()); uData.setVerbose(isVerbose()); // Check the validity of the directory manager DNs String dmDN = argParser.directoryManagerDNArg.getValue(); opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
@@ -66,6 +66,7 @@ BooleanArgument showUsageArg; BooleanArgument quietArg; BooleanArgument noPromptArg; BooleanArgument verboseArg; StringArgument propertiesFileArgument; BooleanArgument noPropertiesFileArgument; BooleanArgument skipPortCheckArg; @@ -176,6 +177,10 @@ noPromptArg.setPropertyName(OPTION_LONG_NO_PROMPT); addArgument(noPromptArg); verboseArg = new BooleanArgument(OPTION_LONG_VERBOSE, OPTION_SHORT_VERBOSE, OPTION_LONG_VERBOSE, INFO_DESCRIPTION_VERBOSE.get()); addArgument(verboseArg); propertiesFileArgument = new StringArgument( "propertiesFilePath", null, OPTION_LONG_PROP_FILE_PATH, false, false, true, OPTION_VALUE_PROP_FILE_PATH, null, null,