org.apache.directory.server.ldap.handlers.controls
Class PagedSearchContext

java.lang.Object
  extended by org.apache.directory.server.ldap.handlers.controls.PagedSearchContext

public class PagedSearchContext
extends java.lang.Object

The structure which stores the informations relative to the pagedSearch control. They are associated to a cookie, stored into the session and associated to an instance of this class.

Version:
$Rev: $
Author:
Apache Directory Project

Constructor Summary
PagedSearchContext(org.apache.directory.shared.ldap.message.internal.InternalSearchRequest searchRequest)
          Creates a new instance of this class, storing the Searchrequest into it.
 
Method Summary
 byte[] getCookie()
          Compute a new key for this cookie, based on the current searchRequest hashCode and the current position.
 int getCookieValue()
           
 int getCurrentPosition()
           
 EntryFilteringCursor getCursor()
           
 byte[] getNewCookie()
          Compute a new cookie, if the previous one already exists.
 org.apache.directory.shared.ldap.message.internal.InternalSearchRequest getPreviousSearchRequest()
           
 boolean hasSameRequest(org.apache.directory.shared.ldap.message.internal.InternalSearchRequest request, LdapSession session)
          Compare the previous search request and the new one, and return true if they are equal.
 void incrementCurrentPosition(int returnedEntries)
          Set the new current position, incrementing it with the number of returned entries.
 void setCursor(EntryFilteringCursor cursor)
          Set the new cursor for this search request
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PagedSearchContext

public PagedSearchContext(org.apache.directory.shared.ldap.message.internal.InternalSearchRequest searchRequest)
Creates a new instance of this class, storing the Searchrequest into it.

Method Detail

getCookie

public byte[] getCookie()
Compute a new key for this cookie, based on the current searchRequest hashCode and the current position. This value will be stored into the session, and will permit the retrieval of this instance.

Returns:
The new cookie's key

getCookieValue

public int getCookieValue()

getNewCookie

public byte[] getNewCookie()
Compute a new cookie, if the previous one already exists. This is unlikely, as we are based on some time seed, but just in case, this method will generate a new one.

Returns:
The new cookie

hasSameRequest

public boolean hasSameRequest(org.apache.directory.shared.ldap.message.internal.InternalSearchRequest request,
                              LdapSession session)
Compare the previous search request and the new one, and return true if they are equal. We compare every field but the MessageID.

Parameters:
request - The new SearchRequest
Returns:
true if both request are equal.

getCurrentPosition

public int getCurrentPosition()
Returns:
The current position in the cursor. This value is updated after each successful search request.

incrementCurrentPosition

public void incrementCurrentPosition(int returnedEntries)
Set the new current position, incrementing it with the number of returned entries.

Parameters:
returnedEntries - The number of returned entries

getPreviousSearchRequest

public org.apache.directory.shared.ldap.message.internal.InternalSearchRequest getPreviousSearchRequest()
Returns:
The previous search request

getCursor

public EntryFilteringCursor getCursor()
Returns:
The associated cursor

setCursor

public void setCursor(EntryFilteringCursor cursor)
Set the new cursor for this search request

Parameters:
cursor - The associated cursor

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.