org.opends.server.controls
Class VLVRequestControl

java.lang.Object
  extended by org.opends.server.types.Control
      extended by org.opends.server.controls.VLVRequestControl

public class VLVRequestControl
extends Control

This class implements the virtual list view request controls as defined in draft-ietf-ldapext-ldapv3-vlv. The ASN.1 description for the control value is:

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


Field Summary
static byte TYPE_TARGET_BYOFFSET
          The BER type to use when encoding the byOffset target element.
static byte TYPE_TARGET_GREATERTHANOREQUAL
          The BER type to use when encoding the greaterThanOrEqual target element.
 
Constructor Summary
VLVRequestControl(int beforeCount, int afterCount, ByteString greaterThanOrEqual)
          Creates a new VLV request control with the provided information.
VLVRequestControl(int beforeCount, int afterCount, ByteString greaterThanOrEqual, ByteString contextID)
          Creates a new VLV request control with the provided information.
VLVRequestControl(int beforeCount, int afterCount, int offset, int contentCount)
          Creates a new VLV request control with the provided information.
VLVRequestControl(int beforeCount, int afterCount, int offset, int contentCount, ByteString contextID)
          Creates a new VLV request control with the provided information.
 
Method Summary
static VLVRequestControl decodeControl(Control control)
          Creates a new VLV request control from the contents of the provided control.
 int getAfterCount()
          Retrieves the number of entries after the target offset or assertion value to include in the results page.
 int getBeforeCount()
          Retrieves the number of entries before the target offset or assertion value to include in the results page.
 int getContentCount()
          Retrieves the content count indicating the estimated number of entries in the complete result set.
 ByteString getContextID()
          Retrieves a context ID value that should be used to resume a previous VLV results session.
 ByteString getGreaterThanOrEqualAssertion()
          Retrieves the assertion value that will be used to locate the beginning of the results page.
 int getOffset()
          Retrieves the offset that indicates the beginning of the results page.
 byte getTargetType()
          Retrieves the BER type for the target that specifies the beginning of the results page.
 java.lang.String toString()
          Retrieves a string representation of this VLV request control.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this VLV request control to the provided buffer.
 
Methods inherited from class org.opends.server.types.Control
getOID, getValue, hasValue, isCritical, setCritical, setOID, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_TARGET_BYOFFSET

public static final byte TYPE_TARGET_BYOFFSET
The BER type to use when encoding the byOffset target element.

See Also:
Constant Field Values

TYPE_TARGET_GREATERTHANOREQUAL

public static final byte TYPE_TARGET_GREATERTHANOREQUAL
The BER type to use when encoding the greaterThanOrEqual target element.

See Also:
Constant Field Values
Constructor Detail

VLVRequestControl

public VLVRequestControl(int beforeCount,
                         int afterCount,
                         int offset,
                         int contentCount)
Creates a new VLV request control with the provided information.

Parameters:
beforeCount - The number of entries before the target offset to retrieve in the results page.
afterCount - The number of entries after the target offset to retrieve in the results page.
offset - The offset in the result set to target for the beginning of the page of results.
contentCount - The content count returned by the server in the last phase of the VLV request, or zero for a new VLV request session.

VLVRequestControl

public VLVRequestControl(int beforeCount,
                         int afterCount,
                         int offset,
                         int contentCount,
                         ByteString contextID)
Creates a new VLV request control with the provided information.

Parameters:
beforeCount - The number of entries before the target offset to retrieve in the results page.
afterCount - The number of entries after the target offset to retrieve in the results page.
offset - The offset in the result set to target for the beginning of the page of results.
contentCount - The content count returned by the server in the last phase of the VLV request, or zero for a new VLV request session.
contextID - The context ID provided by the server in the last VLV response for the same set of criteria, or null if there was no previous VLV response or the server did not include a context ID in the last response.

VLVRequestControl

public VLVRequestControl(int beforeCount,
                         int afterCount,
                         ByteString greaterThanOrEqual)
Creates a new VLV request control with the provided information.

Parameters:
beforeCount - The number of entries before the target offset to retrieve in the results page.
afterCount - The number of entries after the target offset to retrieve in the results page.
greaterThanOrEqual - The greaterThanOrEqual target assertion value that indicates where to start the page of results.

VLVRequestControl

public VLVRequestControl(int beforeCount,
                         int afterCount,
                         ByteString greaterThanOrEqual,
                         ByteString contextID)
Creates a new VLV request control with the provided information.

Parameters:
beforeCount - The number of entries before the target assertion value.
afterCount - The number of entries after the target assertion value.
greaterThanOrEqual - The greaterThanOrEqual target assertion value that indicates where to start the page of results.
contextID - The context ID provided by the server in the last VLV response for the same set of criteria, or null if there was no previous VLV response or the server did not include a context ID in the last response.
Method Detail

getBeforeCount

public int getBeforeCount()
Retrieves the number of entries before the target offset or assertion value to include in the results page.

Returns:
The number of entries before the target offset to include in the results page.

getAfterCount

public int getAfterCount()
Retrieves the number of entries after the target offset or assertion value to include in the results page.

Returns:
The number of entries after the target offset to include in the results page.

getTargetType

public byte getTargetType()
Retrieves the BER type for the target that specifies the beginning of the results page.

Returns:
TYPE_TARGET_BYOFFSET if the beginning of the results page should be specified as a nuemric offset, or TYPE_TARGET_GREATERTHANOREQUAL if it should be specified by an assertion value.

getOffset

public int getOffset()
Retrieves the offset that indicates the beginning of the results page. The return value will only be applicable if the getTargetType method returns TYPE_TARGET_BYOFFSET.

Returns:
The offset that indicates the beginning of the results page.

getContentCount

public int getContentCount()
Retrieves the content count indicating the estimated number of entries in the complete result set. The return value will only be applicable if the getTargetType method returns TYPE_TARGET_BYOFFSET.

Returns:
The content count indicating the estimated number of entries in the complete result set.

getGreaterThanOrEqualAssertion

public ByteString getGreaterThanOrEqualAssertion()
Retrieves the assertion value that will be used to locate the beginning of the results page. This will only be applicable if the getTargetType method returns TYPE_TARGET_GREATERTHANOREQUAL.

Returns:
The assertion value that will be used to locate the beginning of the results page, or null if the beginning of the results page is to be specified using an offset.

getContextID

public ByteString getContextID()
Retrieves a context ID value that should be used to resume a previous VLV results session.

Returns:
A context ID value that should be used to resume a previous VLV results session, or null if none is available.

decodeControl

public static VLVRequestControl decodeControl(Control control)
                                       throws LDAPException
Creates a new VLV request control from the contents of the provided control.

Parameters:
control - The generic control containing the information to use to create this VLV request control. It must not be null.
Returns:
The VLV request control decoded from the provided control.
Throws:
LDAPException - If this control cannot be decoded as a valid VLV request control.

toString

public java.lang.String toString()
Retrieves a string representation of this VLV request control.

Overrides:
toString in class Control
Returns:
A string representation of this VLV request control.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this VLV request control to the provided buffer.

Overrides:
toString in class Control
Parameters:
buffer - The buffer to which the information should be appended.