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   *    https://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.extras.controls.ad;
21  
22  import java.util.EnumSet;
23  import java.util.Set;
24  
25  import org.apache.directory.api.ldap.model.message.Control;
26  
27  
28  /**
29   * The DirSync response control, as described in http://tools.ietf.org/html/draft-armijo-ldap-dirsync-00.
30   * Here is the ASN/1 description of the SearchRequest control :
31   *
32   * <pre>
33   * Repl    Control ::= SEQUENCE {
34   *     controlType             1.2.840.113556.1.4.841
35   *     controlValue            replControlValue
36   *     criticality             TRUE
37   * }
38   * </pre>
39   *
40   * the control value is :
41   * <pre>
42   * realReplControlValue ::= SEQUENCE {
43   *     flag                  integer
44   *     maxReturnLength       integer
45   *     cookie                OCTET STRING
46   * }
47   * </pre>
48   *
49   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
50   *
51   */
52  public interface AdDirSyncResponse extends Control
53  {
54      /** This control OID */
55      String OID = "1.2.840.113556.1.4.841";
56  
57  
58      /**
59       * @return The maximum length of attributes to be returned
60       */
61      int getMaxReturnLength();
62  
63  
64      /**
65       * @param maxReturnLength The maximum length of attributes to be returned
66       */
67      void setMaxReturnLength( int maxReturnLength );
68  
69  
70      /**
71       * @return The cookie used while processing the successive DirSync operations
72       */
73      byte[] getCookie();
74  
75  
76      /**
77       * @param cookie The cookie to send to the server. It's the value found in the response control. Should be null
78       * for the first control.
79       */
80      void setCookie( byte[] cookie );
81  
82  
83      /**
84       * @return The flags returned by the server. Zero or more of :
85       * <ul>
86       * <li>LDAP_DIRSYNC_OBJECT_SECURITY (0x0001)</li>
87       * <li>LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER (0x0800)</li>
88       * <li>LDAP_DIRSYNC_PUBLIC_DATA_ONLY (0x2000)(</li>
89       * <li>LDAP_DIRSYNC_INCREMENTAL_VALUES (0x7FFFFFFF)</li>
90       * </ul>
91       */
92      Set<AdDirSyncResponseFlag> getFlags();
93  
94  
95      /**
96       * @param flags The flags to be set. See {@link EnumSet} for how to generate EnumSets.
97       */
98      void setFlags( Set<AdDirSyncResponseFlag> flags );
99  
100 
101     /**
102      * @param flag The flag to be added to the current collection of flags.
103      */
104     void addFlag( AdDirSyncResponseFlag flag );
105 
106 
107     /**
108      * @param flag The flag to be removed from the current collection of flags.
109      */
110     void removeFlag( AdDirSyncResponseFlag flag );
111 }