View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  package org.apache.directory.api.ldap.model.message.controls;
21  
22  
23  import org.apache.directory.api.ldap.model.message.Control;
24  
25  
26  /**
27   * A request/response control used to implement a simple paging of search
28   * results. This is an implementation of RFC 2696 :
29   * <a href="http://www.faqs.org/rfcs/rfc2696.html">LDAP Control Extension for Simple Paged Results Manipulation</a>
30   * <br/>
31   * <pre>
32   *    This control is included in the searchRequest and searchResultDone
33   *    messages as part of the controls field of the LDAPMessage, as defined
34   *    in Section 4.1.12 of [LDAPv3]. The structure of this control is as
35   *    follows:
36   *
37   * pagedResultsControl ::= SEQUENCE {
38   *         controlType     1.2.840.113556.1.4.319,
39   *         criticality     BOOLEAN DEFAULT FALSE,
40   *         controlValue    searchControlValue
41   * }
42   *
43   * The searchControlValue is an OCTET STRING wrapping the BER-encoded
44   * version of the following SEQUENCE:
45   *
46   * realSearchControlValue ::= SEQUENCE {
47   *         size            INTEGER (0..maxInt),
48   *                                 -- requested page size from client
49   *                                 -- result set size estimate from server
50   *         cookie          OCTET STRING
51   * }
52   *
53   * </pre>
54   *
55   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
56   */
57  public interface PagedResults extends Control
58  {
59      /** The Paged Search Control OID */
60      String OID = "1.2.840.113556.1.4.319";
61  
62  
63      /**
64       * @return The requested or returned number of entries
65       */
66      int getSize();
67  
68  
69      /**
70       * Set the number of entry requested or returned
71       *
72       * @param size The number of entries
73       */
74      void setSize( int size );
75  
76  
77      /**
78       * @return The stored cookie
79       */
80      byte[] getCookie();
81  
82  
83      /**
84       * Set the cookie
85       *
86       * @param cookie The cookie to store in this control
87       */
88      void setCookie( byte[] cookie );
89  
90  
91      /**
92       * @return The integer value for the current cookie
93       */
94      int getCookieValue();
95  }