カスタム Common Base Event コンテンツ・ハンドラーまたはテンプレートを作成して、特定のイベントの構成または値を自動化します。
始める前に
コンテンツ・ハンドラー は、使用する任意のポリシーに基づいた各イベントのプロパティー値を自動的に設定するオブジェクトです。
WebSphere®
Application Server には以下のコンテンツ・ハンドラー・クラスが追加され、Common
Base Event インフラストラクチャーの使用が容易になりました。
クラス名 |
説明 |
WsContentHandlerImpl |
これは、WebSphere Application Server 環境専用に使用される org.eclipse.hyades.logging.events.cbe.ContentHandler の実装を提供しています。このコンテンツ・ハンドラーは、WebSphere
Application Server ランタイムの情報を使用して Common Base Event を完了し、ロギング対象の
Common Base
Event が完了する際に WebSphere
Application Server が内部で使用するコンテンツ・ハンドラーと同じものを使用します。 |
WsTemplateContentHandlerImpl |
これは、WsContentHandlerImpl と同じ機能を提供していますが、
org.eclipse.hyades.logging.events.cbe.impl.TemplateContentHandlerImpl クラスを拡張すると Common Base Event テンプレートが使用できるようになります。
テンプレート・データが WsContentHandlerImpl と同じ Common Base Event フィールドに値を指定する場合、テンプレートのコンテンツが優先されます。 |
このタスクについて
状況によっては、作成したすべてのイベント用の
イベント・プロパティー・データを自動的に設定することができます。
この自動化は、アプリケーション名など変化しない特定の標準値を入力する場合や、作成時間やスレッド情報などのランタイム環境から
使用可能な情報に基づくプロパティーの一部を設定する場合に役立ちます。
プロパティー・データを自動的に設定するには、コンテンツ・ハンドラーを作成します。
手順
- CustomContentHandler クラスを実装するには、以下のコード例を使用してください。
public class CustomContentHandler extends WsContentHandlerImpl {
public CustomContentHandler() {
super();
// TODO Custom initialization code goes here
}
public void completeEvent(CommonBaseEvent cbe) throws CompletionException {
// following code will add WAS content to the Content Base Event
super.completeEvent(cbe);
// TODO Custom content can be added to the Content Base Event here
}
}
- CustomTemplateContentHandler クラスの実装方法を次に示します。
public class CustomTemplateContentHandler extends WsTemplateContentHandlerImpl {
public CustomTemplateContentHandler() {
super();
// TODO Custom initialization code goes here
}
public void completeEvent(CommonBaseEvent cbe) throws CompletionException {
// following code will add WAS content to the Content Base Event
super.completeEvent(cbe);
// TODO Custom content can be added to the Content Base Event here
}
}
タスクの結果
指定の設定に基づいたコンテンツ・ハンドラーまたはカスタム・コンテンツ・ハンドラー・テンプレートが作成されます。