From 06e8f819bcda0d7162d662af94c6ade794e1cfe6 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 08 Dec 2006 23:54:57 +0000
Subject: [PATCH] Update the backend API to provide a method for getting the number of entries contained in that backend.  Also, create a new monitor entry for each registered backend that will report the backend ID, base DNs, writability mode, and entry count for that backend.

---
 opends/src/server/org/opends/server/api/Backend.java |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/api/Backend.java b/opends/src/server/org/opends/server/api/Backend.java
index eba5623..033fd81 100644
--- a/opends/src/server/org/opends/server/api/Backend.java
+++ b/opends/src/server/org/opends/server/api/Backend.java
@@ -42,6 +42,7 @@
 import org.opends.server.core.ModifyOperation;
 import org.opends.server.core.ModifyDNOperation;
 import org.opends.server.core.SearchOperation;
+import org.opends.server.monitors.BackendMonitor;
 import org.opends.server.types.BackupConfig;
 import org.opends.server.types.BackupDirectory;
 import org.opends.server.types.CancelledOperationException;
@@ -83,6 +84,9 @@
   // hierarchically below the information in this backend.
   private Backend[] subordinateBackends;
 
+  // The backend monitor associated with this backend.
+  private BackendMonitor backendMonitor;
+
   // Indicates whether this is a private backend or one that holds
   // user data.
   private boolean isPrivateBackend;
@@ -109,6 +113,7 @@
     subordinateBackends = new Backend[0];
     isPrivateBackend    = false;
     writabilityMode     = WritabilityMode.ENABLED;
+    backendMonitor      = null;
   }
 
 
@@ -716,6 +721,48 @@
 
 
   /**
+   * Retrieves the backend monitor that is associated with this
+   * backend.
+   *
+   * @return  The backend monitor that is associated with this
+   *          backend, or {@code null} if none has been assigned.
+   */
+  public BackendMonitor getBackendMonitor()
+  {
+    assert debugEnter(CLASS_NAME, "getBackendMonitor");
+
+    return backendMonitor;
+  }
+
+
+
+  /**
+   * Sets the backend monitor for this backend.
+   *
+   * @param  backendMonitor  The backend monitor for this backend.
+   */
+  public void setBackendMonitor(BackendMonitor backendMonitor)
+  {
+    assert debugEnter(CLASS_NAME, "setBackendMonitor",
+                      String.valueOf(backendMonitor));
+
+    this.backendMonitor = backendMonitor;
+  }
+
+
+
+  /**
+   * Retrieves the total number of entries contained in this backend,
+   * if that information is available.
+   *
+   * @return  The total number of entries contained in this backend,
+   *          or -1 if that information is not available.
+   */
+  public abstract long getEntryCount();
+
+
+
+  /**
    * Retrieves the parent backend for this backend.
    *
    * @return  The parent backend for this backend, or

--
Gitblit v1.10.0