uTools-Manuals/docs/java/javax/naming/package-summary.html

388 lines
19 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<h1 class="title" title="Package">Package javax.naming</h1>
<div class="docSummary">
<div class="block">
提供用于访问命名服务的类和接口。
</div>
</div>
<p>See: <a href="#package.description">描述</a></p>
</div><div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Interface Summary table, listing interfaces, and an explanation">
<caption>
<span>接口摘要</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">接口</th>
<th class="colLast" scope="col">描述</th>
</tr>
</tbody>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/Context.html" title="interface in javax.naming">Context</a></td>
<td class="colLast">
<div class="block">
该接口表示一个命名上下文,它由一组名称对对象绑定组成。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/Name.html" title="interface in javax.naming">Name</a></td>
<td class="colLast">
<div class="block">
<tt>Name</tt>接口表示一个通用的名字-一个有序的组件序列。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/NameParser.html" title="interface in javax.naming">NameParser</a></td>
<td class="colLast">
<div class="block">
此接口用于从分层命名空间中解析名称。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/NamingEnumeration.html" title="interface in javax.naming">NamingEnumeration</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">
此接口用于枚举javax.naming和javax.naming.directory包中的方法返回的列表。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/Referenceable.html" title="interface in javax.naming">Referenceable</a></td>
<td class="colLast">
<div class="block">
该接口由可以为其自身提供引用的对象实现。
</div> </td>
</tr>
</tbody>
</table> </li>
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Class Summary table, listing classes, and an explanation">
<caption>
<span>类摘要</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col"></th>
<th class="colLast" scope="col">描述</th>
</tr>
</tbody>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/BinaryRefAddr.html" title="class in javax.naming">BinaryRefAddr</a></td>
<td class="colLast">
<div class="block">
该类表示通信端点的地址的二进制形式。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/Binding.html" title="class in javax.naming">Binding</a></td>
<td class="colLast">
<div class="block">
此类表示在上下文中找到的名称对对象绑定。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/CompositeName.html" title="class in javax.naming">CompositeName</a></td>
<td class="colLast">
<div class="block">
此类表示组合名称 - 跨多个命名空间的组件名称序列。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/CompoundName.html" title="class in javax.naming">CompoundName</a></td>
<td class="colLast">
<div class="block">
该类表示复合名称 - 来自分层名称空间的名称。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/InitialContext.html" title="class in javax.naming">InitialContext</a></td>
<td class="colLast">
<div class="block">
这个类是执行命名操作的起始上下文。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/LinkRef.html" title="class in javax.naming">LinkRef</a></td>
<td class="colLast">
<div class="block">
此类表示一个引用,其内容是名称,称为链接名称,该名称绑定到上下文中的原子名称。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/NameClassPair.html" title="class in javax.naming">NameClassPair</a></td>
<td class="colLast">
<div class="block">
此类表示在上下文中找到的绑定的对象名称和类名称对。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/RefAddr.html" title="class in javax.naming">RefAddr</a></td>
<td class="colLast">
<div class="block">
该类表示通信端点的地址。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/Reference.html" title="class in javax.naming">Reference</a></td>
<td class="colLast">
<div class="block">
此类表示对在命名/目录系统外部找到的对象的引用。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/StringRefAddr.html" title="class in javax.naming">StringRefAddr</a></td>
<td class="colLast">
<div class="block">
此类表示通信端点的地址的字符串形式。
</div> </td>
</tr>
</tbody>
</table> </li>
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" class="typeSummary" summary="Exception Summary table, listing exceptions, and an explanation">
<caption>
<span>异常摘要</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">异常</th>
<th class="colLast" scope="col">描述</th>
</tr>
</tbody>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/AuthenticationException.html" title="class in javax.naming">AuthenticationException</a></td>
<td class="colLast">
<div class="block">
访问命名或目录服务时发生身份验证错误时抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/AuthenticationNotSupportedException.html" title="class in javax.naming">AuthenticationNotSupportedException</a></td>
<td class="colLast">
<div class="block">
当不支持所请求的身份验证的特定风格时,会抛出此异常。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/CannotProceedException.html" title="class in javax.naming">CannotProceedException</a></td>
<td class="colLast">
<div class="block">
抛出此异常以指示操作达到操作无法继续进行的名称中的一个点。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/CommunicationException.html" title="class in javax.naming">CommunicationException</a></td>
<td class="colLast">
<div class="block">
当客户端无法与目录或命名服务通信时,抛出此异常。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/ConfigurationException.html" title="class in javax.naming">ConfigurationException</a></td>
<td class="colLast">
<div class="block">
出现配置问题时抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/ContextNotEmptyException.html" title="class in javax.naming">ContextNotEmptyException</a></td>
<td class="colLast">
<div class="block">
尝试销毁不为空的上下文时抛出此异常。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/InsufficientResourcesException.html" title="class in javax.naming">InsufficientResourcesException</a></td>
<td class="colLast">
<div class="block">
当资源不可用来完成请求的操作时,抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/InterruptedNamingException.html" title="class in javax.naming">InterruptedNamingException</a></td>
<td class="colLast">
<div class="block">
正在调用的命名操作已被中断时抛出此异常。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/InvalidNameException.html" title="class in javax.naming">InvalidNameException</a></td>
<td class="colLast">
<div class="block">
此异常表示指定的名称不符合命名系统的命名语法。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/LimitExceededException.html" title="class in javax.naming">LimitExceededException</a></td>
<td class="colLast">
<div class="block">
当方法由于用户或系统指定的限制而异常终止时,会抛出此异常。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/LinkException.html" title="class in javax.naming">LinkException</a></td>
<td class="colLast">
<div class="block">
此异常用于描述解决链接时遇到的问题。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/LinkLoopException.html" title="class in javax.naming">LinkLoopException</a></td>
<td class="colLast">
<div class="block">
当检测到循环将尝试解析链接时,抛出此异常,或已达到链接计数的实现特定限制。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/MalformedLinkException.html" title="class in javax.naming">MalformedLinkException</a></td>
<td class="colLast">
<div class="block">
当解决或构建链接时遇到格式错误的链接时抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/NameAlreadyBoundException.html" title="class in javax.naming">NameAlreadyBoundException</a></td>
<td class="colLast">
<div class="block">
通过方法抛出此异常,表示无法添加绑定,因为该名称已被绑定到另一个对象。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/NameNotFoundException.html" title="class in javax.naming">NameNotFoundException</a></td>
<td class="colLast">
<div class="block">
当名称的组件由于未绑定而无法解析时抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/NamingException.html" title="class in javax.naming">NamingException</a></td>
<td class="colLast">
<div class="block">
这是Context和DirContext接口中的操作抛出的所有异常的超类。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/NamingSecurityException.html" title="class in javax.naming">NamingSecurityException</a></td>
<td class="colLast">
<div class="block">
这是Context和DirContext接口中的操作抛出的与安全相关异常的超类。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/NoInitialContextException.html" title="class in javax.naming">NoInitialContextException</a></td>
<td class="colLast">
<div class="block">
当不能创建初始上下文实现时,抛出此异常。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/NoPermissionException.html" title="class in javax.naming">NoPermissionException</a></td>
<td class="colLast">
<div class="block">
尝试执行客户端没有权限的操作时抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/NotContextException.html" title="class in javax.naming">NotContextException</a></td>
<td class="colLast">
<div class="block">
当命名操作进行到需要上下文以继续操作的点时抛出此异常,但解析的对象不是上下文。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/OperationNotSupportedException.html" title="class in javax.naming">OperationNotSupportedException</a></td>
<td class="colLast">
<div class="block">
当上下文实现不支持正在调用的操作时,抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/PartialResultException.html" title="class in javax.naming">PartialResultException</a></td>
<td class="colLast">
<div class="block">
抛出此异常以指示到目前为止返回或返回的结果是部分的,并且该操作无法完成。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/ReferralException.html" title="class in javax.naming">ReferralException</a></td>
<td class="colLast">
<div class="block">
此抽象类用于表示引用异常该引用异常是响应于LDAP v3服务器返回的
<em>引用</em>而生成的。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/ServiceUnavailableException.html" title="class in javax.naming">ServiceUnavailableException</a></td>
<td class="colLast">
<div class="block">
尝试与目录或命名服务通信并且该服务不可用时,会抛出此异常。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../javax/naming/SizeLimitExceededException.html" title="class in javax.naming">SizeLimitExceededException</a></td>
<td class="colLast">
<div class="block">
当方法产生超过大小相关限制的结果时,抛出此异常。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../javax/naming/TimeLimitExceededException.html" title="class in javax.naming">TimeLimitExceededException</a></td>
<td class="colLast">
<div class="block">
当方法不在指定的时间限制内终止时,抛出此异常。
</div> </td>
</tr>
</tbody>
</table> </li>
</ul>
<a name="package.description">
<!-- --> </a>
<h2 title="Package javax.naming Description">Package javax.naming Description</h2>
<div class="block">
Provides the classes and interfaces for accessing naming services.
<p> This package defines the naming operations of the Java Naming and Directory Interface<font size="-2"><sup>TM</sup></font> (JNDI).   JNDI provides naming and directory functionality to applications written in the Java programming language. It is designed to be independent of any specific naming or directory service implementation. Thus a variety of services--new, emerging, and already deployed ones--can be accessed in a common way. </p>
<h4>Context</h4>
<p> This package defines the notion of a <em>context</em>, represented by the <tt>Context</tt> interface. A context consists of a set of name-to-object <em>bindings</em>. <tt>Context</tt> is the core interface for looking up, binding, unbinding, and renaming objects, and for creating and destroying subcontexts. </p>
<p> <tt>lookup()</tt> is the most commonly used operation. You supply <tt>lookup()</tt> the name of the object you want to look up, and it returns the object bound to that name. For example, the following code fragment looks up a printer and sends a document to the printer object to be printed: </p>
<blockquote>
<pre>
Printer printer = (Printer)ctx.lookup("treekiller");
printer.print(report);
</pre>
</blockquote>
<h4>Names</h4>
<p> Every naming method in the <tt>Context</tt> interface has two overloads: one that accepts a <tt>Name</tt> argument and one that accepts a string name. <tt>Name</tt> is an interface that represents a generic name--an ordered sequence of zero of more components. For these methods, <tt>Name</tt> can be used to represent a <em>composite name</em> (<tt>CompositeName</tt>) so that you can name an object using a name which spans multiple namespaces. </p>
<p> The overloads that accept <tt>Name</tt> are useful for applications that need to manipulate names: composing them, comparing components, and so on. The overloads that accept string names are likely to be more useful for simple applications, such as those that simply read in a name and look up the corresponding object. </p>
<p> </p>
<h4>Bindings</h4> The
<tt>Binding</tt> class represents a name-to-object binding. It is a tuple containing the name of the bound object, the name of the object's class, and the object itself.
<p> The <tt>Binding</tt> class is actually a subclass of <tt>NameClassPair</tt>, which consists simply of the object's name and the object's class name. The <tt>NameClassPair</tt> is useful when you only want information about the object's class and do not want to pay the extra cost of getting the object. </p>
<h4>References</h4> Objects are stored in naming and directory services in different ways. If an object store supports storing Java objects, it might support storing an object in its serialized form. However, some naming and directory services do not support the storing of Java objects. Furthermore, for some objects in the directory, Java programs are but one group of applications that access them. In this case, a serialized Java object might not be the most appropriate representation. JNDI defines a
<em>reference</em>, represented by the
<tt>Reference</tt> class, which contains information on how to construct a copy of the object. JNDI will attempt to turn references looked up from the directory into the Java objects they represent, so that JNDI clients have the illusion that what is stored in the directory are Java objects.
<h4>The Initial Context</h4> In JNDI, all naming and directory operations are performed relative to a context. There are no absolute roots. Therefore JNDI defines an
<em>initial context</em>,
<tt>InitialContext</tt>, which provides a starting point for naming and directory operations. Once you have an initial context, you can use it to look up other contexts and objects.
<h4>Exceptions</h4> JNDI defines a class hierarchy for exceptions that can be thrown in the course of performing naming and directory operations. The root of this class hierarchy is
<tt>NamingException</tt>. Programs interested in dealing with a particular exception can catch the corresponding subclass of the exception. Otherwise, programs should catch
<tt>NamingException</tt>.
<h2>Package Specification</h2> The JNDI API Specification and related documents can be found in the
<a href="../../../technotes/guides/jndi/index.html">JNDI documentation</a>.
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.3
</dd>
</dl>
</div>