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