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/backends/BackupBackend.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/BackupBackend.java b/opends/src/server/org/opends/server/backends/BackupBackend.java
index 0576804..6d92aad 100644
--- a/opends/src/server/org/opends/server/backends/BackupBackend.java
+++ b/opends/src/server/org/opends/server/backends/BackupBackend.java
@@ -336,6 +336,34 @@
 
 
   /**
+   * {@inheritDoc}
+   */
+  public long getEntryCount()
+  {
+    assert debugEnter(CLASS_NAME, "getEntryCount");
+
+    int numEntries = 1;
+
+    AttributeType backupPathType =
+         DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
+
+    for (File f : backupDirectories)
+    {
+      try
+      {
+        DN backupDirDN = makeChildDN(backupBaseDN, backupPathType,
+                                     f.getAbsolutePath());
+        getBackupDirectoryEntry(backupDirDN);
+        numEntries++;
+      } catch (Exception e) {}
+    }
+
+    return numEntries;
+  }
+
+
+
+  /**
    * Indicates whether the data associated with this backend may be considered
    * local (i.e., in a repository managed by the Directory Server) rather than
    * remote (i.e., in an external repository accessed by the Directory Server

--
Gitblit v1.10.0