From d0fa149bb033b08cd0e14c28beb5c1a4d2a7ed06 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Thu, 09 Apr 2009 22:43:42 +0000
Subject: [PATCH] - add numSubordinates support.
---
opends/src/server/org/opends/server/backends/ndb/BackendImpl.java | 42 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java b/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
index a5c24eb..4c58403 100644
--- a/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
+++ b/opends/src/server/org/opends/server/backends/ndb/BackendImpl.java
@@ -1116,11 +1116,11 @@
throws DirectoryException
{
long ret = numSubordinates(entryDN, false);
- if(ret < 0)
+ if (ret < 0)
{
return ConditionResult.UNDEFINED;
}
- else if(ret == 0)
+ else if (ret == 0)
{
return ConditionResult.FALSE;
}
@@ -1139,8 +1139,42 @@
public long numSubordinates(DN entryDN, boolean subtree)
throws DirectoryException
{
- // NYI.
- return -1;
+ EntryContainer ec;
+ if (rootContainer != null)
+ {
+ ec = rootContainer.getEntryContainer(entryDN);
+ }
+ else
+ {
+ Message message = ERR_ROOT_CONTAINER_NOT_INITIALIZED.get(getBackendID());
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
+ message);
+ }
+
+ if (ec == null)
+ {
+ return -1;
+ }
+
+ readerBegin();
+ ec.sharedLock.lock();
+ try
+ {
+ return ec.getNumSubordinates(entryDN, subtree);
+ }
+ catch (NdbApiException e)
+ {
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ }
+ throw createDirectoryException(e);
+ }
+ finally
+ {
+ ec.sharedLock.unlock();
+ readerEnd();
+ }
}
--
Gitblit v1.10.0