KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > naming > ldap > HasControls


1 /*
2  * @(#)HasControls.java 1.8 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.naming.ldap;
9
10 import javax.naming.NamingException JavaDoc;
11
12 /**
13   * This interface is for returning controls with objects returned
14   * in NamingEnumerations.
15   * For example, suppose a server sends back controls with the results
16   * of a search operation, the service provider would return a NamingEnumeration of
17   * objects that are both SearchResult and implement HasControls.
18   *<blockquote><pre>
19   * NamingEnumeration elts = ectx.search((Name)name, filter, sctls);
20   * while (elts.hasMore()) {
21   * Object entry = elts.next();
22   *
23   * // Get search result
24   * SearchResult res = (SearchResult)entry;
25   * // do something with it
26   *
27   * // Get entry controls
28   * if (entry instanceof HasControls) {
29   * Control[] entryCtls = ((HasControls)entry).getControls();
30   * // do something with controls
31   * }
32   * }
33   *</pre></blockquote>
34   *
35   * @author Rosanna Lee
36   * @author Scott Seligman
37   * @author Vincent Ryan
38   * @version 1.8 03/12/19
39   * @since 1.3
40   *
41   */

42
43 public interface HasControls {
44
45     /**
46       * Retrieves an array of <tt>Control</tt>s from the object that
47       * implements this interface. It is null if there are no controls.
48       *
49       * @return A possibly null array of <tt>Control</tt> objects.
50       * @throws NamingException If cannot return controls due to an error.
51       */

52     public Control JavaDoc[] getControls() throws NamingException JavaDoc;
53 }
54
Popular Tags