From 4738da898c0e9289f0b1171d7f3023c6c834d82e Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Mon, 22 Oct 2007 21:47:06 +0000
Subject: [PATCH] Added the ability to retrieve the number of entries in the entire subordinate subtree to the numSubordinates method in the backend API. Changed the replication code to use numSubordinates of the entires subtree to determine how many entries will be exported and imported during initialization.
---
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
index 3301c7e..556ebbf 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -720,19 +720,30 @@
* Determine the number of subordinate entries for a given entry.
*
* @param entryDN The distinguished name of the entry.
+ * @param subtree <code>true</code> will include all the entries under the
+ * given entries. <code>false</code> will only return the
+ * number of entries immediately under the given entry.
* @return The number of subordinate entries for the given entry or -1 if
* the entry does not exist.
* @throws DatabaseException If an error occurs in the JE database.
*/
- public long getNumSubordinates(DN entryDN) throws DatabaseException
+ public long getNumSubordinates(DN entryDN, boolean subtree)
+ throws DatabaseException
{
EntryID entryID = dn2id.get(null, entryDN);
if (entryID != null)
{
DatabaseEntry key =
new DatabaseEntry(JebFormat.entryIDToDatabase(entryID.longValue()));
- EntryIDSet entryIDSet =
- id2children.readKey(key, null, LockMode.DEFAULT);
+ EntryIDSet entryIDSet;
+ if(!subtree)
+ {
+ entryIDSet = id2children.readKey(key, null, LockMode.DEFAULT);
+ }
+ else
+ {
+ entryIDSet = id2subtree.readKey(key, null, LockMode.DEFAULT);
+ }
long count = entryIDSet.size();
if(count != Long.MAX_VALUE)
{
--
Gitblit v1.10.0