From fd56366c63cf39c8a569b2efde31d2efd26b9a7f Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 11 Jan 2013 17:03:44 +0000
Subject: [PATCH] Fix for OPENDJ-670. Add an objectclass for the statistics entries under cn=monitor. The schema for this objectclass is also added in 02-config.ldif.

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPStatistics.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPStatistics.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPStatistics.java
index 26a3009..b05145d 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPStatistics.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPStatistics.java
@@ -23,7 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2012 ForgeRock AS
+ *      Portions Copyright 2012-2013 ForgeRock AS
  *
  */
 package org.opends.server.protocols.ldap;
@@ -32,6 +32,7 @@
 
 import static org.opends.messages.ProtocolMessages.*;
 import static org.opends.server.protocols.ldap.LDAPConstants.*;
+import static org.opends.server.util.ServerConstants.*;
 
 import java.util.ArrayList;
 
@@ -41,12 +42,7 @@
 import org.opends.server.api.MonitorProvider;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.Attribute;
-import org.opends.server.types.AttributeBuilder;
-import org.opends.server.types.AttributeType;
-import org.opends.server.types.AttributeValues;
-import org.opends.server.types.OperationType;
-
+import org.opends.server.types.*;
 
 
 /**
@@ -181,6 +177,16 @@
   }
 
 
+  /**
+   *
+   * {@inheritDoc}
+   */
+  @Override
+  public ObjectClass getMonitorObjectClass()
+  {
+      return DirectoryConfig.getObjectClass(OC_MONITOR_CONNHANDLERSTATS, true);
+  }
+
 
   /**
    * Retrieves a set of attributes containing monitor data that should
@@ -251,12 +257,16 @@
 
 
     // Construct the list of attributes to return.
+    /* TODO : the attribute names should be constant (in ServerConstants.java
+     *        and associated with their objectclass
+     *        OC_MONITOR_CONNHANDLERSTATS
+     */
     attrs.add(createAttribute("connectionsEstablished", String
         .valueOf(tmpConnectionsEstablished)));
     attrs.add(createAttribute("connectionsClosed", String
         .valueOf(tmpConnectionsClosed)));
-    attrs
-        .add(createAttribute("bytesRead", String.valueOf(tmpBytesRead)));
+    attrs.add(createAttribute("bytesRead", String
+        .valueOf(tmpBytesRead)));
     attrs.add(createAttribute("bytesWritten", String
         .valueOf(tmpBytesWritten)));
     attrs.add(createAttribute("ldapMessagesRead", String
@@ -302,9 +312,9 @@
     attrs.add(createAttribute("searchRequests", String
         .valueOf(tmpSearchRequests)));
     attrs.add(createAttribute("searchOneRequests", String
-            .valueOf(tmpSearchOneRequests)));
+        .valueOf(tmpSearchOneRequests)));
     attrs.add(createAttribute("searchSubRequests", String
-            .valueOf(tmpSearchSubRequests)));
+        .valueOf(tmpSearchSubRequests)));
     attrs.add(createAttribute("searchResultEntries", String
         .valueOf(tmpSearchEntries)));
     attrs.add(createAttribute("searchResultReferences", String
@@ -391,7 +401,6 @@
   }
 
 
-
   /**
    * Clears any statistical information collected to this point.
    */

--
Gitblit v1.10.0