Interstage Application Server アプリケーション作成ガイド (イベントサービス編)
|
目次
索引

|
5.5 イベントチャネルのオブジェクトリファレンスの獲得
イベントチャネルのメソッドを呼び出すために、アプリケーションはイベントチャネルのオブジェクトリファレンスを獲得します。イベントチャネルのオブジェクトリファレンスは静的生成と動的生成により獲得の方法が異なります。
- 静的生成
- イベントチャネル生成コマンド(esmkchnlコマンド)によりオブジェクトリファレンスがネーミングサービスに登録されています。アプリケーションからネーミングサービスを使用して獲得します。
- 動的生成(イベントサービス)
- イベントファクトリのcreateメソッドの復帰値としてオブジェクトリファレンスを獲得します。
- 動的生成(ノーティフィケーションサービス)
- イベントチャネルを新規に生成する場合は、イベントファクトリのcreate_channelメソッドの復帰値としてオブジェクトリファレンスを獲得します。すでに生成されている場合は、イベントファクトリのget_event_channelメソッドの復帰値としてオブジェクトリファレンスを獲得します。
静的生成によりネーミングサービスに格納されているオブジェクトリファレンスの獲得の例を以下に示します。アプリケーションはネーミングサービスにチャネル名を問い合わせ、イベントチャネルを獲得します。例ではネーミングサービスから登録名「Group::Channel」のオブジェクトリファレンスを獲得します。
イベントサービスの場合
CosNaming_NamingContext cos_naming;
CORBA_Environment env;
CosNaming_Name name;
CosNaming_NameComponent name_component;
CosEventChannelAdmin_EventChannel event_ch;
name._length = name._maximum = 1;
name._buffer = &name_component;
name_component.id = "Group::Channel";
name_component.kind = "";
event_ch = (CosEventChannelAdmin_EventChannel)
CosNaming_NamingContext_resolve( cos_naming, &name, &env );
ノーティフィケーションサービスの場合
CosNaming_NamingContext cos_naming;
CORBA_Environment env;
CosNaming_Name name;
CosNaming_NameComponent name_component;
CosNotifyChannelAdmin_EventChannel event_ch;
name._length = name._maximum = 1;
name._buffer = &name_component;
name_component.id = "Group::Channel";
name_component.kind = "";
event_ch = (CosNotifyChannelAdmin_EventChannel)
CosNaming_NamingContext_resolve( cos_naming, &name, &env );
All Rights Reserved, Copyright(C) 富士通株式会社 2005