1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.ldaptemplate;
17
18 import javax.naming.NamingException;
19 import javax.naming.directory.DirContext;
20
21 /***
22 * Interface for delegating an actual operation to be performed on an
23 * DirContext. For searches, use {@link net.sf.ldaptemplate.SearchExecutor} in
24 * stead. A typical implementation would look like:
25 *
26 * <pre>
27 * return ctx.lookup(dn);
28 * </pre>
29 *
30 * @see net.sf.ldaptemplate.LdapTemplate#executeReadOnly(ContextExecutor)
31 * @see net.sf.ldaptemplate.LdapTemplate#executeReadWrite(ContextExecutor)
32 *
33 * @author Mattias Arthursson
34 */
35 public interface ContextExecutor {
36 /***
37 * Perform any operation on the context.
38 *
39 * @param ctx
40 * the DirContext to perform the operation on.
41 * @return any object resulting from the operation - might be null.
42 * @throws NamingException
43 * if the operation resulted in one.
44 */
45 public Object executeWithContext(DirContext ctx) throws NamingException;
46 }