001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2006-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2013-2015 ForgeRock AS.
026 */
027package org.opends.server.types.operation;
028
029import java.util.List;
030import java.util.Set;
031
032import org.forgerock.opendj.ldap.ByteString;
033import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
034import org.forgerock.opendj.ldap.SearchScope;
035import org.opends.server.types.*;
036
037/**
038 * This class defines a set of methods that are available for use by
039 * pre-parse plugins for search operations.  Note that this interface
040 * is intended only to define an API for use by plugins and is not
041 * intended to be implemented by any custom classes.
042 */
043@org.opends.server.types.PublicAPI(
044     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
045     mayInstantiate=false,
046     mayExtend=false,
047     mayInvoke=true)
048public interface PreParseSearchOperation
049       extends PreParseOperation
050{
051  /**
052   * Retrieves the raw, unprocessed base DN as included in the request
053   * from the client.  This may or may not contain a valid DN, as no
054   * validation will have been performed.
055   *
056   * @return  The raw, unprocessed base DN as included in the request
057   *          from the client.
058   */
059  ByteString getRawBaseDN();
060
061
062
063  /**
064   * Specifies the raw, unprocessed base DN for this search operation.
065   *
066   * @param  rawBaseDN  The raw, unprocessed base DN for this search
067                        operation.
068   */
069  void setRawBaseDN(ByteString rawBaseDN);
070
071
072
073  /**
074   * Retrieves the scope for this search operation.
075   *
076   * @return  The scope for this search operation.
077   */
078  SearchScope getScope();
079
080
081
082  /**
083   * Specifies the scope for this search operation.
084   *
085   * @param  scope  The scope for this search operation.
086   */
087  void setScope(SearchScope scope);
088
089
090
091  /**
092   * Retrieves the alias dereferencing policy for this search
093   * operation.
094   *
095   * @return  The alias dereferencing policy for this search
096   *          operation.
097   */
098  DereferenceAliasesPolicy getDerefPolicy();
099
100
101
102  /**
103   * Specifies the alias dereferencing policy for this search
104   * operation.
105   *
106   * @param  derefPolicy  The alias dereferencing policy for this
107   *                      search operation.
108   */
109  void setDerefPolicy(DereferenceAliasesPolicy derefPolicy);
110
111
112
113  /**
114   * Retrieves the size limit for this search operation.
115   *
116   * @return  The size limit for this search operation.
117   */
118  int getSizeLimit();
119
120
121
122  /**
123   * Specifies the size limit for this search operation.
124   *
125   * @param  sizeLimit  The size limit for this search operation.
126   */
127  void setSizeLimit(int sizeLimit);
128
129
130
131  /**
132   * Retrieves the time limit for this search operation.
133   *
134   * @return  The time limit for this search operation.
135   */
136  int getTimeLimit();
137
138
139
140  /**
141   * Specifies the time limit for this search operation.
142   *
143   * @param  timeLimit  The time limit for this search operation.
144   */
145  void setTimeLimit(int timeLimit);
146
147
148
149  /**
150   * Retrieves the typesOnly flag for this search operation.
151   *
152   * @return  The typesOnly flag for this search operation.
153   */
154  boolean getTypesOnly();
155
156
157
158  /**
159   * Specifies the typesOnly flag for this search operation.
160   *
161   * @param  typesOnly  The typesOnly flag for this search operation.
162   */
163  void setTypesOnly(boolean typesOnly);
164
165
166
167  /**
168   * Retrieves the raw, unprocessed search filter as included in the
169   * request from the client.  It may or may not contain a valid
170   * filter (e.g., unsupported attribute types or values with an
171   * invalid syntax) because no validation will have been performed on
172   * it.
173   *
174   * @return  The raw, unprocessed search filter as included in the
175   *          request from the client.
176   */
177  RawFilter getRawFilter();
178
179
180
181  /**
182   * Specifies the raw, unprocessed search filter as included in the
183   * request from the client.
184   *
185   * @param  rawFilter  The raw, unprocessed search filter.
186   */
187  void setRawFilter(RawFilter rawFilter);
188
189
190
191  /**
192   * Retrieves the set of requested attributes for this search
193   * operation.  Its contents should not be altered.
194   *
195   * @return  The set of requested attributes for this search
196   *          operation.
197   */
198  Set<String> getAttributes();
199
200
201
202  /**
203   * Specifies the set of requested attributes for this search
204   * operation.
205   *
206   * @param  attributes  The set of requested attributes for this
207   *                     search operation.
208   */
209  void setAttributes(Set<String> attributes);
210
211
212
213  /**
214   * Returns the provided entry to the client.
215   *
216   * @param  entry     The entry that should be returned.
217   * @param  controls  The set of controls to include with the entry
218   *                   (may be {@code null} if no controls should be
219   *                   included with the entry).
220   *
221   * @return  {@code true} if the caller should continue processing
222   *          the search request and sending additional entries and
223   *          references, or {@code false} if not for some reason
224   *          (e.g., the size limit has been reached or the search has
225   *          been abandoned).
226   */
227  boolean returnEntry(Entry entry, List<Control> controls);
228
229
230
231  /**
232   * Returns the provided search result reference to the client.
233   *
234   * @param  reference  The search reference that should be returned.
235   * @param  dn         A DN related to the specified search reference.
236   * @return  {@code true} if the caller should continue processing
237   *          the search request and sending additional entries and
238   *          references, or {@code false} if not for some reason
239   *          (e.g., the size limit has been reached or the search has
240   *          been abandoned).
241   */
242  boolean returnReference(DN dn, SearchResultReference reference);
243}
244