デフォルト・イベント・ファクトリーを使用した Common Base Event コンテンツの生成

デフォルトの Common Base Event コンテンツ・ハンドラーは、 WebSphere® Application Server のランタイム情報によって Common Base Event を取り込みます。 このコンテンツ・ハンドラーは、 Common Base Event テンプレートを使用して、Common Base Event にデータを取り込むことも できます。

デフォルトのコンテンツ・ハンドラーは、以下の例に示すように、サーバーが CommonBaseEventLogRecords を作成する際に使用されます。
// Get a named logger
Logger logger = Logger.getLogger("com.ibm.someLogger");
// Log to the logger -- implicitly the default content handler
// will be associated with the CommonBaseEvent contained in the
// CommonBaseEventLogRecord. logger.warning("MSG_KEY_001");
前記の例で Common Base Event テンプレートを指定するには、com.ibm.someLogger のイベント・ファクトリー・エントリーを持つ Logger.properties ファイルを指定する必要があります。 クラスパスで有効なテンプレートが検出された場合、ロガーのイベント・ファクトリー は、Common Base Event の取り込み時に、WebSphere Application Server のランタイム情報の他に、指定されたテンプレートのコンテンツも使用します。 テンプレートがクラスパスで検出されなかったり、無効だったりした場合、ロガーのイベント・ ファクトリーは、Common Base Event を取り込む 際に、WebSphere Application Server ランタイム情報 のみを使用します。
デフォルトのコンテンツ・ハンドラーは、グローバル・イベント・ファクトリー・コンテキストに指定されているイベント・ファクトリー・ホームにも関連付けられています。 これは、WebSphere Application Server で生成されるコンテンツと似たコンテンツを使用して取り込む必要のある Common Base Event を 作成する場合に便利です。
// Request the event factory from the global event factory home
EventFactory eventFactory =
   EventFactoryContext.getInstance().getEventFactoryHome().getEventFactory(templateName);

// Create a Common Base Event
CommonBaseEvent commonBaseEvent = eventFactory.createCommonBaseEvent();

// Complete the Common Base Event using content from the template (if specified previously)
// and the server runtime information.
eventFactory.getContentHandler().completeEvent(commonBaseEvent);
前記の例 では、templateName によって参照されるテンプレートがクラスパスで検出 され、そのテンプレートが有効な場合、イベント・ファクトリー・ホームは、Common Base Event を取り込む際に、テンプレートのコンテンツと WebSphere Application Server のランタイム 情報とを組み合わせるコンテンツ・ハンドラーを使用するイベント・ファクトリーを戻します。 テンプレートがクラスパスで検出されなかったり無効だったりした場合、イベント・ファクトリー・ホーム は、Common Base Event を取り込む際に、WebSphere Application Server のランタイム情報のみを利用するコンテンツ・ハンドラーを使用する イベント・ファクトリーを戻します。

デフォルトのコンテンツ・ハンドラーは、サーバー環境内の Common Base Event に以下のランタイム情報を取り込みます。

CommonBaseEvent.globalInstanceId
値: unique_record_id

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.globalInstanceId 値が NULL の場合のみ設定します。

CommonBaseEvent.msg
値: MsgDataElement エレメントを基にしたローカライズされたメッセージ。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.msg メッセージが NULL の場合のみ設定します。

CommonBaseEvent.severity
値: CommonBaseEventLogRecord レコード上に設定されたレベルの値を基にして 設定します (level >= Level.SEVERE の場合 50 に設定、level >= Level.WARNING の場合 30 に設定、デフォルトでは 10 に設定)。

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.severity 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.component
値: CommonBaseEventLogRecord レコード上に設定された LoggerName 値を基にして設定します。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.component が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.componentIdType
値: "Unknown"

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.componentIdType 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.executionEnvironment
値: OSname[OSarch]#OSversion

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.executionEnvironment 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.instanceId
値: cellName¥nodeName¥serverName

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.ComponentIdentification.instanceId 値が NULL の場合のみ設定します。 この値はクライアント・アプリケーションでは無視されるため、サーバー環境のみで設定してください。

CommonBaseEvent.ComponentIdentification.location
値: ホスト名

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.location と CommonBaseEvent.ComponentIdentification.locationType の両方の値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.locationType
値: ホスト名

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.location と CommonBaseEvent.ComponentIdentification.locationType の両方の値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.processId
値: 内部で生成されたプロセス・ナンバー表記。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.processId 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.subComponent
値: CommonBaseEventLogRecord レコードの sourceClassName.sourceMethodName 名上に設定された sourceClassName 名および sourceMethodName 名の値に基づいて設定します。

この値は、completeEvent メソッドが呼び出される前、および sourceClassName 名と sourceMethodName 名の両方が設定される前に、CommonBaseEvent.ComponentIdentification.subComponent 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.threadId
値: Java™ 仮想マシン (JVM) のスレッド名の値に設定します。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.ComponentIdentification.threadId 値が NULL の場合のみ設定します。

CommonBaseEvent.ComponentIdentification.componentType
値: http://www.ibm.com/namespaces/autonomic/WebSphereApplicationServer

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.ComponentIdentification.componentType 値が NULL の場合のみ設定します。

CommonBaseEvent.MsgDataElement.msgLocale
値: JVM のデフォルト・ロケールを基にして設定します。

この値は、completeEvent メソッドが呼び出される前に、 CommonBaseEvent.msg 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.categoryName
値: ReportSituation

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.situationType.type
値: ReportSituation

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.situationType.reasoningScope
値: EXTERNAL

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

CommonBaseEvent.Situation.situationType.reportCategory
値: LOG

この値は、completeEvent メソッドが呼び出される前に、CommonBaseEvent.Situation 値が NULL の場合のみ設定します。

コンテンツ・ハンドラーで completeEvent メソッドが呼び出されたときに、reporterComponentIdentification ID が存在しない場合、sourceComponentIdentification 値が取り込まれます。 それ以外の場合は、reporterComponentIdentification ID が代わりに取り込まれます。


トピックのタイプを示すアイコン 参照トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rtrb_cbegencontent
ファイル名:rtrb_cbegencontent.html