View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.ldap.server.enumeration;
18  
19  
20  import javax.naming.NamingException;
21  import javax.naming.directory.SearchControls;
22  import javax.naming.directory.SearchResult;
23  import javax.naming.ldap.LdapContext;
24  
25  
26  /***
27   * A filter is used to modify search results while they are being returned from
28   * naming enumerations containing DbSearchResults.  These filters are used in
29   * conjunction with a {@link SearchResultFilteringEnumeration}.
30   * Multiple filters can be applied one after the other and hence they are stackable.
31   *
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   * @version $Rev: 264732 $
34   */
35  public interface SearchResultFilter
36  {
37      /***
38       * Filters the contents of search results on the way out the door to client
39       * callers.  These filters can and do produce side-effects on the results if
40       * if need be the attributes or names within the result should be cloned.
41       *
42       * @param result the database search result to return
43       * @param controls search controls associated with the invocation
44       * @return true if the result is to be returned, false if it is to be
45       * discarded from the result set
46       */
47      boolean accept( LdapContext ctx, SearchResult result, SearchControls controls )
48          throws NamingException;
49  }