From 4b976b00d90e98ae2807d7bdc9efb79a4ce75751 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 30 Apr 2007 16:24:15 +0000
Subject: [PATCH] Implement support for the virtual list view (VLV) control as defined in draft-ietf-ldapext-ldapv3-vlv. This can be used to retrieve a specified page of a search result set. Any result set that can be used with server-side sorting can also be used with VLV. The ldapsearch tool has also been updated to support this control.
---
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java | 41 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 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 fa8029f..18eb18b 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
@@ -42,6 +42,7 @@
import org.opends.server.controls.PagedResultsControl;
import org.opends.server.controls.ServerSideSortRequestControl;
import org.opends.server.controls.ServerSideSortResponseControl;
+import org.opends.server.controls.VLVRequestControl;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeValue;
@@ -552,6 +553,7 @@
List<Control> controls = searchOperation.getRequestControls();
PagedResultsControl pageRequest = null;
ServerSideSortRequestControl sortRequest = null;
+ VLVRequestControl vlvRequest = null;
if (controls != null)
{
for (Control control : controls)
@@ -575,6 +577,14 @@
throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
e.getMessage(), e.getMessageID(), e);
}
+
+ if (vlvRequest != null)
+ {
+ int msgID = MSGID_JEB_SEARCH_CANNOT_MIX_PAGEDRESULTS_AND_VLV;
+ String message = getMessage(msgID);
+ throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
+ message, msgID);
+ }
}
}
else if (control.getOID().equals(OID_SERVER_SIDE_SORT_REQUEST_CONTROL))
@@ -597,6 +607,34 @@
}
}
}
+ else if (control.getOID().equals(OID_VLV_REQUEST_CONTROL))
+ {
+ // Ignore all but the first VLV request control.
+ if (vlvRequest == null)
+ {
+ try
+ {
+ vlvRequest = VLVRequestControl.decodeControl(control);
+ }
+ catch (LDAPException e)
+ {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
+ e.getMessage(), e.getMessageID(), e);
+ }
+
+ if (pageRequest != null)
+ {
+ int msgID = MSGID_JEB_SEARCH_CANNOT_MIX_PAGEDRESULTS_AND_VLV;
+ String message = getMessage(msgID);
+ throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
+ message, msgID);
+ }
+ }
+ }
}
}
@@ -759,7 +797,8 @@
{
entryIDList = EntryIDSetSorter.sort(this, entryIDList,
searchOperation,
- sortRequest.getSortOrder());
+ sortRequest.getSortOrder(),
+ vlvRequest);
searchOperation.addResponseControl(
new ServerSideSortResponseControl(LDAPResultCode.SUCCESS, null));
}
--
Gitblit v1.10.0