com.sun.jndi.ldap.ctl
Class VirtualListViewControl

java.lang.Object
  extended by com.sun.jndi.ldap.BasicControl
      extended by com.sun.jndi.ldap.ctl.VirtualListViewControl
All Implemented Interfaces:
java.io.Serializable, javax.naming.ldap.Control

public final class VirtualListViewControl
extends com.sun.jndi.ldap.BasicControl

This class implements the LDAPv3 Request Control for virtual-list-view as defined in draft-ietf-ldapext-ldapv3-vlv-09.txt. The control's value has the following ASN.1 definition:


     VirtualListViewRequest ::= SEQUENCE {
         beforeCount    INTEGER (0 .. maxInt),
         afterCount     INTEGER (0 .. maxInt),
         CHOICE {
             byoffset [0] SEQUENCE {
                 offset          INTEGER (0 .. maxInt),
                 contentCount    INTEGER (0 .. maxInt)
             }
             greaterThanOrEqual [1] AssertionValue
         }
         contextID     OCTET STRING OPTIONAL
     }

 
This control is always used in conjunction with the server-side sort control (RFC-2891).

Author:
Vincent Ryan
See Also:
VirtualListViewResponseControl, SortControl, Serialized Form

Field Summary
private  int afterCount
          The number of entries after the target entry in a sublist.
private  int beforeCount
          The number of entries before the target entry in a sublist.
private  byte[] cookie
          A server-generated cookie.
private  int listSize
          An estimate of the number of entries in the list.
static java.lang.String OID
          The virtual-list-view control's assigned object identifier is 2.16.840.1.113730.3.4.9.
private static long serialVersionUID
           
private  java.lang.Object targetAttrValue
          Attribute value used to locate the target entry.
private  int targetOffset
          An offset into the list.
 
Fields inherited from class com.sun.jndi.ldap.BasicControl
criticality, id, value
 
Fields inherited from interface javax.naming.ldap.Control
CRITICAL, NONCRITICAL
 
Constructor Summary
VirtualListViewControl(int targetPercentage, int viewSize, boolean criticality)
          Constructs a virtual-list-view control.
VirtualListViewControl(int targetOffset, int listSize, int beforeCount, int afterCount, boolean criticality)
          Constructs a virtual-list-view control.
VirtualListViewControl(java.lang.Object targetAttrValue, int viewSize, boolean criticality)
          Constructs a virtual-list-view critical control.
VirtualListViewControl(java.lang.Object targetAttrValue, int beforeCount, int afterCount, boolean criticality)
          Constructs a virtual-list-view control.
 
Method Summary
 void setContextID(byte[] contextID)
          Sets a server-generated cookie in the virtual-list-view request.
private  byte[] setEncodedValue()
           
 
Methods inherited from class com.sun.jndi.ldap.BasicControl
getEncodedValue, getID, isCritical
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OID

public static final java.lang.String OID
The virtual-list-view control's assigned object identifier is 2.16.840.1.113730.3.4.9.

See Also:
Constant Field Values

beforeCount

private int beforeCount
The number of entries before the target entry in a sublist.


afterCount

private int afterCount
The number of entries after the target entry in a sublist.


targetOffset

private int targetOffset
An offset into the list.


listSize

private int listSize
An estimate of the number of entries in the list.


targetAttrValue

private java.lang.Object targetAttrValue
Attribute value used to locate the target entry. This value is compared to values of the attribute specified as the primary sort key. Only String and byte[] values are currently supported.


cookie

private byte[] cookie
A server-generated cookie.


serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

VirtualListViewControl

public VirtualListViewControl(int targetPercentage,
                              int viewSize,
                              boolean criticality)
                       throws java.io.IOException
Constructs a virtual-list-view control. Request a view of a portion of the list centered around a given target entry. The position of the target entry is estimated as a percentage of the list.

Parameters:
targetPercentage - The position of the target entry expressed as a percentage of the list. For example, a value of 25 indicates that the target entry is at the 25 percent mark in the list.
viewSize - The number of entries to be returned in this view of the list.
criticality - The control's criticality setting.
Throws:
java.lang.IllegalArgumentException - if targetPercentage is outside the range 0-100.
java.io.IOException - If a BER encoding error occurs.

VirtualListViewControl

public VirtualListViewControl(int targetOffset,
                              int listSize,
                              int beforeCount,
                              int afterCount,
                              boolean criticality)
                       throws java.io.IOException
Constructs a virtual-list-view control. Request a view of a portion of the list with the specified number of entries before and after a given target entry. The target entry is identified by means of an offset into the list.

Parameters:
targetOffset - The position of the target entry as an offset into the list.
listSize - An estimate of the number of entries in the list.
beforeCount - The number of entries to be returned before the target entry.
afterCount - The number of entries to be returned after the target entry.
criticality - The control's criticality setting.
Throws:
java.lang.IllegalArgumentException - if targetOffset, listSize, beforeCount or afterCount are less than zero.
java.io.IOException - If a BER encoding error occurs.

VirtualListViewControl

public VirtualListViewControl(java.lang.Object targetAttrValue,
                              int viewSize,
                              boolean criticality)
                       throws javax.naming.directory.InvalidAttributeValueException,
                              java.io.IOException
Constructs a virtual-list-view critical control. Request a view of a portion of the list centered around a given target entry. The target entry is the first entry that is greater than or equal to the specified attribute value. The value's attribute ID is the primary sort key specified in the server-side sort control.

Parameters:
targetAttrValue - An attribute value used to locate the target entry. Its attribute ID is that of the primary sort key specified in the server-side sort control.
viewSize - The number of entries to be returned in this view of the list.
criticality - The control's criticality setting.
Throws:
javax.naming.directory.InvalidAttributeValueException - if targetAttrValue is neither a String nor a byte[].
java.io.IOException - If a BER encoding error occurs.

VirtualListViewControl

public VirtualListViewControl(java.lang.Object targetAttrValue,
                              int beforeCount,
                              int afterCount,
                              boolean criticality)
                       throws javax.naming.directory.InvalidAttributeValueException,
                              java.io.IOException
Constructs a virtual-list-view control. Request a view of a portion of the list with the specified number of entries before and after a given target entry. The target entry is the first entry that is greater than or equal to the specified attribute value. The value's attribute ID is the primary sort key specified in the server-side sort control.

Parameters:
targetAttrValue - An attribute value used to locate the target entry. Its attribute ID is that of the primary sort key specified in the server-side sort control.
beforeCount - The number of entries to be returned before the target entry.
afterCount - The number of entries to be returned after the target entry.
criticality - The control's criticality setting.
Throws:
javax.naming.directory.InvalidAttributeValueException - if targetAttrValue is neither a String nor a byte[].
java.lang.IllegalArgumentException - if beforeCount or afterCount are less than zero.
java.io.IOException - If a BER encoding error occurs.
Method Detail

setContextID

public void setContextID(byte[] contextID)
                  throws java.io.IOException
Sets a server-generated cookie in the virtual-list-view request.

Parameters:
contextID - A server-generated cookie.
Throws:
java.io.IOException - If a BER encoding error occurs.

setEncodedValue

private byte[] setEncodedValue()
                        throws java.io.IOException
Throws:
java.io.IOException