1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.partition.impl.btree;
18
19
20 import java.math.BigInteger;
21 import java.util.Map;
22
23 import javax.naming.Name;
24 import javax.naming.NamingEnumeration;
25 import javax.naming.NamingException;
26 import javax.naming.directory.SearchControls;
27
28 import org.apache.ldap.common.filter.ExprNode;
29
30
31 /***
32 * Given a search filter and a scope the search engine identifies valid
33 * candidate entries returning their ids.
34 *
35 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
36 * @version $Rev: 264732 $
37 */
38 public interface SearchEngine
39 {
40 /***
41 * @todo put this in the right place
42 * The alias dereferencing mode key for JNDI providers
43 */
44 String ALIASMODE_KEY = "java.naming.ldap.derefAliases";
45 /***
46 * @todo put this in the right place
47 * The alias dereferencing mode value for JNDI providers
48 */
49 String ALWAYS = "always";
50 /***
51 * @todo put this in the right place
52 * The alias dereferencing mode value for JNDI providers
53 */
54 String NEVER = "never";
55 /***
56 * @todo put this in the right place
57 * The alias dereferencing mode value for JNDI providers
58 */
59 String FINDING = "finding";
60 /***
61 * @todo put this in the right place
62 * The alias dereferencing mode value for JNDI providers
63 */
64 String SEARCHING = "searching";
65
66 /***
67 * Gets the optimizer for this DefaultSearchEngine.
68 *
69 * @return the optimizer
70 */
71 Optimizer getOptimizer();
72
73 /***
74 * Conducts a search on a database.
75 *
76 * @param base the search base
77 * @param env the environment for the search
78 * @param filter the search filter AST root
79 * @param searchCtls the JNDI search controls
80 * @return enumeration over SearchResults
81 * @throws NamingException if the search fails
82 */
83 NamingEnumeration search( Name base, Map env, ExprNode filter,
84 SearchControls searchCtls ) throws NamingException;
85
86 /***
87 * Evaluates a filter on an entry with a id.
88 *
89 * @param filter the filter root AST node
90 * @param id the id of the entry to test
91 * @return true if the filter passes the entry, false otherwise
92 * @throws NamingException if something goes wrong while accessing the db
93 */
94 boolean evaluate( ExprNode filter, BigInteger id ) throws NamingException;
95 }