84 lines
8.1 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">
<div class="subTitle">
org.omg.PortableInterceptor
</div>
<h2 class="title" title="Interface ORBInitializer">Interface ORBInitializer</h2>
</div><div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>
All Superinterfaces:
</dt>
<dd>
<span><a href="../../../org/omg/CORBA/portable/IDLEntity.html" title="界面在org.omg.CORBA.portable中">IDLEntity</a> <a href="../../../org/omg/CORBA/Object.html" title="在org.omg.CORBA中的接口">Object</a> <a href="../../../org/omg/PortableInterceptor/ORBInitializerOperations.html" title="在org.omg.PortableInterceptor中的接口">ORBInitializerOperations</a> <a href="../../../java/io/Serializable.html" title="java.io中的接口">Serializable</a></span>
</dd>
</dl>
<hr/> <br/> <pre>public interface <span class="typeNameLabel">ORBInitializer</span>
extends <a href="../../../org/omg/PortableInterceptor/ORBInitializerOperations.html" title="interface in org.omg.PortableInterceptor">ORBInitializerOperations</a>, <a href="../../../org/omg/CORBA/Object.html" title="interface in org.omg.CORBA">Object</a>, <a href="../../../org/omg/CORBA/portable/IDLEntity.html" title="interface in org.omg.CORBA.portable">IDLEntity</a></pre>
<div class="block">
<span>方便拦截器注册和ORB初始化。</span>
<p> <span>拦截器旨在成为ORB服务获得ORB处理的一种手段有效地成为ORB的一部分。</span> <span>由于拦截器是ORB的一部分<code>ORB.init</code>返回ORB时拦截器已被注册。</span> <span>在通过电话<code>ORB.init</code>返回后拦截器无法在ORB上<code>ORB.init</code></span> </p>
<p> <span>通过注册实现ORBInitializer接口的相关联的<code>ORBInitializer</code>对象来注册<code>ORBInitializer</code>器。</span> <span>当在初始化ORB应当调用每个注册<code>ORBInitializer</code> ,传递一个<code>ORBInitInfo</code>其用于登记其拦截器对象。</span> </p>
<p> <span><b>在Java中注册ORB初始化器</b></span> </p>
<p> <span>ORBInitializers通过Java ORB属性注册。</span> </p>
<p> <span>财产名称的格式如下:</span> </p>
<blockquote>
<span><code> org.omg.PortableInterceptor.ORBInitializerClass.&lt;Service&gt; </code></span>
</blockquote>
<span>其中<code>&lt;Service&gt;</code>是实现的类的字符串名称</span>
<blockquote>
<span><code> org.omg.PortableInterceptor.ORBInitializer </code></span>
</blockquote>
<span>为避免名称冲突应使用反向DNS名称约定。</span>
<span>例如如果X公司有三个初始化器它可以定义以下属性</span>
<ul>
<li> <code>org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init1</code> </li>
<li> <code>org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init2</code> </li>
<li> <code>org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init3</code> </li>
</ul>
<span>在ORB.init期间收集以<code>org.omg.PortableInterceptor.ORBInitializerClass</code>开头的ORB属性 <code>&lt;Service&gt;</code>每个属性的<code>&lt;Service&gt;</code>部分,对象应以<code>&lt;Service&gt;</code>字符串作为其类别名称进行<code>pre_init</code> ,并应调用<code>pre_init</code><code>post_init</code>方法那个对象。</span>
<span>如果有任何例外ORB将忽略它们并继续进行。</span>
<p> <span><b><i></i></b></span> </p>
<p> <span>例如由公司X编写的客户端日志服务可能具有以下ORBInitializer实现 <code></code></span> </p>
<pre> <span><code> package com.x.logging; import org.omg.PortableInterceptor.Interceptor; import org.omg.PortableInterceptor.ORBInitializer; import org.omg.PortableInterceptor.ORBInitInfo; public class LoggingService implements ORBInitializer { void pre_init( ORBInitInfo info ) { // Instantiate the Logging Service s Interceptor. Interceptor interceptor = new LoggingInterceptor(); // Register the Logging Service s Interceptor. info.add_client_request_interceptor( interceptor ); } void post_init( ORBInitInfo info ) { // This service does not need two init points. } } </code></span> </pre>
<span>要使用此日志记录服务运行一个名为<code>MyApp</code>的程序,用户可以键入:</span>
<blockquote>
<span><code> java -Dorg.omg.PortableInterceptor.ORBInitializerClass.com.x.Logging.LoggingService MyApp </code></span>
</blockquote>
<p> <span><b>关于注册拦截器的注意事项</b></span> </p>
<p> <span>请求拦截器以每ORB的形式进行注册。</span> </p>
<p> <span>要实现虚拟的每个对象拦截器,从截取点内查询目标上的策略,以确定它们是否应该做任何工作。</span> </p>
<p> <span>为了实现虚拟的每个POA拦截器用不同的ORB实例化每个POA。</span> <span>虽然拦截器可能被行政命令,但是关于拦截器的注册没有关于秩序的概念。</span> <span>请求拦截器涉及服务环境。</span> <span>服务上下文没有任何命令,因此请求拦截器无需订单。</span> <span>IOR拦截器涉及标记的组件。</span> <span>标签组件也没有任何命令因此IOR Interceptor不能有订单。</span> </p>
<p> <span>注册代码应该避免使用ORB主叫<code>ORB.init</code>与所提供的<code>orb_id</code> )。</span> <span>由于在ORB初始化期间发生注册因此在此ORB处于此状态时调用的结果未定义。</span> </p>
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<span><a href="../../../org/omg/PortableInterceptor/ORBInitInfo.html" title="在org.omg.PortableInterceptor中的接口"><code>ORBInitInfo</code></a></span>
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.omg.PortableInterceptor.ORBInitializerOperations">
<!-- --> </a> <h3>Methods inherited from interface org.omg.PortableInterceptor.<a href="../../../org/omg/PortableInterceptor/ORBInitializerOperations.html" title="interface in org.omg.PortableInterceptor">ORBInitializerOperations</a></h3> <code><a href="../../../org/omg/PortableInterceptor/ORBInitializerOperations.html#post_init-org.omg.PortableInterceptor.ORBInitInfo-">post_init</a>, <a href="../../../org/omg/PortableInterceptor/ORBInitializerOperations.html#pre_init-org.omg.PortableInterceptor.ORBInitInfo-">pre_init</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.omg.CORBA.Object">
<!-- --> </a> <h3>Methods inherited from interface org.omg.CORBA.<a href="../../../org/omg/CORBA/Object.html" title="interface in org.omg.CORBA">Object</a></h3> <code><a href="../../../org/omg/CORBA/Object.html#Z:Z_create_request-org.omg.CORBA.Context-java.lang.String-org.omg.CORBA.NVList-org.omg.CORBA.NamedValue-">_create_request</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_create_request-org.omg.CORBA.Context-java.lang.String-org.omg.CORBA.NVList-org.omg.CORBA.NamedValue-org.omg.CORBA.ExceptionList-org.omg.CORBA.ContextList-">_create_request</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_duplicate--">_duplicate</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_get_domain_managers--">_get_domain_managers</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_get_interface_def--">_get_interface_def</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_get_policy-int-">_get_policy</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_hash-int-">_hash</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_is_a-java.lang.String-">_is_a</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_is_equivalent-org.omg.CORBA.Object-">_is_equivalent</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_non_existent--">_non_existent</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_release--">_release</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_request-java.lang.String-">_request</a>, <a href="../../../org/omg/CORBA/Object.html#Z:Z_set_policy_override-org.omg.CORBA.Policy:A-org.omg.CORBA.SetOverrideType-">_set_policy_override</a></code></li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>