From 8f731063c3a73ae2585abd4f949611f153be9421 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 20 Jul 2007 20:04:30 +0000
Subject: [PATCH] Add a general framework for OpenDS to send e-mail messages, and add an SMTP alert handler that can be used to send e-mail messages in response to administrative alerts generated within the server.

---
 opends/src/server/org/opends/server/core/DirectoryServer.java |   37 ++++++++++++-------------------------
 1 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index d419e8a..10e3e66 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -361,9 +361,6 @@
   // The set of import task listeners registered with the Directory Server.
   private CopyOnWriteArrayList<ImportTaskListener> importTaskListeners;
 
-  // The sets of mail server properties
-  private CopyOnWriteArrayList<Properties> mailServerPropertySets;
-
   // The set of persistent searches registered with the Directory Server.
   private CopyOnWriteArrayList<PersistentSearch> persistentSearches;
 
@@ -443,6 +440,9 @@
   // The set of connections that are currently established.
   private LinkedHashSet<ClientConnection> establishedConnections;
 
+  // The sets of mail server properties
+  private List<Properties> mailServerPropertySets;
+
   // The set of schema changes made by editing the schema configuration files
   // with the server offline.
   private List<Modification> offlineSchemaChanges;
@@ -1071,11 +1071,6 @@
 
 
 
-      // Initialize information about the mail servers for use by the Directory
-      // Server.
-      initializeMailServerPropertySets();
-
-
       // Initialize the server alert handlers.
       initializeAlertHandlers();
 
@@ -2045,25 +2040,17 @@
 
 
   /**
-   * Initializes the set of properties to use to connect to mail servers for
-   * sending messages.
+   * Specifies the set of mail server properties that should be used for SMTP
+   * communication.
    *
-   * @throws  ConfigException  If there is a configuration problem with any of
-   *                           the mail server entries.
-   *
-   * @throws  InitializationException  If a problem occurs while initializing
-   *                                   the mail server property sets that is not
-   *                                   related to the server configuration.
+   * @param  mailServerPropertySets  A list of {@code Properties} objects that
+   *                                 provide information that can be used to
+   *                                 communicate with SMTP servers.
    */
-  public void initializeMailServerPropertySets()
-         throws ConfigException, InitializationException
+  public static void setMailServerPropertySets(List<Properties>
+                                                    mailServerPropertySets)
   {
-    mailServerPropertySets = new CopyOnWriteArrayList<Properties>();
-
-    // FIXME -- Actually read the information from the config handler.
-    Properties defaultProperties = new Properties();
-    defaultProperties.setProperty("mail.smtp.host", "127.0.0.1");
-    mailServerPropertySets.add(defaultProperties);
+    directoryServer.mailServerPropertySets = mailServerPropertySets;
   }
 
 
@@ -2075,7 +2062,7 @@
    * @return  The sets of information about the mail servers configured for use
    *          by the Directory Server.
    */
-  public static CopyOnWriteArrayList<Properties> getMailServerPropertySets()
+  public static List<Properties> getMailServerPropertySets()
   {
     return directoryServer.mailServerPropertySets;
   }

--
Gitblit v1.10.0