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

jvergara
17.46.2007 195021d1fbfc8d6082ceabd26fcae56309941af5
Simplify the ProgressUpdateListenerDelegate interface.
4 files modified
52 ■■■■■ changed files
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java 13 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ProgressUpdateListenerDelegate.java 27 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java 10 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -265,7 +265,7 @@
   */
  public void setProgressMessageFormatter(ProgressMessageFormatter formatter) {
    this.formatter = formatter;
    this.listenerDelegate = new ProgressUpdateListenerDelegate(formatter);
    this.listenerDelegate = new ProgressUpdateListenerDelegate();
  }
  /**
@@ -597,6 +597,17 @@
  abstract public void cancel();
  /**
   * Checks whether the operation has been aborted.  If it has throws an
   * ApplicationException.  All the applications that support abort must
   * provide their implementation as the default implementation is empty.
   *
   * @throws ApplicationException thrown if the application was aborted.
   */
  public void checkAbort() throws ApplicationException
  {
  }
  /**
   * Makes available a <code>UserInteraction</code> class that can be used
   * by the application to interact with the user.  If the user has requested
   * a quiet session this method returns null.
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ProgressUpdateListenerDelegate.java
@@ -27,15 +27,10 @@
package org.opends.quicksetup;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import static org.opends.messages.QuickSetupMessages.*;
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.event.ProgressUpdateEvent;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import java.util.HashSet;
import java.io.File;
/**
 * Delegate class for handling progress notification listeners and events.
@@ -45,14 +40,10 @@
  private HashSet<ProgressUpdateListener> listeners =
          new HashSet<ProgressUpdateListener>();
  private ProgressMessageFormatter formatter;
  /**
   * Creates a parameterized instance.
   * @param formatter for formatting messages.
   */
  public ProgressUpdateListenerDelegate(ProgressMessageFormatter formatter) {
    this.formatter = formatter;
  public ProgressUpdateListenerDelegate() {
  }
  /**
@@ -97,22 +88,6 @@
  }
  /**
   * Conditionally notifies listeners of the log file if it
   * has been initialized.
   */
  public void notifyListenersOfLog() {
    File logFile = QuickSetupLog.getLogFile();
    if (logFile != null) {
      MessageBuilder mb = new MessageBuilder();
      mb.append(formatter.getFormattedProgress(
                  INFO_GENERAL_SEE_FOR_DETAILS.get(
                          logFile.getPath())));
      mb.append(formatter.getLineBreak());
      notifyListeners(mb.toMessage());
    }
  }
  /**
   * Notify listeners about a change in log detail.
   * @param msg log detail
   */
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
@@ -278,7 +278,7 @@
   */
  public void setProgressMessageFormatter(ProgressMessageFormatter formatter) {
    this.formatter = formatter;
    this.listenerDelegate = new ProgressUpdateListenerDelegate(formatter);
    this.listenerDelegate = new ProgressUpdateListenerDelegate();
  }
  /**
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -1107,7 +1107,15 @@
  }
  private void checkAbort() throws ApplicationException {
  /**
   * Checks the value of <code>aborted</code> field and throws an
   * ApplicationException if true.  This indicates that the user has
   * aborted this operation and the process of aborting should begin
   * as soon as possible.
   *
   * @throws ApplicationException thrown if <code>aborted</code>
   */
  public void checkAbort() throws ApplicationException {
    if (abort) throw new ApplicationException(
        ReturnCode.CANCELLED,
            INFO_UPGRADE_CANCELED.get(), null);