📄 package-summary.html
字号:
throws NamingException { // check validity of id long time = ... // decode berValue to get time } // Type-safe and User-friendly methods public java.util.Date getDate() { return new java.util.Date(time); } public long getTime() { return time; } // Low level methods public byte[] getEncodedValue() { return // berValue saved; } public String getID() { return GETTIME_RESP_OID; }}</pre></blockquote><h4>Controls</h4>This package defines the interface <tt>Control</tt> to represent an LDAPv3control. It can be a control that is sent to an LDAP server(<em>request control</em>) or a control returned by an LDAP server(<em>response control</em>). Unlike extended requests and responses,there is not necessarily any pairing between request controls andresponse controls. You can send request controls and expect noresponse controls back, or receive response controls without sendingany request controls.<p>An application typically does not deal directly with this interface.Instead, it deals with classes that <em>implement</em> this interface.The application gets control classes either as part of a repertoire ofcontrols standardized through the IETF, or from directory vendors forvendor-specific controls. The request control classes should haveconstructors that accept arguments in a type-safe and user-friendlymanner, while the response control classes should have access methodsfor getting the data of the response in a type-safe and user-friendlymanner. Internally, the request/response control classes deal withencoding and decoding BER values.<p>For example, suppose an LDAP server supports a "sort"request control, which when sent with a search request, asks theserver to return the results of the search ordered by a particular attributeIt would supply a class <tt>SortControl</tt> so that applicationscan use this feature.An application would use this class as follows:<blockquote><pre>Control[] reqCtls = new Control[] {new SortControl("age")};ectx.setRequestControls(reqCtls);NamingEnumeration enum = ectx.search(...);</pre></blockquote>The <tt>SortControl</tt> class might be defined as follows:<blockquote><pre>public class SortControl implements Control { // User-friendly constructor public SortControl(String attrID) { // encode attrID }; // Methods used by service providers public String getID() { return SORT_OID; } public byte[] getEncodedValue() { return // encoded attrID } ...}</pre></blockquote><p>When a service provider receives response controls, it usesthe <tt>ControlFactory</tt> class to produce specific classes that implement the <tt>Control</tt> interface.<p>An LDAP server can send back response controls with an LDAP operationand also with enumeration results, such as those returnedby a list or search operation.The <tt>LdapContext</tt> provides a method (<tt>getResponseControls()</tt>)for getting the response controls sent with an LDAP operation,while the <tt>HasControls</tt> interface is used to retrieveresponse controls associated with enumeration results.<p>For example, suppose an LDAP server sends back a "change ID" control in responseto a successful modification. It would supply a class <tt>ChangeIDControl</tt>so that the application can use this feature.An application would perform an update, and then try to get the change ID.<blockquote><pre>// Perform updateContext ctx = ectx.createSubsubcontext("cn=newobj");// Get response controlsControl[] respCtls = ectx.getResponseControls();if (respCtls != null) { // Find the one we want for (int i = 0; i < respCtls; i++) { if(respCtls[i] instanceof ChangeIDControl) { ChangeIDControl cctl = (ChangeIDControl)respCtls[i]; System.out.println(cctl.getChangeID()); } }}</pre></blockquote>The vendor might supply the following <tt>ChangeIDControl</tt> and<tt>VendorXControlFactory</tt> classes. The <tt>VendorXControlFactory</tt>will be used by the service provider when the provider receives responsecontrols from the LDAP server.<blockquote><pre>public class ChangeIDControl implements Control { long id; // Constructor used by ControlFactory ChangeIDControl(String OID, byte[] berVal) throws NamingException { // check validity of OID id = // extract change ID from berVal }; // Type-safe and User-friendly method public long getChangeID() { return id; } // Low-level methods public String getID() { return CHANGEID_OID; } public byte[] getEncodedValue() { return // original berVal } ...}public class VendorXControlFactory extends ControlFactory { public VendorXControlFactory () { } public Control getControlInstance(Control orig) throws NamingException { if (isOneOfMyControls(orig.getID())) { ... // determine which of ours it is and call its constructor return (new ChangeIDControl(orig.getID(), orig.getEncodedValue())); } return null; // not one of ours }}</pre></blockquote><p><h2>Package Specification</h2><p> The following documents can be found at the<a href="http://java.sun.com/products/jndi">Java technology web site</a>:<ul> <li><a href="ftp://ftp.javasoft.com/docs/j2se1.3/jndi.ps">JNDI API Document (Postscript)</a> <li><a href="ftp://ftp.javasoft.com/docs/j2se1.3/jndi.pdf">JNDI API Document (PDF)</a></ul><!--<h2>Related Documentation</h2>For more information on JNDI, please see:<ul> <li><a href="http://java.sun.com/products/jndi/tutorial">The JNDI Tutorial</a> <li><a href="http://java.sun.com/products/jndi/examples.html">Examples</a> <li><a href="ftp://ftp.javasoft.com/docs/j2se1.3/jndiexecsumm.ps">Executive Summary (Postscript)</a> <li><a href="ftp://ftp.javasoft.com/docs/j2se1.3/jndiexecsumm.pdf">Executive Summary (PDF)</a></ul>--><P><DL><DT><B>Since: </B><DD>1.3</DD></DL><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/naming/event/package-summary.html"><B>PREV PACKAGE</B></A> <A HREF="../../../javax/naming/spi/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="package-summary.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -