From 78d0902c64346883885504cfc43ec335951429c2 Mon Sep 17 00:00:00 2001
From: floblanc <floblanc@localhost>
Date: Thu, 06 Nov 2008 09:26:29 +0000
Subject: [PATCH] Implement statistics for the network group. The stats are available under cn=monitor.

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

diff --git a/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java b/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
index 30ad1c6..9e1ab1a 100644
--- a/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
+++ b/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
@@ -36,6 +36,7 @@
 
 import org.opends.server.api.ClientConnection;
 import org.opends.server.core.*;
+import org.opends.server.protocols.ldap.LDAPMessage;
 import org.opends.server.types.AuthenticationType;
 import org.opends.server.types.DN;
 import org.opends.server.types.DirectoryException;
@@ -133,6 +134,9 @@
   // The network group request filtering policy
   private RequestFilteringPolicy requestFilteringPolicy = null;
 
+  // The statistics
+  private NetworkGroupStatistics stats;
+
   /**
    * Creates a new instance of the network group.
    *
@@ -147,6 +151,9 @@
     isInternalNetworkGroup = INTERNAL_NETWORK_GROUP_NAME.equals(networkGroupID);
     isAdminNetworkGroup    = ADMIN_NETWORK_GROUP_NAME.equals(networkGroupID);
     isDefaultNetworkGroup  = DEFAULT_NETWORK_GROUP_NAME.equals(networkGroupID);
+
+    stats = new NetworkGroupStatistics(this,
+        networkGroupID + " Network Group Statistics");
   }
 
 
@@ -1108,4 +1115,36 @@
       namingContexts = new NetworkGroupNamingContexts();
     }
   }
+
+  /**
+   * Retrieves the statistics associated to the request filtering policy.
+   *
+   * @return the statistics associated to the request filtering policy
+   */
+  public RequestFilteringPolicyStat getRequestFilteringPolicyStat() {
+    if (requestFilteringPolicy != null) {
+      return requestFilteringPolicy.getStat();
+    }
+    return null;
+  }
+
+  /**
+   * Retrieves the statistics associated to the resource limits.
+   *
+   * @return the statistics associated to the resource limits
+   */
+  public ResourceLimitsStat getResourceLimitStat() {
+    if (resourceLimits != null) {
+      return resourceLimits.getStat();
+    }
+    return null;
+  }
+
+  /**
+   * Updates the operations statistics.
+   * @param message The LDAP message being processed
+   */
+  public void updateMessageRead(LDAPMessage message) {
+    stats.updateMessageRead(message);
+  }
 }

--
Gitblit v1.10.0