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/BackendImpl.java | 34 ++++------------------------------
1 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
index f536e1f..7a16bdf 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -264,33 +264,6 @@
return 0;
}
- /**
- * This method constructs a container name from a base DN. Only alphanumeric
- * characters are preserved, all other characters are replaced with an
- * underscore.
- *
- * @param dn The base DN.
- * @return The container name for the base DN.
- */
- public static String getContainerName(DN dn)
- {
- String normStr = dn.toNormalizedString();
- StringBuilder builder = new StringBuilder(normStr.length());
- for (int i = 0; i < normStr.length(); i++)
- {
- char ch = normStr.charAt(i);
- if (Character.isLetterOrDigit(ch))
- {
- builder.append(ch);
- }
- else
- {
- builder.append('_');
- }
- }
- return builder.toString();
- }
-
/**
@@ -641,7 +614,7 @@
public ConditionResult hasSubordinates(DN entryDN)
throws DirectoryException
{
- long ret = numSubordinates(entryDN);
+ long ret = numSubordinates(entryDN, false);
if(ret < 0)
{
return ConditionResult.UNDEFINED;
@@ -662,7 +635,8 @@
* {@inheritDoc}
*/
@Override()
- public long numSubordinates(DN entryDN) throws DirectoryException
+ public long numSubordinates(DN entryDN, boolean subtree)
+ throws DirectoryException
{
EntryContainer ec;
if (rootContainer != null)
@@ -685,7 +659,7 @@
ec.sharedLock.lock();
try
{
- long count = ec.getNumSubordinates(entryDN);
+ long count = ec.getNumSubordinates(entryDN, subtree);
if(count == Long.MAX_VALUE)
{
// The index entry limit has exceeded and there is no count maintained.
--
Gitblit v1.10.0