From aed142d4d844c03c001a46e39f3e0f7ddc4f46ce Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 21 Dec 2007 20:50:26 +0000
Subject: [PATCH] Fix for 1862 verbosity options for quicksetup tools
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java | 184 ++++++++++--
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ProgressMessageFormatter.java | 13
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java | 105 +++++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 33 +
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java | 2
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java | 87 ++++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java | 18 +
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java | 81 ++++
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java | 12
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java | 3
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java | 2
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java | 13
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java | 19 +
opendj-sdk/opends/src/messages/messages/quicksetup.properties | 39 ++
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java | 88 +++++
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java | 151 ++++++++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java | 2
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java | 7
18 files changed, 741 insertions(+), 118 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index 69504f1..94c62dc 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -125,6 +125,7 @@
boolean isInteractive;
boolean isQuiet;
+ boolean isVerbose;
boolean isCancelled = false;
/* Step 1: analyze the arguments.
@@ -142,11 +143,15 @@
isQuiet = args.isQuiet();
+ isVerbose = args.isVerbose();
+
userData.setQuiet(isQuiet);
+ userData.setVerbose(isVerbose);
userData.setForceOnError(args.isForceOnError());
userData.setTrustManager(args.getTrustManager());
- /* Step 2: check that the provided parameters are compatible.
+ /*
+ * Step 2: check that the provided parameters are compatible.
*/
MessageBuilder buf = new MessageBuilder();
int v = args.validateGlobalOptions(buf);
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index d1f1243..f1628be 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -759,15 +759,24 @@
if (getUserData().getStopServer()) {
status = UninstallProgressStep.STOPPING_SERVER;
- if (displaySeparator) {
+ if (displaySeparator && isVerbose()) {
notifyListeners(getTaskSeparator());
}
- new ServerController(this).stopServer();
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+ }
+ new ServerController(this).stopServer(!isVerbose());
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDoneWithLineBreak());
+ }
displaySeparator = true;
}
if (isWindowsServiceEnabled()) {
status = UninstallProgressStep.DISABLING_WINDOWS_SERVICE;
- if (displaySeparator) {
+ if (displaySeparator && isVerbose()) {
notifyListeners(getTaskSeparator());
}
disableWindowsService();
@@ -777,7 +786,7 @@
Set<String> dbsToDelete = getUninstallUserData().getExternalDbsToRemove();
if (dbsToDelete.size() > 0) {
status = UninstallProgressStep.DELETING_EXTERNAL_DATABASE_FILES;
- if (displaySeparator) {
+ if (displaySeparator && isVerbose()) {
notifyListeners(getTaskSeparator());
}
@@ -790,7 +799,7 @@
if (logsToDelete.size() > 0) {
status = UninstallProgressStep.DELETING_EXTERNAL_LOG_FILES;
- if (displaySeparator) {
+ if (displaySeparator && isVerbose()) {
notifyListeners(getTaskSeparator());
}
@@ -805,7 +814,7 @@
userData.getRemoveLDIFs() ||
userData.getRemoveLibrariesAndTools() ||
userData.getRemoveLogs();
- if (displaySeparator && somethingToDelete) {
+ if (displaySeparator && somethingToDelete && isVerbose()) {
notifyListeners(getTaskSeparator());
}
@@ -964,11 +973,23 @@
*/
private void deleteExternalDatabaseFiles(Set<String> dbFiles)
throws ApplicationException {
- notifyListeners(getFormattedProgressWithLineBreak(
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedProgressWithLineBreak(
INFO_PROGRESS_DELETING_EXTERNAL_DB_FILES.get()));
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_DELETING_EXTERNAL_DB_FILES_NON_VERBOSE.get()));
+ }
for (String path : dbFiles) {
deleteRecursively(new File(path));
}
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDone());
+ }
}
/**
@@ -979,11 +1000,23 @@
*/
private void deleteExternalLogFiles(Set<String> logFiles)
throws ApplicationException {
- notifyListeners(getFormattedProgressWithLineBreak(
- INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES.get()));
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedProgressWithLineBreak(
+ INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES.get()));
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES_NON_VERBOSE.get()));
+ }
for (String path : logFiles) {
deleteRecursively(new File(path));
}
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDone());
+ }
}
/**
@@ -993,8 +1026,16 @@
*/
private void deleteInstallationFiles(int minRatio, int maxRatio)
throws ApplicationException {
- notifyListeners(getFormattedProgressWithLineBreak(
- INFO_PROGRESS_DELETING_INSTALLATION_FILES.get()));
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedProgressWithLineBreak(
+ INFO_PROGRESS_DELETING_INSTALLATION_FILES.get()));
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_DELETING_INSTALLATION_FILES_NON_VERBOSE.get()));
+ }
File f = new File(getInstallPathFromClasspath());
InstallationFilesToDeleteFilter filter =
new InstallationFilesToDeleteFilter();
@@ -1054,6 +1095,10 @@
}
hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, maxRatio);
}
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDone());
+ }
}
/**
@@ -1116,12 +1161,15 @@
private void delete(File file) throws ApplicationException {
boolean isFile = file.isFile();
- if (isFile) {
- notifyListeners(getFormattedWithPoints(
- INFO_PROGRESS_DELETING_FILE.get(file.getAbsolutePath())));
- } else {
- notifyListeners(getFormattedWithPoints(
- INFO_PROGRESS_DELETING_DIRECTORY.get(file.getAbsolutePath())));
+ if (isVerbose())
+ {
+ if (isFile) {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_DELETING_FILE.get(file.getAbsolutePath())));
+ } else {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_DELETING_DIRECTORY.get(file.getAbsolutePath())));
+ }
}
boolean delete = false;
@@ -1153,7 +1201,10 @@
errMsg, null);
}
- notifyListeners(getFormattedDoneWithLineBreak());
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedDoneWithLineBreak());
+ }
}
private boolean equalsOrDescendant(File file, File directory) {
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java
index 16939ed..8f1680d 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java
@@ -195,7 +195,6 @@
secureArgsList.adminUidArg.setHidden(false);
defaultArgs.remove(secureArgsList.hostNameArg);
defaultArgs.remove(secureArgsList.portArg);
- defaultArgs.remove(verboseArg);
UserData uData = new UserData();
referencedHostNameArg = new StringArgument("referencedHostName",
ToolConstants.OPTION_SHORT_HOST,
@@ -243,6 +242,17 @@
}
/**
+ * Tells whether the user specified to have a verbose uninstall or not.
+ * This method must be called after calling parseArguments.
+ * @return <CODE>true</CODE> if the user specified to have a verbose
+ * uninstall and <CODE>false</CODE> otherwise.
+ */
+ public boolean isVerbose()
+ {
+ return verboseArg.isPresent();
+ }
+
+ /**
* Tells whether the user specified to remove all files.
* This method must be called after calling parseArguments.
* @return <CODE>true</CODE> if the user specified to remove all files and
diff --git a/opendj-sdk/opends/src/messages/messages/quicksetup.properties b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
index 0010b71..71ea775 100644
--- a/opendj-sdk/opends/src/messages/messages/quicksetup.properties
+++ b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
@@ -683,11 +683,17 @@
Installation Path:
INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES=Deleting Log Files outside the \
Installation Path:
+INFO_PROGRESS_DELETING_EXTERNAL_DB_FILES_NON_VERBOSE=Deleting Database Files \
+ outside the Installation Path
+INFO_PROGRESS_DELETING_EXTERNAL_LOG_FILES_NON_VERBOSE=Deleting Log Files \
+ outside the Installation Path
INFO_PROGRESS_DELETING_FILE=Deleting file %s
INFO_PROGRESS_DELETING_FILE_DOES_NOT_EXIST=Ignoring file %s since it does not \
exist.
INFO_PROGRESS_DELETING_INSTALLATION_FILES=Deleting Files under the \
Installation Path:
+INFO_PROGRESS_DELETING_INSTALLATION_FILES_NON_VERBOSE=Deleting Files under the \
+ Installation Path
INFO_PROGRESS_DETAILS_LABEL=Details:
INFO_PROGRESS_DIALOG_TITLE=Progress
INFO_PROGRESS_DISABLING_WINDOWS_SERVICE=Disabling Windows Service...
@@ -949,6 +955,8 @@
INFO_SUMMARY_INSTALL_NOT_STARTED=Starting QuickSetup...
INFO_SUMMARY_REVERT_ABORT=Canceling Reversion...
INFO_SUMMARY_REVERT_CLEANUP=Cleaning Up...
+INFO_PROGRESS_REVERT_ABORT=Canceling Reversion
+INFO_PROGRESS_REVERT_CLEANUP=Cleaning Up
INFO_SUMMARY_REVERT_FINISHED_CANCELED_CLI=OpenDS Reversion Canceled. The \
upgrade operation was canceled and the installation has been restored to the \
state it was in before the reversion operation.
@@ -968,6 +976,10 @@
INFO_SUMMARY_REVERT_NOT_STARTED=Starting Reversion...
INFO_SUMMARY_REVERT_REVERTING_COMPONENTS=Reverting Components...
INFO_SUMMARY_REVERT_VERIFYING=Verifying revert...
+INFO_PROGRESS_REVERT_HISTORY=Recording Reversion History
+INFO_PROGRESS_REVERT_INITIALIZING=Initializing Reversion
+INFO_PROGRESS_REVERT_REVERTING_COMPONENTS=Reverting Components
+INFO_PROGRESS_REVERT_VERIFYING=Verifying revert
INFO_SUMMARY_START_ERROR=An error occurred Starting Server. Check 'Details' \
text area for more information.
INFO_SUMMARY_START_SUCCESS=OpenDS Started Successfully.
@@ -989,7 +1001,6 @@
Configuration Customizations...
INFO_SUMMARY_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION=Calculating Schema \
Customizations...
-INFO_SUMMARY_UPGRADE_CHECK_SERVER_HEALTH=Checking Server Health...
INFO_SUMMARY_UPGRADE_CLEANUP=Cleaning Up...
INFO_SUMMARY_UPGRADE_DOWNLOADING=Downloading Build...
INFO_SUMMARY_UPGRADE_EXTRACTING=Extracting Build...
@@ -1031,6 +1042,30 @@
INFO_SUMMARY_UPGRADE_PREPARING_CUSTOMIZATIONS=Preparing Customizations...
INFO_SUMMARY_UPGRADE_UPGRADING_COMPONENTS=Upgrading Components...
INFO_SUMMARY_UPGRADE_VERIFYING=Verifying Upgrade...
+INFO_PROGRESS_UPGRADE_INTERNAL_STOP=Closing internal connection handlers
+INFO_PROGRESS_UPGRADE_ABORT=Canceling Upgrade
+INFO_PROGRESS_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION=Applying Configuration \
+ Customizations
+INFO_PROGRESS_UPGRADE_APPLYING_ADS_CUSTOMIZATION=Applying Registration \
+ Customizations
+INFO_PROGRESS_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION=Applying Schema \
+ Customizations
+INFO_PROGRESS_UPGRADE_BACKING_UP_DB=Backing Up Data
+INFO_PROGRESS_UPGRADE_BACKING_UP_FILES=Backing Up Files
+INFO_PROGRESS_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION=Calculating \
+ Configuration Customizations
+INFO_PROGRESS_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION=Calculating Schema \
+ Customizations
+INFO_PROGRESS_UPGRADE_CLEANUP=Cleaning Up
+INFO_PROGRESS_UPGRADE_DOWNLOADING=Downloading Build
+INFO_PROGRESS_UPGRADE_EXTRACTING=Extracting Build
+INFO_PROGRESS_UPGRADE_EXTRACTING_VERBOSE=Extracting Build:
+INFO_PROGRESS_UPGRADE_HISTORY=Recording Upgrade History
+INFO_PROGRESS_UPGRADE_INITIALIZING=Initializing Upgrade
+INFO_PROGRESS_UPGRADE_PREPARING_CUSTOMIZATIONS=Preparing Customizations
+INFO_PROGRESS_UPGRADE_UPGRADING_COMPONENTS=Upgrading Components
+INFO_PROGRESS_UPGRADE_VERIFYING=Verifying Upgrade
+
INFO_SUMMARY_WAITING_TO_CANCEL=Waiting to Cancel...
INFO_TEXT_AREA_BORDER_COLOR=000,000,000
INFO_TEXTFIELD_COLOR=000,000,000
@@ -1130,7 +1165,7 @@
INFO_REVERSION_TYPE_PROMPT_RECENT=Use the most recent versioned archive
INFO_REVERSION_TYPE_PROMPT_FILE=Manually specify a reversion archive directory
INFO_REVERSION_DIR_PROMPT=Select a reversion archive directory:
-INFO_REVERSION_DIR_WAIT=Initializing archives...
+INFO_REVERSION_DIR_WAIT=Initializing archives
INFO_REVERSION_DIR_FROM_UPGRADE=%s archived on %s
INFO_UPGRADE_ORACLE_ACTION=Upgrade requires manual action
INFO_UPGRADE_ORACLE_INFO=Upgrade information
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
index 522651e..317920b 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -966,4 +966,92 @@
println(new String(b, off, len));
}
}
+
+
+
+ /**
+ * Class used to add points periodically to the end of the logs.
+ *
+ */
+ protected class PointAdder implements Runnable
+ {
+ private Thread t;
+ private boolean stopPointAdder;
+ private boolean pointAdderStopped;
+
+ /**
+ * Default constructor.
+ */
+ public PointAdder()
+ {
+ }
+
+ /**
+ * Starts the PointAdder: points are added at the end of the logs
+ * periodically.
+ */
+ public void start()
+ {
+ MessageBuilder mb = new MessageBuilder();
+ mb.append(formatter.getSpace());
+ for (int i=0; i< 5; i++)
+ {
+ mb.append(formatter.getFormattedPoint());
+ }
+ Integer ratio = getRatio(getCurrentProgressStep());
+ Message currentPhaseSummary = getSummary(getCurrentProgressStep());
+ listenerDelegate.notifyListeners(getCurrentProgressStep(),
+ ratio, currentPhaseSummary, mb.toMessage());
+ t = new Thread(this);
+ t.start();
+ }
+
+ /**
+ * Stops the PointAdder: points are no longer added at the end of the logs
+ * periodically.
+ */
+ public synchronized void stop()
+ {
+ stopPointAdder = true;
+ while (!pointAdderStopped)
+ {
+ try
+ {
+ t.interrupt();
+ // To allow the thread to set the boolean.
+ Thread.sleep(100);
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run()
+ {
+ while (!stopPointAdder)
+ {
+ try
+ {
+ Thread.sleep(3000);
+ Integer ratio = getRatio(getCurrentProgressStep());
+ Message currentPhaseSummary = getSummary(getCurrentProgressStep());
+ listenerDelegate.notifyListeners(getCurrentProgressStep(),
+ ratio, currentPhaseSummary, formatter.getFormattedPoint());
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+ pointAdderStopped = true;
+
+ Integer ratio = getRatio(getCurrentProgressStep());
+ Message currentPhaseSummary = getSummary(getCurrentProgressStep());
+ listenerDelegate.notifyListeners(getCurrentProgressStep(),
+ ratio, currentPhaseSummary, formatter.getSpace());
+ }
+ }
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
index 2f649f8..6c41fb2 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -151,7 +151,7 @@
{
for (String arg : args)
{
- if (arg.equalsIgnoreCase("-V") || arg.equalsIgnoreCase("--version"))
+ if (arg.equalsIgnoreCase("--version"))
{
printVersion = true;
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index a43e298..d44288f 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1135,7 +1135,7 @@
}
else
{
- mb.append(getFormattedWithPoints(
+ mb.append(getFormattedProgress(
INFO_PROGRESS_IMPORTING_LDIFS_NON_VERBOSE.get(
getStringFromCollection(ldifPaths, ", "))));
}
@@ -1150,16 +1150,19 @@
}
else
{
- mb.append(getFormattedWithPoints(
+ mb.append(getFormattedProgress(
INFO_PROGRESS_IMPORTING_LDIF_NON_VERBOSE.get(
ldifPaths.getFirst())));
}
}
notifyListeners(mb.toMessage());
+ final PointAdder pointAdder = new PointAdder();
+
if (!isVerbose())
{
setNotifyListeners(false);
+ pointAdder.start();
}
ArrayList<String> argList = new ArrayList<String>();
@@ -1216,6 +1219,7 @@
{
if (!isVerbose())
{
+ pointAdder.stop();
setNotifyListeners(true);
}
}
@@ -1251,19 +1255,23 @@
}
else
{
- mb.append(getFormattedWithPoints(
+ mb.append(getFormattedProgress(
INFO_PROGRESS_IMPORT_AUTOMATICALLY_GENERATED_NON_VERBOSE.get(
String.valueOf(nEntries))));
}
notifyListeners(mb.toMessage());
+ final PointAdder pointAdder = new PointAdder();
+ if (!isVerbose())
+ {
+ pointAdder.start();
+ }
for (File templatePath : templatePaths)
{
if (!isVerbose())
{
setNotifyListeners(false);
}
-
final ArrayList<String> argList = new ArrayList<String>();
argList.add("-C");
argList.add(getConfigurationClassName());
@@ -1312,6 +1320,10 @@
if (!isVerbose())
{
setNotifyListeners(true);
+ if (ae != null)
+ {
+ pointAdder.stop();
+ }
}
}
isOver = true;
@@ -1324,6 +1336,7 @@
invokeLongOperation(thread);
if (!isVerbose())
{
+ pointAdder.stop();
notifyListeners(getFormattedDoneWithLineBreak());
}
}
@@ -2060,13 +2073,19 @@
boolean isSchema = areDnsEqual(dn, Constants.SCHEMA_DN);
if(isADS)
{
- notifyListeners(getFormattedWithPoints(
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_INITIALIZING_ADS.get()));
+ }
}
else if (isSchema)
{
- notifyListeners(getFormattedWithPoints(
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_INITIALIZING_SCHEMA.get()));
+ }
}
else
{
@@ -2181,7 +2200,7 @@
}
throw ae;
}
- if (isADS || isSchema)
+ if ((isADS || isSchema) && isVerbose())
{
notifyListeners(getFormattedDone());
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java
index 9204e73..12f12b9 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionProgressStep.java
@@ -37,53 +37,122 @@
*/
enum ReversionProgressStep implements ProgressStep {
- NOT_STARTED(INFO_SUMMARY_REVERT_NOT_STARTED.get(), 0),
+ NOT_STARTED(INFO_SUMMARY_REVERT_NOT_STARTED.get(), null, null, 0, false),
- INITIALIZING(INFO_SUMMARY_REVERT_INITIALIZING.get(), 20),
+ INITIALIZING(INFO_SUMMARY_REVERT_INITIALIZING.get(),
+ INFO_PROGRESS_REVERT_INITIALIZING.get(),
+ INFO_PROGRESS_REVERT_INITIALIZING.get(),
+ 20, true),
- STOPPING_SERVER(INFO_SUMMARY_STOPPING.get(), 40),
+ STOPPING_SERVER(INFO_SUMMARY_STOPPING.get(), null, null, 40, false),
- REVERTING_FILESYSTEM(INFO_SUMMARY_REVERT_REVERTING_COMPONENTS.get(), 60),
+ REVERTING_FILESYSTEM(INFO_SUMMARY_REVERT_REVERTING_COMPONENTS.get(),
+ INFO_PROGRESS_REVERT_REVERTING_COMPONENTS.get(),
+ INFO_PROGRESS_REVERT_REVERTING_COMPONENTS.get(), 60, true),
- VERIFYING(INFO_SUMMARY_REVERT_VERIFYING.get(), 70),
+ VERIFYING(INFO_SUMMARY_REVERT_VERIFYING.get(),
+ INFO_PROGRESS_REVERT_VERIFYING.get(),
+ INFO_PROGRESS_REVERT_VERIFYING.get(), 70, true),
- STARTING_SERVER(INFO_SUMMARY_STARTING.get(), 80),
+ STARTING_SERVER(INFO_SUMMARY_STARTING.get(), null, null, 80, false),
- RECORDING_HISTORY(INFO_SUMMARY_REVERT_HISTORY.get(), 90),
+ RECORDING_HISTORY(INFO_SUMMARY_REVERT_HISTORY.get(),
+ INFO_PROGRESS_REVERT_HISTORY.get(),
+ INFO_PROGRESS_REVERT_HISTORY.get(), 90, true),
- CLEANUP(INFO_SUMMARY_REVERT_CLEANUP.get(), 95),
+ CLEANUP(INFO_SUMMARY_REVERT_CLEANUP.get(),
+ INFO_PROGRESS_REVERT_CLEANUP.get(),
+ INFO_PROGRESS_REVERT_CLEANUP.get(), 95, true),
- ABORT(INFO_SUMMARY_REVERT_ABORT.get(), 99),
+ ABORT(INFO_SUMMARY_REVERT_ABORT.get(),
+ INFO_PROGRESS_REVERT_ABORT.get(),
+ INFO_PROGRESS_REVERT_ABORT.get(), 99, true),
- FINISHED_WITH_ERRORS(INFO_SUMMARY_REVERT_FINISHED_WITH_ERRORS_CLI.get(), 100),
+ FINISHED_WITH_ERRORS(INFO_SUMMARY_REVERT_FINISHED_WITH_ERRORS_CLI.get(),
+ null, null, 100, false),
FINISHED_WITH_WARNINGS(
- INFO_SUMMARY_REVERT_FINISHED_WITH_WARNINGS_CLI.get(), 100),
+ INFO_SUMMARY_REVERT_FINISHED_WITH_WARNINGS_CLI.get(), null, null,
+ 100, false),
- FINISHED_CANCELED(INFO_SUMMARY_REVERT_FINISHED_CANCELED_CLI.get(), 100),
+ FINISHED_CANCELED(INFO_SUMMARY_REVERT_FINISHED_CANCELED_CLI.get(), null,
+ null, 100, false),
- FINISHED(INFO_SUMMARY_REVERT_FINISHED_SUCCESSFULLY_CLI.get("",""), 100);
+ FINISHED(INFO_SUMMARY_REVERT_FINISHED_SUCCESSFULLY_CLI.get("",""), null, null,
+ 100, false);
private Message summaryMsg;
+ private Message logMsg;
+ private Message logMsgVerbose;
private int progress;
+ private boolean logWithPoints;
- private ReversionProgressStep(Message summaryMsg, int progress) {
+ private ReversionProgressStep(Message summaryMsg, Message logMsg,
+ Message logMsgVerbose, int progress, boolean logWithPoints) {
this.summaryMsg = summaryMsg;
+ this.logMsg = logMsg;
+ this.logMsgVerbose = logMsgVerbose;
this.progress = progress;
+ this.logWithPoints = logWithPoints;
}
/**
- * Return a key for access a summary message.
+ * Return the summary message for the step.
*
- * @return String representing key for access summary in resource bundle
+ * @return the summary message for the step.
*/
- public Message getSummaryMesssage() {
+ public Message getSummaryMessage() {
return summaryMsg;
}
/**
- * Gets the amount of progress to show in the progress meter for this step.
+ * Return the log message for the step.
+ * @param isVerbose whether we are running in verbose mode or not.
*
+ * @return the log message for the step.
+ */
+ public Message getLogMsg(boolean isVerbose) {
+ Message msg;
+ if (isVerbose)
+ {
+ msg = logMsgVerbose;
+ }
+ else
+ {
+ msg = logMsg;
+ }
+ return msg;
+ }
+
+ /**
+ * Return whether we must add points to the log message or not.
+ * @param isVerbose whether we are running in verbose mode or not.
+ *
+ * @return <CODE>true</CODE> if we must add points to the log message and
+ * <CODE>false</CODE> otherwise.
+ */
+ public boolean logRequiresPoints(boolean isVerbose) {
+ boolean returnValue;
+ if (logWithPoints)
+ {
+ if (isVerbose)
+ {
+ returnValue = logMsgVerbose == logMsg;
+ }
+ else
+ {
+ returnValue = true;
+ }
+ }
+ else
+ {
+ returnValue = false;
+ }
+ return returnValue;
+ }
+
+ /**
+ * Gets the amount of progress to show in the progress meter for this step.
* @return int representing progress
*/
public int getProgress() {
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
index b99f88f..407252e 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
@@ -143,7 +143,8 @@
if (historyDir != null && historyDir.exists()) {
// Print a wait message, this could take a while
- System.out.println(INFO_REVERSION_DIR_WAIT.get());
+ System.out.println(formatter.getFormattedWithPoints(
+ INFO_REVERSION_DIR_WAIT.get()));
String[] historyChildren = historyDir.list();
Arrays.sort(historyChildren);
@@ -287,6 +288,7 @@
}
ud.setQuiet(rl.isQuiet());
ud.setInteractive(!rl.isNoPrompt());
+ ud.setVerbose(rl.isVerbose());
}
return ud;
}
@@ -408,7 +410,30 @@
// txt = getFinalWarningMessage();
}
else {
- txt = (((ReversionProgressStep) step).getSummaryMesssage());
+ txt = (((ReversionProgressStep) step).getSummaryMessage());
+ }
+ return txt;
+ }
+
+ /**
+ * Returns the progress message for a given progress step.
+ * @param step the progress step.
+ * @return the progress message for the provided step.
+ */
+ private Message getLogMsg(ReversionProgressStep step) {
+ Message txt;
+ if (step == ReversionProgressStep.FINISHED) {
+ txt = getFinalSuccessMessage();
+ } else if (step == ReversionProgressStep.FINISHED_CANCELED) {
+ txt = step.getSummaryMessage();
+ } else if (step == ReversionProgressStep.FINISHED_WITH_ERRORS) {
+ txt = step.getSummaryMessage();
+ } else if (step == ReversionProgressStep.FINISHED_WITH_WARNINGS) {
+ txt = step.getSummaryMessage();
+ }
+ else
+ {
+ txt = step.getLogMsg(isVerbose());
}
return txt;
}
@@ -502,8 +527,27 @@
try {
setCurrentProgressStep(ReversionProgressStep.STOPPING_SERVER);
LOG.log(Level.INFO, "Stopping server");
- sc.stopServer(true);
- notifyListeners(getFormattedDoneWithLineBreak());
+
+ if (isVerbose())
+ {
+ notifyListeners(getTaskSeparator());
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+ }
+
+ sc.stopServer(!isVerbose());
+
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDoneWithLineBreak());
+ }
+ else
+ {
+ notifyListeners(getLineBreak());
+ }
} catch (ApplicationException ae) {
notifyListeners(getFormattedErrorWithLineBreak());
}
@@ -535,8 +579,24 @@
try {
LOG.log(Level.INFO, "Restarting server");
setCurrentProgressStep(ReversionProgressStep.STARTING_SERVER);
- sc.startServer();
- notifyListeners(getFormattedDoneWithLineBreak());
+ if (isVerbose())
+ {
+ notifyListeners(getTaskSeparator());
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
+ }
+ sc.startServer(!isVerbose());
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDoneWithLineBreak());
+ }
+ else
+ {
+ notifyListeners(getLineBreak());
+ }
} catch (ApplicationException ae) {
notifyListeners(getFormattedErrorWithLineBreak());
}
@@ -560,8 +620,13 @@
private void setCurrentProgressStep(ReversionProgressStep step) {
this.currentProgressStep = step;
int progress = step.getProgress();
- Message msg = getSummary(step);
- notifyListeners(progress, msg, formatter.getFormattedProgress(msg));
+ Message summary = getSummary(step);
+ Message log = getLogMsg(step);
+ if (step.logRequiresPoints(isVerbose()) && (log != null))
+ {
+ log = getFormattedWithPoints(log);
+ }
+ notifyListeners(progress, log, log);
}
private void initialize() throws ApplicationException {
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
index a3f7e07..f067e9b 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
@@ -108,6 +108,7 @@
private StringArgument file;
private BooleanArgument quiet;
private BooleanArgument noPrompt;
+ private BooleanArgument verbose;
private BooleanArgument revertMostRecent;
private StringArgument reversionArchive;
@@ -194,6 +195,14 @@
}
/**
+ * Indicates whether or not this operation is verbose.
+ * @return boolean where true indicates verbose
+ */
+ public boolean isVerbose() {
+ return verbose.isPresent();
+ }
+
+ /**
* Indicates whether or not this operation is interactive.
* @return boolean where true indicates noninteractive
*/
@@ -332,6 +341,10 @@
INFO_UPGRADE_DESCRIPTION_SILENT.get());
argParser.addArgument(quiet);
+ verbose = new BooleanArgument(OPTION_LONG_VERBOSE, OPTION_SHORT_VERBOSE,
+ OPTION_LONG_VERBOSE, INFO_DESCRIPTION_VERBOSE.get());
+ argParser.addArgument(verbose);
+
showUsage = new BooleanArgument(
"showusage",
OPTION_SHORT_HELP,
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java
index 7dc4c16..b72e85d 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeProgressStep.java
@@ -37,79 +37,174 @@
*/
enum UpgradeProgressStep implements ProgressStep {
- NOT_STARTED(INFO_SUMMARY_UPGRADE_NOT_STARTED.get(), 0),
+ NOT_STARTED(INFO_SUMMARY_UPGRADE_NOT_STARTED.get(), null, null, 0, false),
- DOWNLOADING(INFO_SUMMARY_UPGRADE_DOWNLOADING.get(), 10),
+ DOWNLOADING(INFO_SUMMARY_UPGRADE_DOWNLOADING.get(),
+ INFO_PROGRESS_UPGRADE_DOWNLOADING.get(),
+ INFO_PROGRESS_UPGRADE_DOWNLOADING.get(),
+ 0, true),
- EXTRACTING(INFO_SUMMARY_UPGRADE_EXTRACTING.get(), 20),
+ EXTRACTING(INFO_SUMMARY_UPGRADE_EXTRACTING.get(),
+ INFO_PROGRESS_UPGRADE_EXTRACTING.get(),
+ INFO_PROGRESS_UPGRADE_EXTRACTING_VERBOSE.get(),
+ 15, true),
- INITIALIZING(INFO_SUMMARY_UPGRADE_INITIALIZING.get(), 30),
+ INITIALIZING(INFO_SUMMARY_UPGRADE_INITIALIZING.get(),
+ INFO_PROGRESS_UPGRADE_INITIALIZING.get(),
+ INFO_PROGRESS_UPGRADE_INITIALIZING.get(), 20, true),
- CHECK_SERVER_HEALTH(INFO_SUMMARY_UPGRADE_CHECK_SERVER_HEALTH.get(), 35),
CALCULATING_SCHEMA_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION.get(), 40),
+ INFO_SUMMARY_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_CALCULATING_SCHEMA_CUSTOMIZATION.get(),
+ 25, true),
CALCULATING_CONFIGURATION_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION.get(), 48),
+ INFO_SUMMARY_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_CALCULATING_CONFIG_CUSTOMIZATION.get(),
+ 30, true),
- BACKING_UP_DATABASES(INFO_SUMMARY_UPGRADE_BACKING_UP_DB.get(), 50),
+ BACKING_UP_DATABASES(INFO_SUMMARY_UPGRADE_BACKING_UP_DB.get(),
+ INFO_PROGRESS_UPGRADE_BACKING_UP_DB.get(),
+ INFO_PROGRESS_UPGRADE_BACKING_UP_DB.get(), 35, true),
- BACKING_UP_FILESYSTEM(INFO_SUMMARY_UPGRADE_BACKING_UP_FILES.get(), 52),
+ BACKING_UP_FILESYSTEM(INFO_SUMMARY_UPGRADE_BACKING_UP_FILES.get(),
+ INFO_PROGRESS_UPGRADE_BACKING_UP_FILES.get(),
+ INFO_PROGRESS_UPGRADE_BACKING_UP_FILES.get(), 40, true),
- UPGRADING_COMPONENTS(INFO_SUMMARY_UPGRADE_UPGRADING_COMPONENTS.get(), 60),
+ UPGRADING_COMPONENTS(INFO_SUMMARY_UPGRADE_UPGRADING_COMPONENTS.get(),
+ INFO_PROGRESS_UPGRADE_UPGRADING_COMPONENTS.get(),
+ INFO_PROGRESS_UPGRADE_UPGRADING_COMPONENTS.get(), 45, true),
PREPARING_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_PREPARING_CUSTOMIZATIONS.get(), 65),
+ INFO_SUMMARY_UPGRADE_PREPARING_CUSTOMIZATIONS.get(),
+ INFO_PROGRESS_UPGRADE_PREPARING_CUSTOMIZATIONS.get(),
+ INFO_PROGRESS_UPGRADE_PREPARING_CUSTOMIZATIONS.get(),
+ 50, true),
APPLYING_SCHEMA_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION.get(), 70),
+ INFO_SUMMARY_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_APPLYING_SCHEMA_CUSTOMIZATION.get(),
+ 55, true),
APPLYING_CONFIGURATION_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION.get(), 75),
+ INFO_SUMMARY_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION.get(),
+ INFO_SUMMARY_UPGRADE_APPLYING_CONFIG_CUSTOMIZATION.get(),
+ 60, true),
APPLYING_ADS_CUSTOMIZATIONS(
- INFO_SUMMARY_UPGRADE_APPLYING_ADS_CUSTOMIZATION.get(), 78),
+ INFO_SUMMARY_UPGRADE_APPLYING_ADS_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_APPLYING_ADS_CUSTOMIZATION.get(),
+ INFO_PROGRESS_UPGRADE_APPLYING_ADS_CUSTOMIZATION.get(), 65, true),
- VERIFYING(INFO_SUMMARY_UPGRADE_VERIFYING.get(), 80),
+ VERIFYING(INFO_SUMMARY_UPGRADE_VERIFYING.get(),
+ INFO_PROGRESS_UPGRADE_VERIFYING.get(),
+ INFO_PROGRESS_UPGRADE_VERIFYING.get(), 70, true),
- STARTING_SERVER(INFO_SUMMARY_STARTING.get(), 90),
+ STARTING_SERVER(INFO_SUMMARY_STARTING.get(), null, null, 75, false),
- STOPPING_SERVER(INFO_SUMMARY_STOPPING.get(), 90),
+ STOPPING_SERVER(INFO_SUMMARY_STOPPING.get(), null, null, 75, false),
- RECORDING_HISTORY(INFO_SUMMARY_UPGRADE_HISTORY.get(), 97),
+ RECORDING_HISTORY(INFO_SUMMARY_UPGRADE_HISTORY.get(),
+ INFO_PROGRESS_UPGRADE_HISTORY.get(),
+ INFO_PROGRESS_UPGRADE_HISTORY.get(), 90, true),
- CLEANUP(INFO_SUMMARY_UPGRADE_CLEANUP.get(), 99),
+ CLEANUP(INFO_SUMMARY_UPGRADE_CLEANUP.get(),
+ INFO_PROGRESS_UPGRADE_CLEANUP.get(),
+ INFO_PROGRESS_UPGRADE_CLEANUP.get(), 90, true),
- ABORT(INFO_SUMMARY_UPGRADE_ABORT.get(), 99),
+ ABORT(INFO_SUMMARY_UPGRADE_ABORT.get(),
+ INFO_PROGRESS_UPGRADE_ABORT.get(),
+ INFO_PROGRESS_UPGRADE_ABORT.get(), 90, true),
- FINISHED_WITH_ERRORS(INFO_SUMMARY_UPGRADE_FINISHED_WITH_ERRORS.get(), 100),
+ FINISHED_WITH_ERRORS(INFO_SUMMARY_UPGRADE_FINISHED_WITH_ERRORS.get(),
+ null, null, 100, false),
FINISHED_WITH_WARNINGS(
- INFO_SUMMARY_UPGRADE_FINISHED_WITH_WARNINGS.get(), 100),
+ INFO_SUMMARY_UPGRADE_FINISHED_WITH_WARNINGS.get(), null, null, 100,
+ false),
- FINISHED_CANCELED(INFO_SUMMARY_UPGRADE_FINISHED_CANCELED.get(), 100),
+ FINISHED_CANCELED(INFO_SUMMARY_UPGRADE_FINISHED_CANCELED.get(),
+ null, null, 100, false),
- FINISHED(INFO_SUMMARY_UPGRADE_FINISHED_SUCCESSFULLY.get("",""), 100);
+ FINISHED(INFO_SUMMARY_UPGRADE_FINISHED_SUCCESSFULLY.get("",""),
+ null, null, 100, false);
private Message summaryMsg;
+ private Message logMsg;
+ private Message logMsgVerbose;
private int progress;
+ private boolean logWithPoints;
- private UpgradeProgressStep(Message summaryMsg, int progress) {
+ private UpgradeProgressStep(Message summaryMsg, Message logMsg,
+ Message logMsgVerbose, int progress, boolean logWithPoints) {
this.summaryMsg = summaryMsg;
+ this.logMsg = logMsg;
+ this.logMsgVerbose = logMsgVerbose;
this.progress = progress;
+ this.logWithPoints = logWithPoints;
}
/**
- * Return a key for access a summary message.
+ * Return the summary message for the step.
*
- * @return String representing key for access summary in resource bundle
+ * @return the summary message for the step.
*/
- public Message getSummaryMesssage() {
+ public Message getSummaryMessage() {
return summaryMsg;
}
/**
+ * Return the log message for the step.
+ * @param isVerbose whether we are running in verbose mode or not.
+ *
+ * @return the log message for the step.
+ */
+ public Message getLogMsg(boolean isVerbose) {
+ Message msg;
+ if (isVerbose)
+ {
+ msg = logMsgVerbose;
+ }
+ else
+ {
+ msg = logMsg;
+ }
+ return msg;
+ }
+
+ /**
+ * Return whether we must add points to the log message or not.
+ * @param isVerbose whether we are running in verbose mode or not.
+ *
+ * @return <CODE>true</CODE> if we must add points to the log message and
+ * <CODE>false</CODE> otherwise.
+ */
+ public boolean logRequiresPoints(boolean isVerbose) {
+ boolean returnValue;
+ if (logWithPoints)
+ {
+ if (isVerbose)
+ {
+ returnValue = logMsgVerbose == logMsg;
+ }
+ else
+ {
+ returnValue = true;
+ }
+ }
+ else
+ {
+ returnValue = false;
+ }
+ return returnValue;
+ }
+
+ /**
* Gets the amount of progress to show in the progress meter for this step.
* @return int representing progress
*/
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index aea07e9..26ec629 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -359,7 +359,7 @@
txt = getFinalWarningMessage();
}
else {
- txt = (((UpgradeProgressStep) step).getSummaryMesssage());
+ txt = (((UpgradeProgressStep) step).getSummaryMessage());
}
return txt;
}
@@ -379,6 +379,29 @@
}
/**
+ * Returns the progress message for a given progress step.
+ * @param step the progress step.
+ * @return the progress message for the provided step.
+ */
+ private Message getLogMsg(UpgradeProgressStep step) {
+ Message txt;
+ if (step == UpgradeProgressStep.FINISHED) {
+ txt = getFinalSuccessMessage();
+ } else if (step == UpgradeProgressStep.FINISHED_CANCELED) {
+ txt = getFinalCanceledMessage();
+ } else if (step == UpgradeProgressStep.FINISHED_WITH_ERRORS) {
+ txt = getFinalErrorMessage();
+ } else if (step == UpgradeProgressStep.FINISHED_WITH_WARNINGS) {
+ txt = getFinalWarningMessage();
+ }
+ else
+ {
+ txt = step.getLogMsg(isVerbose());
+ }
+ return txt;
+ }
+
+ /**
* {@inheritDoc}
*/
public ButtonName getInitialFocusButtonName() {
@@ -640,33 +663,47 @@
if (Utils.isWebStart()) {
ZipExtractor extractor;
+ setCurrentProgressStep(UpgradeProgressStep.DOWNLOADING);
try {
LOG.log(Level.INFO, "Waiting for Java Web Start jar download");
- waitForLoader(15);
+ waitForLoader(UpgradeProgressStep.EXTRACTING.getProgress());
LOG.log(Level.INFO, "Downloaded build file");
String zipName = WebStartDownloader.getZipFileName();
InputStream in =
Upgrader.class.getClassLoader().getResourceAsStream(zipName);
- extractor = new ZipExtractor(in, zipName);
+ extractor = new ZipExtractor(in,
+ UpgradeProgressStep.EXTRACTING.getProgress(),
+ UpgradeProgressStep.INITIALIZING.getProgress(),
+ Utils.getNumberZipEntries(), zipName, this);
} catch (ApplicationException e) {
LOG.log(Level.SEVERE, "Error downloading Web Start jars", e);
throw e;
}
+ notifyListeners(getFormattedDoneWithLineBreak());
checkAbort();
try {
setCurrentProgressStep(UpgradeProgressStep.EXTRACTING);
+ if (isVerbose())
+ {
+ notifyListeners(getLineBreak());
+ }
extractor.extract(getStageDirectory());
- notifyListeners(getFormattedDoneWithLineBreak());
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDoneWithLineBreak());
+ }
+ else
+ {
+ notifyListeners(getLineBreak());
+ }
LOG.log(Level.INFO, "extraction finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO, "Error extracting build file", e);
throw e;
}
-
}
checkAbort();
@@ -678,7 +715,6 @@
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "initialization finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO, "Error initializing upgrader", e);
throw e;
}
@@ -697,7 +733,6 @@
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "check for schema customizations finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO, "Error calculating schema customizations", e);
throw e;
}
@@ -712,7 +747,6 @@
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "check for config customizations finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO,
"Error calculating config customizations", e);
throw e;
@@ -728,7 +762,6 @@
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "database backup finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO, "Error backing up databases", e);
throw e;
}
@@ -739,11 +772,10 @@
try {
LOG.log(Level.INFO, "backing up filesystem");
setCurrentProgressStep(UpgradeProgressStep.BACKING_UP_FILESYSTEM);
- backupFilesytem();
+ backupFilesystem();
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "filesystem backup finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO, "Error backing up files", e);
throw e;
}
@@ -759,7 +791,6 @@
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "component upgrade finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO,
"Error upgrading components", e);
throw e;
@@ -788,7 +819,6 @@
LOG.log(Level.INFO, "start server finished");
notifyListeners(getFormattedDoneWithLineBreak());
} catch (Exception e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO,
"Error starting server in order to apply custom" +
"schema and/or configuration", e);
@@ -808,7 +838,6 @@
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "custom schema application finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO,
"Error applying schema customizations", e);
throw e;
@@ -826,7 +855,6 @@
notifyListeners(getFormattedDoneWithLineBreak());
LOG.log(Level.INFO, "custom config application finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO,
"Error applying configuration customizations", e);
throw e;
@@ -839,11 +867,19 @@
{
try {
LOG.log(Level.INFO, "Applying registration changes");
+ if (isVerbose())
+ {
+ setCurrentProgressStep(
+ UpgradeProgressStep.APPLYING_ADS_CUSTOMIZATIONS);
+ }
migration.migrateADS(
getStagedInstallation().getADSBackendFile());
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedDone());
+ }
LOG.log(Level.INFO, "custom registration application finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO,
"Error applying registration customizations", e);
throw e;
@@ -860,7 +896,6 @@
getStagedInstallation().getToolsPropertiesFile());
LOG.log(Level.INFO, "tools properties application finished");
} catch (ApplicationException e) {
- notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO,
"Error applying tools properties changes", e);
throw e;
@@ -872,9 +907,17 @@
try {
LOG.log(Level.INFO, "stopping server");
// This class imports classes from the server
+ if (isVerbose())
+ {
+ notifyListeners(INFO_PROGRESS_UPGRADE_INTERNAL_STOP.get());
+ }
new InProcessServerController(
getInstallation()).stopServer();
InProcessServerController.disableConnectionHandlers(false);
+ if (isVerbose())
+ {
+ notifyListeners(getFormattedDone());
+ }
LOG.log(Level.INFO, "server stopped");
} catch (Throwable t) {
LOG.log(Level.INFO, "Error stopping server", t);
@@ -906,7 +949,6 @@
errors = healthChecker.getProblemMessages();
} catch (Exception e) {
LOG.log(Level.INFO, "error performing server health check", e);
- notifyListeners(getFormattedErrorWithLineBreak());
throw e;
}
@@ -978,6 +1020,15 @@
try {
LOG.log(Level.INFO, "starting server");
setCurrentProgressStep(UpgradeProgressStep.STARTING_SERVER);
+ if (isVerbose())
+ {
+ notifyListeners(getTaskSeparator());
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
+ }
int port = getInstallation().getCurrentConfiguration().getPort();
if (port != -1 && !Utils.canUseAsPort(port)) {
throw new ApplicationException(
@@ -985,9 +1036,20 @@
INFO_ERROR_PORT_IN_USE.get(Integer.toString(port)),
null);
}
- control.startServer(true);
- notifyListeners(getFormattedDoneWithLineBreak());
+ control.startServer(!isVerbose());
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDoneWithLineBreak());
+ }
+ else
+ {
+ notifyListeners(getLineBreak());
+ }
} catch (ApplicationException e) {
+ if (isVerbose())
+ {
+ notifyListeners(getLineBreak());
+ }
notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO, "error starting server");
this.runWarning = e;
@@ -995,10 +1057,30 @@
} else if (!userRequestsStart && serverRunning) {
try {
LOG.log(Level.INFO, "stopping server");
+ if (isVerbose())
+ {
+ notifyListeners(getTaskSeparator());
+ }
+ else
+ {
+ notifyListeners(getFormattedWithPoints(
+ INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
+ }
setCurrentProgressStep(UpgradeProgressStep.STOPPING_SERVER);
- control.stopServer(true);
- notifyListeners(getFormattedDoneWithLineBreak());
+ control.stopServer(!isVerbose());
+ if (!isVerbose())
+ {
+ notifyListeners(getFormattedDoneWithLineBreak());
+ }
+ else
+ {
+ notifyListeners(getLineBreak());
+ }
} catch (ApplicationException e) {
+ if (isVerbose())
+ {
+ notifyListeners(getLineBreak());
+ }
notifyListeners(getFormattedErrorWithLineBreak());
LOG.log(Level.INFO, "error stopping server");
this.runWarning = e;
@@ -1039,6 +1121,28 @@
note = runError.getLocalizedMessage();
}
+ if (runError != null)
+ {
+ notifyListeners(getFormattedErrorWithLineBreak());
+ Message msg;
+
+ if (runError.getCause() != null)
+ {
+ msg = getFormattedError(
+ Utils.getThrowableMsg(runError.getMessageObject(),
+ runError.getCause()), true);
+ }
+ else
+ {
+ msg = getFormattedError(runError, true);
+ }
+ notifyListeners(msg);
+ if (Utils.isCli())
+ {
+ notifyListeners(getLineBreak());
+ notifyListeners(getLineBreak());
+ }
+ }
// Abort the upgrade and put things back like we found it
LOG.log(Level.INFO, "canceling upgrade");
ProgressStep lastProgressStep = getCurrentProgressStep();
@@ -1084,10 +1188,25 @@
} catch (ApplicationException e) {
notifyListeners(getFormattedErrorWithLineBreak());
+ Message msg;
+ if (e.getCause() != null)
+ {
+ msg = getFormattedError(
+ Utils.getThrowableMsg(e.getMessageObject(), e.getCause()), true);
+ }
+ else
+ {
+ msg = getFormattedError(e, true);
+ }
+ notifyListeners(msg);
+ if (Utils.isCli())
+ {
+ notifyListeners(getLineBreak());
+ }
LOG.log(Level.INFO, "Error cleaning up after upgrade.", e);
}
- // Decide final status based on presense of error
+ // Decide final status based on presence of error
// WARNING: change this code at your own risk! The ordering
// of these statements is important. There are differences
@@ -1104,16 +1223,14 @@
notifyListeners(null);
} else {
setCurrentProgressStep(UpgradeProgressStep.FINISHED_CANCELED);
+ notifyListeners(getLineBreak());
}
} else if (runError != null) {
LOG.log(Level.INFO, "upgrade completed with errors", runError);
if (!Utils.isCli()) {
notifyListenersOfLog();
this.currentProgressStep = UpgradeProgressStep.FINISHED_WITH_ERRORS;
- notifyListeners(formatter.getFormattedError(runError, true));
} else {
- notifyListeners(getFormattedErrorWithLineBreak(runError, true));
- notifyListeners(getLineBreak());
setCurrentProgressStep(UpgradeProgressStep.FINISHED_WITH_ERRORS);
notifyListeners(getLineBreak());
}
@@ -1143,10 +1260,10 @@
notifyListeners(null);
} else {
setCurrentProgressStep(UpgradeProgressStep.FINISHED);
+ notifyListeners(getLineBreak());
}
}
}
-
}
/**
@@ -1280,7 +1397,7 @@
fm.synchronize(oldConfigDir, newConfigDir, filter);
}
- private void backupFilesytem() throws ApplicationException {
+ private void backupFilesystem() throws ApplicationException {
try {
File filesBackupDirectory = getFilesBackupDirectory();
FileManager fm = new FileManager();
@@ -1413,7 +1530,7 @@
userInteraction(), currentVersion, newVersion);
uo.notifyUser();
if (uo.noServerStartFollowingOperation()) {
- // Some issue dicatates that we don't try and restart the server
+ // Some issue dictates that we don't try and restart the server
// after this operation. It may be that the databases are no
// longer readable after the upgrade or something equally earth
// shattering.
@@ -1476,7 +1593,12 @@
this.currentProgressStep = step;
int progress = step.getProgress();
Message msg = getSummary(step);
- notifyListeners(progress, msg, getFormattedProgress(msg));
+ Message log = getLogMsg(step);
+ if (step.logRequiresPoints(isVerbose()) && (log != null))
+ {
+ log = getFormattedWithPoints(log);
+ }
+ notifyListeners(progress, msg, log);
}
private Message getFinalSuccessMessage() {
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
index f5fdb76..04d6144 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgraderCliHelper.java
@@ -69,6 +69,7 @@
UpgradeUserData uud = new UpgradeUserData();
uud.setQuiet(launcher.isQuiet());
uud.setInteractive(!launcher.isNoPrompt());
+ uud.setVerbose(launcher.isVerbose());
return uud;
}
@@ -122,6 +123,6 @@
* {@inheritDoc}
*/
public boolean isVerbose() {
- return true;
+ return launcher.isVerbose();
}
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
index 09f0357..36a4263 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -582,7 +582,7 @@
LOG.log(Level.INFO, "Ignoring file '" +
objectFile.getAbsolutePath() + "' since '" +
destination.getAbsolutePath() + "' already exists");
- if (application != null) {
+ if ((application != null) && application.isVerbose()) {
application.notifyListeners(
new MessageBuilder(
INFO_INFO_IGNORING_FILE.get(
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java
index 648e937..56d722f 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java
@@ -257,6 +257,25 @@
}
/**
+ * Returns the formatted representation of a point.
+ * @return the formatted representation of the '.' text string.
+ */
+ public Message getFormattedPoint()
+ {
+ return Message.raw(UIFactory.applyFontToHtml(".",
+ UIFactory.PROGRESS_POINTS_FONT));
+ }
+
+ /**
+ * Returns the formatted representation of a space.
+ * @return the formatted representation of the ' ' text string.
+ */
+ public Message getSpace()
+ {
+ return Message.raw(SPACE);
+ }
+
+ /**
* Returns the formatted representation of a progress message for a given
* text.
* @param text the source text from which we want to get the formatted
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java
index be30417..d9a796a 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java
@@ -196,6 +196,24 @@
}
/**
+ * Returns the formatted representation of a point.
+ * @return the formatted representation of the '.' text string.
+ */
+ public Message getFormattedPoint()
+ {
+ return Message.raw(".");
+ }
+
+ /**
+ * Returns the formatted representation of a space.
+ * @return the formatted representation of the ' ' text string.
+ */
+ public Message getSpace()
+ {
+ return Message.raw(SPACE);
+ }
+
+ /**
* Returns the formatted representation of a progress message for a given
* text.
* @param text the source text from which we want to get the formatted
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ProgressMessageFormatter.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ProgressMessageFormatter.java
index 7c150eb..9c69068 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ProgressMessageFormatter.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ProgressMessageFormatter.java
@@ -128,6 +128,19 @@
*/
public Message getFormattedWithPoints(Message text);
+
+ /**
+ * Returns the formatted representation of a point.
+ * @return the formatted representation of the '.' text string.
+ */
+ public Message getFormattedPoint();
+
+ /**
+ * Returns the formatted representation of a space.
+ * @return the formatted representation of the ' ' text string.
+ */
+ public Message getSpace();
+
/**
* Returns the formatted representation of a progress message for a given
* text.
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index e3e1edc..3c28426 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -235,7 +235,7 @@
}
if (suppressOutput && (application != null))
{
- application.setNotifyListeners(false);
+ application.setNotifyListeners(true);
}
}
}
--
Gitblit v1.10.0