Fix for 1862 verbosity options for quicksetup tools
The fixes are just cosmetic. They consist basically of:
* Add verbosity options for the uninstall and upgrade utilities and make them behave as the verbosity options of the setup.
* Make the output of the upgrader consistent with the output of setup and uninstall.
* Update the non verbose output of the import LDIF and the import automatically generated data so that a point is displayed every 3 seconds during the import is ongoing. This way the user will not have the impression that the setup is blocked and we show that some work is going on.
| | |
| | | |
| | | boolean isInteractive; |
| | | boolean isQuiet; |
| | | boolean isVerbose; |
| | | boolean isCancelled = false; |
| | | |
| | | /* Step 1: analyze the arguments. |
| | |
| | | |
| | | 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); |
| | |
| | | |
| | | 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(); |
| | |
| | | Set<String> dbsToDelete = getUninstallUserData().getExternalDbsToRemove(); |
| | | if (dbsToDelete.size() > 0) { |
| | | status = UninstallProgressStep.DELETING_EXTERNAL_DATABASE_FILES; |
| | | if (displaySeparator) { |
| | | if (displaySeparator && isVerbose()) { |
| | | notifyListeners(getTaskSeparator()); |
| | | } |
| | | |
| | |
| | | if (logsToDelete.size() > 0) { |
| | | status = UninstallProgressStep.DELETING_EXTERNAL_LOG_FILES; |
| | | |
| | | if (displaySeparator) { |
| | | if (displaySeparator && isVerbose()) { |
| | | notifyListeners(getTaskSeparator()); |
| | | } |
| | | |
| | |
| | | userData.getRemoveLDIFs() || |
| | | userData.getRemoveLibrariesAndTools() || |
| | | userData.getRemoveLogs(); |
| | | if (displaySeparator && somethingToDelete) { |
| | | if (displaySeparator && somethingToDelete && isVerbose()) { |
| | | notifyListeners(getTaskSeparator()); |
| | | } |
| | | |
| | |
| | | */ |
| | | private void deleteExternalDatabaseFiles(Set<String> dbFiles) |
| | | throws ApplicationException { |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private void deleteExternalLogFiles(Set<String> logFiles) |
| | | throws ApplicationException { |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private void deleteInstallationFiles(int minRatio, int maxRatio) |
| | | throws ApplicationException { |
| | | 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(); |
| | |
| | | } |
| | | hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, maxRatio); |
| | | } |
| | | if (!isVerbose()) |
| | | { |
| | | notifyListeners(getFormattedDone()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | private void delete(File file) throws ApplicationException { |
| | | boolean isFile = file.isFile(); |
| | | |
| | | if (isVerbose()) |
| | | { |
| | | if (isFile) { |
| | | notifyListeners(getFormattedWithPoints( |
| | | INFO_PROGRESS_DELETING_FILE.get(file.getAbsolutePath()))); |
| | |
| | | notifyListeners(getFormattedWithPoints( |
| | | INFO_PROGRESS_DELETING_DIRECTORY.get(file.getAbsolutePath()))); |
| | | } |
| | | } |
| | | |
| | | boolean delete = false; |
| | | /* |
| | |
| | | errMsg, null); |
| | | } |
| | | |
| | | if (isVerbose()) |
| | | { |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | } |
| | | } |
| | | |
| | | private boolean equalsOrDescendant(File file, File directory) { |
| | | return file.equals(directory) || isDescendant(file, directory); |
| | |
| | | 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, |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | 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... |
| | |
| | | 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. |
| | |
| | | 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. |
| | |
| | | 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... |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | for (String arg : args) |
| | | { |
| | | if (arg.equalsIgnoreCase("-V") || arg.equalsIgnoreCase("--version")) |
| | | if (arg.equalsIgnoreCase("--version")) |
| | | { |
| | | printVersion = true; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | mb.append(getFormattedWithPoints( |
| | | mb.append(getFormattedProgress( |
| | | INFO_PROGRESS_IMPORTING_LDIFS_NON_VERBOSE.get( |
| | | getStringFromCollection(ldifPaths, ", ")))); |
| | | } |
| | |
| | | } |
| | | 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>(); |
| | |
| | | { |
| | | if (!isVerbose()) |
| | | { |
| | | pointAdder.stop(); |
| | | setNotifyListeners(true); |
| | | } |
| | | } |
| | |
| | | } |
| | | 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()); |
| | |
| | | if (!isVerbose()) |
| | | { |
| | | setNotifyListeners(true); |
| | | if (ae != null) |
| | | { |
| | | pointAdder.stop(); |
| | | } |
| | | } |
| | | } |
| | | isOver = true; |
| | |
| | | invokeLongOperation(thread); |
| | | if (!isVerbose()) |
| | | { |
| | | pointAdder.stop(); |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | } |
| | | } |
| | |
| | | boolean isSchema = areDnsEqual(dn, Constants.SCHEMA_DN); |
| | | if(isADS) |
| | | { |
| | | if (isVerbose()) |
| | | { |
| | | notifyListeners(getFormattedWithPoints( |
| | | INFO_PROGRESS_INITIALIZING_ADS.get())); |
| | | } |
| | | } |
| | | else if (isSchema) |
| | | { |
| | | if (isVerbose()) |
| | | { |
| | | notifyListeners(getFormattedWithPoints( |
| | | INFO_PROGRESS_INITIALIZING_SCHEMA.get())); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | notifyListeners(getFormattedProgress( |
| | |
| | | } |
| | | throw ae; |
| | | } |
| | | if (isADS || isSchema) |
| | | if ((isADS || isSchema) && isVerbose()) |
| | | { |
| | | notifyListeners(getFormattedDone()); |
| | | } |
| | |
| | | */ |
| | | 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() { |
| | |
| | | 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); |
| | |
| | | } |
| | | ud.setQuiet(rl.isQuiet()); |
| | | ud.setInteractive(!rl.isNoPrompt()); |
| | | ud.setVerbose(rl.isVerbose()); |
| | | } |
| | | return ud; |
| | | } |
| | |
| | | // 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; |
| | | } |
| | |
| | | try { |
| | | setCurrentProgressStep(ReversionProgressStep.STOPPING_SERVER); |
| | | LOG.log(Level.INFO, "Stopping server"); |
| | | sc.stopServer(true); |
| | | |
| | | 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()); |
| | | } |
| | |
| | | try { |
| | | LOG.log(Level.INFO, "Restarting server"); |
| | | setCurrentProgressStep(ReversionProgressStep.STARTING_SERVER); |
| | | sc.startServer(); |
| | | 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()); |
| | | } |
| | |
| | | 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 { |
| | |
| | | private StringArgument file; |
| | | private BooleanArgument quiet; |
| | | private BooleanArgument noPrompt; |
| | | private BooleanArgument verbose; |
| | | private BooleanArgument revertMostRecent; |
| | | private StringArgument reversionArchive; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | | */ |
| | |
| | | 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, |
| | |
| | | */ |
| | | 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 |
| | | */ |
| | |
| | | txt = getFinalWarningMessage(); |
| | | } |
| | | else { |
| | | txt = (((UpgradeProgressStep) step).getSummaryMesssage()); |
| | | txt = (((UpgradeProgressStep) 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(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() { |
| | |
| | | |
| | | 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()); |
| | | 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(); |
| | |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | LOG.log(Level.INFO, "initialization finished"); |
| | | } catch (ApplicationException e) { |
| | | notifyListeners(getFormattedErrorWithLineBreak()); |
| | | LOG.log(Level.INFO, "Error initializing upgrader", e); |
| | | throw e; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | LOG.log(Level.INFO, "component upgrade finished"); |
| | | } catch (ApplicationException e) { |
| | | notifyListeners(getFormattedErrorWithLineBreak()); |
| | | LOG.log(Level.INFO, |
| | | "Error upgrading components", e); |
| | | throw e; |
| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | { |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | errors = healthChecker.getProblemMessages(); |
| | | } catch (Exception e) { |
| | | LOG.log(Level.INFO, "error performing server health check", e); |
| | | notifyListeners(getFormattedErrorWithLineBreak()); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | 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( |
| | |
| | | INFO_ERROR_PORT_IN_USE.get(Integer.toString(port)), |
| | | null); |
| | | } |
| | | control.startServer(true); |
| | | 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; |
| | |
| | | } 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); |
| | | 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; |
| | |
| | | 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(); |
| | |
| | | |
| | | } 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 |
| | |
| | | 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()); |
| | | } |
| | |
| | | notifyListeners(null); |
| | | } else { |
| | | setCurrentProgressStep(UpgradeProgressStep.FINISHED); |
| | | notifyListeners(getLineBreak()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | fm.synchronize(oldConfigDir, newConfigDir, filter); |
| | | } |
| | | |
| | | private void backupFilesytem() throws ApplicationException { |
| | | private void backupFilesystem() throws ApplicationException { |
| | | try { |
| | | File filesBackupDirectory = getFilesBackupDirectory(); |
| | | FileManager fm = new FileManager(); |
| | |
| | | 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. |
| | |
| | | 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() { |
| | |
| | | UpgradeUserData uud = new UpgradeUserData(); |
| | | uud.setQuiet(launcher.isQuiet()); |
| | | uud.setInteractive(!launcher.isNoPrompt()); |
| | | uud.setVerbose(launcher.isVerbose()); |
| | | return uud; |
| | | } |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isVerbose() { |
| | | return true; |
| | | return launcher.isVerbose(); |
| | | } |
| | | } |
| | |
| | | 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( |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | */ |
| | | 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. |
| | |
| | | } |
| | | if (suppressOutput && (application != null)) |
| | | { |
| | | application.setNotifyListeners(false); |
| | | application.setNotifyListeners(true); |
| | | } |
| | | } |
| | | } |