From 41a366d344bb8baed06c82a06de1c9cf0f24ef70 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 17 Oct 2007 12:46:16 +0000
Subject: [PATCH] Simplify the ProgressUpdateListenerDelegate interface.

---
 opends/src/quicksetup/org/opends/quicksetup/ProgressUpdateListenerDelegate.java |   27 +--------------------------
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java              |    2 +-
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java              |   10 +++++++++-
 opends/src/quicksetup/org/opends/quicksetup/Application.java                    |   13 ++++++++++++-
 4 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/Application.java b/opends/src/quicksetup/org/opends/quicksetup/Application.java
index 4a38ae3..55af64a 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Application.java
+++ b/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.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ProgressUpdateListenerDelegate.java b/opends/src/quicksetup/org/opends/quicksetup/ProgressUpdateListenerDelegate.java
index 7ba459c..b627d27 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ProgressUpdateListenerDelegate.java
+++ b/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
    */
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
index 8fb4214..82d5a90 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
+++ b/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();
   }
 
   /**
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 0c39f3d..53f14a3 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/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);

--
Gitblit v1.10.0