From bb40b9a02cf40af0349d8e3576f51133d264d4b1 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 10 Oct 2006 15:23:18 +0000
Subject: [PATCH] Make all of the plugin result objects immutable, and create a default SUCCESS instance for each of them that may be used if all processing completed successfully.  Update all uses of the plugin result objects to use this SUCCESS instance where applicable.

---
 opends/src/server/org/opends/server/api/plugin/StartupPluginResult.java |   96 +++++++----------------------------------------
 1 files changed, 15 insertions(+), 81 deletions(-)

diff --git a/opends/src/server/org/opends/server/api/plugin/StartupPluginResult.java b/opends/src/server/org/opends/server/api/plugin/StartupPluginResult.java
index bdc76eb..c946362 100644
--- a/opends/src/server/org/opends/server/api/plugin/StartupPluginResult.java
+++ b/opends/src/server/org/opends/server/api/plugin/StartupPluginResult.java
@@ -47,20 +47,29 @@
 
 
 
+  /**
+   * A startup plugin result instance that indicates all processing
+   * was successful.
+   */
+  public static final StartupPluginResult SUCCESS =
+       new StartupPluginResult();
+
+
+
   // Indicates whether the startup plugin completed successfully.
-  private boolean completedSuccessfully;
+  private final boolean completedSuccessfully;
 
   // Indicates whether the server should continue with the startup
   // process.
-  private boolean continueStartup;
+  private final boolean continueStartup;
 
   // The unique identifier for any error message generated by the
   // startup plugin.
-  private int errorID;
+  private final int errorID;
 
   // A human-readable message that explains any error that might have
   // occurred.
-  private String errorMessage;
+  private final String errorMessage;
 
 
 
@@ -70,14 +79,9 @@
    * successfully, that the startup process should continue, and that
    * there is no error message.
    */
-  public StartupPluginResult()
+  private StartupPluginResult()
   {
-    assert debugConstructor(CLASS_NAME);
-
-    this.completedSuccessfully = true;
-    this.continueStartup       = true;
-    this.errorID               = 0;
-    this.errorMessage          = null;
+    this(true, true, 0, null);
   }
 
 
@@ -134,24 +138,6 @@
 
 
   /**
-   * Specifies whether the startup plugin completed its processing
-   * successfully.
-   *
-   * @param  completedSuccessfully  Specifies whether the startup
-   *                                plugin completed its processing
-   *                                successfully.
-   */
-  public void setCompletedSuccessfully(boolean completedSuccessfully)
-  {
-    assert debugEnter(CLASS_NAME, "setCompletedSuccessfully",
-                      String.valueOf(completedSuccessfully));
-
-    this.completedSuccessfully = completedSuccessfully;
-  }
-
-
-
-  /**
    * Indicates whether the Directory Server should continue with its
    * startup process.
    *
@@ -169,24 +155,6 @@
 
 
   /**
-   * Specifies whether the Directory Server should continue with its
-   * startup process.
-   *
-   * @param  continueStartup  Specifies whether the Directory Server
-   *                          should continue with its startup
-   *                          process.
-   */
-  public void setContinueStartup(boolean continueStartup)
-  {
-    assert debugEnter(CLASS_NAME, "setContinueStartup",
-                      String.valueOf(continueStartup));
-
-    this.continueStartup = continueStartup;
-  }
-
-
-
-  /**
    * Retrieves the unique ID for the error message generated by the
    * startup plugin.
    *
@@ -203,23 +171,6 @@
 
 
   /**
-   * Specifies the unique ID for the error message generated by the
-   * startup plugin.
-   *
-   * @param  errorID  The unique ID for the error message generated by
-   *                  the startup plugin.
-   */
-  public void setErrorID(int errorID)
-  {
-    assert debugEnter(CLASS_NAME, "setErrorID",
-                      String.valueOf(errorID));
-
-    this.errorID = errorID;
-  }
-
-
-
-  /**
    * Retrieves the human-readable error message generated by the
    * startup plugin.
    *
@@ -237,23 +188,6 @@
 
 
   /**
-   * Specifies the human-readable error message generated by the
-   * startup plugin.
-   *
-   * @param  errorMessage  The human-readable error message generated
-   *                       by the startup plugin.
-   */
-  public void setErrorMessage(String errorMessage)
-  {
-    assert debugEnter(CLASS_NAME, "setErrorMessage",
-                      String.valueOf(errorMessage));
-
-    this.errorMessage = errorMessage;
-  }
-
-
-
-  /**
    * Retrieves a string representation of this startup plugin result.
    *
    * @return  A string representation of this startup plugin result.

--
Gitblit v1.10.0