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/MemoryBackend.java | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/MemoryBackend.java b/opendj-sdk/opends/src/server/org/opends/server/backends/MemoryBackend.java
index 33f8351..9ec6f22 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/MemoryBackend.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/MemoryBackend.java
@@ -326,7 +326,7 @@
public synchronized ConditionResult hasSubordinates(DN entryDN)
throws DirectoryException
{
- long ret = numSubordinates(entryDN);
+ long ret = numSubordinates(entryDN, false);
if(ret < 0)
{
return ConditionResult.UNDEFINED;
@@ -345,7 +345,7 @@
* {@inheritDoc}
*/
@Override()
- public synchronized long numSubordinates(DN entryDN)
+ public synchronized long numSubordinates(DN entryDN, boolean subtree)
throws DirectoryException
{
// Try to look up the immediate children for the DN
@@ -360,7 +360,20 @@
return -1;
}
- return children.size();
+ if(!subtree)
+ {
+ return children.size();
+ }
+ else
+ {
+ long count = 0;
+ for(DN child : children)
+ {
+ count += numSubordinates(child, true);
+ count++;
+ }
+ return count;
+ }
}
/**
--
Gitblit v1.10.0