From 295f7dc1ac02bee5cb01095a624e53bb22414746 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 30 Jul 2007 05:22:32 +0000
Subject: [PATCH] Add two new configuration attributes, ds-cfg-enabled-alert-type and ds-cfg-disabled-alert-type to alert handler configuration entries.  If a set of enabled alert types is given, then only alerts with one of those types will be passed to the associated alert handler.  If a set of disabled alert types is given, then only alerts without one of those types will be passed to the associated alert handler.  If both enabled and disabled lists are provided, then only alerts with a type on the enabled list and not on the disabled list will be processed.

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

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index de50e2b..78ffd8b 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -52,6 +52,7 @@
 
 import org.opends.server.admin.ClassLoaderProvider;
 import org.opends.server.admin.server.ServerManagementContext;
+import org.opends.server.admin.std.server.AlertHandlerCfg;
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.admin.std.server.ConnectionHandlerCfg;
 import org.opends.server.admin.std.server.DirectoryStringAttributeSyntaxCfg;
@@ -4551,6 +4552,31 @@
     {
       for (AlertHandler alertHandler : directoryServer.alertHandlers)
       {
+        AlertHandlerCfg config = alertHandler.getAlertHandlerConfiguration();
+        Set<String> enabledAlerts = config.getEnabledAlertType();
+        Set<String> disabledAlerts = config.getDisabledAlertType();
+        if ((enabledAlerts == null) || enabledAlerts.isEmpty())
+        {
+          if ((disabledAlerts != null) && disabledAlerts.contains(alertType))
+          {
+            continue;
+          }
+        }
+        else
+        {
+          if (enabledAlerts.contains(alertType))
+          {
+            if ((disabledAlerts != null) && disabledAlerts.contains(alertType))
+            {
+              continue;
+            }
+          }
+          else
+          {
+            continue;
+          }
+        }
+
         alertHandler.sendAlertNotification(generator, alertType, alertID,
                                            alertMessage);
       }

--
Gitblit v1.10.0