| 
 | JavaTM 2 Platform Standard Ed. 5.0 | |||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
public interface ORBInitializer
インタセプタの登録と ORB の初期化を容易にします。
インタセプタは、ORB サービスが ORB 処理にアクセスして、事実上 ORB の一部になるための手段となるよう意図されています。インタセプタは ORB の一部であるため、ORB.init が ORB を返すときは、インタセプタの登録が完了しています。ORB.init の呼び出しによって ORB が返されたあとでインタセプタを ORB に登録することはできません。
 
インタセプタの登録は、ORBInitializer インタフェースを実装する関連付けられた ORBInitializer オブジェクトを登録する方法で行われます。ORB は、初期化しているときに、登録されている各 ORBInitializer を呼び出し、そのインタセプタの登録に使用される ORBInitInfo オブジェクトをそれに渡します。
 
Java で ORB 初期化子を登録する
ORBInitializers は、Java ORB プロパティを経由して登録されます。
プロパティ名は、以下の形式をとります。
 org.omg.PortableInterceptor.ORBInitializerClass.<Service> <Service> は、次のプロパティを実装するクラスの文字列名です。 org.omg.PortableInterceptor.ORBInitializer org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init1 org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init2 org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init3org.omg.PortableInterceptor.ORBInitializerClass で始まる ORB プロパティが収集され、それぞれのプロパティから <Service> の部分が抽出され、オブジェクトはクラス名として <Service> 文字列でインスタンスが生成され、そのオブジェクトで pre_init メソッドと post_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_id を指定して ORB.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 2 Platform Standard Ed. 5.0 | |||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。