001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2013-2016 ForgeRock AS.
016 */
017package org.opends.server.types.operation;
018
019import java.util.List;
020import java.util.Set;
021
022import org.forgerock.opendj.ldap.ByteString;
023import org.opends.server.types.Control;
024import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
025import org.forgerock.opendj.ldap.DN;
026import org.opends.server.types.Entry;
027import org.opends.server.types.RawFilter;
028import org.forgerock.opendj.ldap.SearchScope;
029import org.opends.server.types.SearchFilter;
030import org.opends.server.types.SearchResultReference;
031
032/**
033 * This class defines a set of methods that are available for use by
034 * pre-operation plugins for search operations.  Note that this
035 * interface is intended only to define an API for use by plugins and
036 * is not intended to be implemented by any custom classes.
037 */
038@org.opends.server.types.PublicAPI(
039     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
040     mayInstantiate=false,
041     mayExtend=false,
042     mayInvoke=true)
043public interface PreOperationSearchOperation
044       extends PreOperationOperation
045{
046  /**
047   * Retrieves the raw, unprocessed base DN as included in the request
048   * from the client.  This may or may not contain a valid DN, as no
049   * validation will have been performed.
050   *
051   * @return  The raw, unprocessed base DN as included in the request
052   *          from the client.
053   */
054  ByteString getRawBaseDN();
055
056
057
058  /**
059   * Retrieves the base DN for this search operation.
060   *
061   * @return  The base DN for this search operation.
062   */
063  DN getBaseDN();
064
065
066
067  /**
068   * Retrieves the scope for this search operation.
069   *
070   * @return  The scope for this search operation.
071   */
072  SearchScope getScope();
073
074
075
076  /**
077   * Retrieves the alias dereferencing policy for this search
078   * operation.
079   *
080   * @return  The alias dereferencing policy for this search
081   *          operation.
082   */
083  DereferenceAliasesPolicy getDerefPolicy();
084
085
086
087  /**
088   * Retrieves the size limit for this search operation.
089   *
090   * @return  The size limit for this search operation.
091   */
092  int getSizeLimit();
093
094
095
096  /**
097   * Retrieves the time limit for this search operation.
098   *
099   * @return  The time limit for this search operation.
100   */
101  int getTimeLimit();
102
103
104
105  /**
106   * Retrieves the typesOnly flag for this search operation.
107   *
108   * @return  The typesOnly flag for this search operation.
109   */
110  boolean getTypesOnly();
111
112
113
114  /**
115   * Retrieves the raw, unprocessed search filter as included in the
116   * request from the client.  It may or may not contain a valid
117   * filter (e.g., unsupported attribute types or values with an
118   * invalid syntax) because no validation will have been performed on
119   * it.
120   *
121   * @return  The raw, unprocessed search filter as included in the
122   *          request from the client.
123   */
124  RawFilter getRawFilter();
125
126
127
128  /**
129   * Retrieves the filter for this search operation.
130   *
131   * @return  The filter for this search operation.
132   */
133  SearchFilter getFilter();
134
135
136
137  /**
138   * Retrieves the set of requested attributes for this search
139   * operation.  Its contents should not be altered.
140   *
141   * @return  The set of requested attributes for this search
142   *          operation.
143   */
144  Set<String> getAttributes();
145
146
147
148  /**
149   * Returns the provided entry to the client.
150   *
151   * @param  entry     The entry that should be returned.
152   * @param  controls  The set of controls to include with the entry
153   *                   (may be {@code null} if no controls should be
154   *                   included with the entry).
155   *
156   * @return  {@code true} if the caller should continue processing
157   *          the search request and sending additional entries and
158   *          references, or {@code false} if not for some reason
159   *          (e.g., the size limit has been reached or the search has
160   *          been abandoned).
161   */
162  boolean returnEntry(Entry entry, List<Control> controls);
163
164
165
166  /**
167   * Returns the provided search result reference to the client.
168   *
169   * @param   dn        A DN related to the specified search
170   *                    reference.
171   * @param  reference  The search reference that should be returned.
172   *
173   * @return  {@code true} if the caller should continue processing
174   *          the search request and sending additional entries and
175   *          references, or {@code false} if not for some reason
176   *          (e.g., the size limit has been reached or the search has
177   *          been abandoned).
178   */
179  boolean returnReference(DN dn ,SearchResultReference reference);
180}
181