From 3c92094914aa2d751bd2225ef32a750954fda623 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Mon, 27 Aug 2007 18:58:10 +0000
Subject: [PATCH] This adds the numSubordinates and hasSubordinates operational attribute support in OpenDS.    - Implemented as virtual attributes    - They are enabled by default    - numSubordinates and hasSubordinates methods added to the backend API and implemented for all existing backends    - JE implementation uses the id2children index to keep count of the number of subordinates for each entry.    - The behavior of exceeding the index-entry-limit (ALL-IDs) has changed to store a 8 byte entry ID set count with the most significant bit  set to 1 instead of a 0 byte array to signify the index-entry-limit has been exceeded. The previous format is still compatible but all requests  for numSubordinates will return undefined (-1).    - The DBTest tool is also included in this fix. This can be used to list root containers, entry containers, database containers, index  status, as well as dumping a database with or without decoding the data. 

---
 opendj-sdk/opends/src/server/org/opends/server/api/Backend.java |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/Backend.java b/opendj-sdk/opends/src/server/org/opends/server/api/Backend.java
index 0d0bff4..4651075 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/api/Backend.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/api/Backend.java
@@ -57,6 +57,7 @@
 import org.opends.server.types.LockManager;
 import org.opends.server.types.RestoreConfig;
 import org.opends.server.types.WritabilityMode;
+import org.opends.server.types.ConditionResult;
 
 import static org.opends.messages.BackendMessages.*;
 
@@ -238,6 +239,40 @@
 
 
   /**
+   * Indicates whether the requested entry has any subordinates.
+   *
+   * @param entryDN The distinguished name of the entry.
+   *
+   * @return {@code ConditionResult.TRUE} if the entry has one or more
+   *         subordinates or {@code ConditionResult.FALSE} otherwise
+   *         or {@code ConditionResult.UNDEFINED} if it can not be
+   *         determined.
+   *
+   * @throws DirectoryException  If a problem occurs while trying to
+   *                              retrieve the entry.
+   */
+  public abstract ConditionResult hasSubordinates(DN entryDN)
+        throws DirectoryException;
+
+
+
+  /**
+   * Retrieves the number of subordinates for the requested entry.
+   *
+   * @param entryDN The distinguished name of the entry.
+   *
+   * @return The number of subordinate entries for the requested entry
+   *         or -1 if it can not be determined.
+   *
+   * @throws DirectoryException  If a problem occurs while trying to
+   *                              retrieve the entry.
+   */
+  public abstract long numSubordinates(DN entryDN)
+      throws DirectoryException;
+
+
+
+  /**
    * Indicates whether an entry with the specified DN exists in the
    * backend. The default implementation obtains a read lock and calls
    * {@code getEntry}, but backend implementations may override this

--
Gitblit v1.10.0