JavaTM Platform
Standard Ed. 6

org.omg.PortableInterceptor
インタフェース ORBInitializer

すべてのスーパーインタフェース:
IDLEntity, Object, ORBInitializerOperations, Serializable

public interface ORBInitializer
extends ORBInitializerOperations, Object, IDLEntity

インタセプタの登録と ORB の初期化を容易にします。

インタセプタにより、ORB サービスは ORB プロセスにアクセスして、効果的に ORB の一部になることができます。インタセプタは ORB の一部であるため、ORB.init が ORB を返すときは、インタセプタの登録が完了しています。ORB.init への呼び出しで返された後は、インタセプタはその ORB に登録できません。

インタセプタの登録は、ORBInitializer インタフェースを実装する関連付けられた ORBInitializer オブジェクトを登録する方法で行われます。ORB は、初期化しているときに、登録されている各 ORBInitializer を呼び出し、そのインタセプタの登録に使用される ORBInitInfo オブジェクトをそれに渡します。

Java で ORB 初期化子を登録する

ORBInitializers は、Java ORB プロパティーを経由して登録されます。

このプロパティー名は以下の形式をとります。

org.omg.PortableInterceptor.ORBInitializerClass.<Service>
<Service> は次のプロパティーを実装するクラスの文字列名です。
org.omg.PortableInterceptor.ORBInitializer
名前の衝突を防ぐため、逆方向の DNS 命名規則が使用されます。たとえば、X 社に初期化子が 3 つある場合、次のプロパティーを定義できます。 ORB.init の実行中は、org.omg.PortableInterceptor.ORBInitializerClass で始まるこれらの ORB プロパティーが収集され、各プロパティーの <Service> 部分が取り出され、クラス名に <Service> 文字列を使用してオブジェクトがインスタンス化され、そのオブジェクトに対して pre_initpost_init の各メソッドが呼び出されます。例外があっても ORB は無視して処理を行います。

たとえば、X 社が記述クライアント側のロギングサービスに次の ORBInitializer 実装があるとします。

 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. 
     } 
 } 
 
このロギングサービスを使用して MyApp というプログラムを実行する場合、ユーザーは次のように入力します。
java -Dorg.omg.PortableInterceptor.ORBInitializerClass.com.x.Logging.LoggingService MyApp

インタセプタ登録時の注意

要求インタセプタは、ORB ベースで登録されます。

オブジェクトごとの仮想インタセプタを実現するには、遮断点におけるターゲット上のポリシー問い合わせ、作業の必要性の有無を決定します。

POA ごとの仮想インタセプタを実現する場合は、各 POA を異なる ORB でインスタンス化してください。インタセプタは管理しやすいように順序付けられていますが、インタセプタの登録と順序は何の関係もありません。要求インタセプタではサービスのコンテキストが関連しています。サービスコンテキストには順番がないため、要求インタセプタに順番を付ける必要はありません。IOR インタセプタはタグ付きコンポーネントが関連しています。タグ付きコンポーネントにも順序付けがないので、IOR インタセプタに順序付けをすることは意味がありません。

登録コードでは ORB を使わないようにします。つまり、与えられた orb_idORB.init を呼び出さないようにします。ORB の初期化中に登録が発生するので、この状態でこの ORB を呼び出しても結果は定義されません。

関連項目:
ORBInitInfo

メソッドの概要
 
インタフェース org.omg.PortableInterceptor.ORBInitializerOperations から継承されたメソッド
post_init, pre_init
 
インタフェース org.omg.CORBA.Object から継承されたメソッド
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _is_a, _is_equivalent, _non_existent, _release, _request, _set_policy_override
 


JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。