|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
public interface ModelMBeanNotificationBroadcaster
ModelMBean は、このインタフェースを実装する必要があります。このインタフェースの実装は、すべての JMX エージェントに付属しています。
管理対象になる Java リソースは、MBeanServer の createMBean メソッドを使って、ModelMBean をインスタンス化します。次に、ModelMBean インスタンスの ModelMBeanInfo (Descriptor 付き) を設定します。ModelMBean の ModelMBeanInfo で公開された属性とオペレーションには、MBean、コネクタ、アダプタからアクセスできます。ModelMBeanInfo Descriptor を使って、管理対象アプリケーション内の値とメソッドを定義し、ModelMBean の属性およびオペレーションにマップすることができます。このマッピングは、XML 形式のファイルを使った開発時、または実行時にプログラムを使って動的に定義できます。
MBeanServer でインスタンス化された MBean はすべて管理対象となります。これらの属性およびオペレーションには、MBeanServer に接続されたコネクタまたはアダプタ経由でリモートアクセスできます。JMX 準拠の MBean でない Java オブジェクトは、MBeanServer に登録できません。リソースは、ModelMBean をインスタンス化することにより、MBean の有効性を保証します。
すべての public メソッドで、MBeanException および RuntimeOperationsException がスローされる必要があります。こうすることにより、分散型通信 (RMI、EJB など) による例外をラップできます。仕様および javadoc に記載されているシナリオ以外では、実装が必ずしもこれらの例外をスローするとは限りません。
| メソッドの概要 | |
|---|---|
void |
addAttributeChangeNotificationListener(NotificationListener listener,
String attributeName,
Object handback)
NotificationListener インタフェースを実装するオブジェクトをリスナーとして登録します。 |
void |
removeAttributeChangeNotificationListener(NotificationListener listener,
String attributeName)
RequiredModelMBean から attributeChangeNotification のリスナーを削除します。 |
void |
sendAttributeChangeNotification(Attribute oldValue,
Attribute newValue)
ModelMBean 上の登録済み AttributeChangeNotification リスナーに、属性の古い値と新しい値を含む attributeChangeNotification を送信します。 |
void |
sendAttributeChangeNotification(AttributeChangeNotification notification)
ModelMBean 上の登録済み attributeChangeNotification リスナーに渡される attributeChangeNotification を送信します。 |
void |
sendNotification(Notification ntfyObj)
ModelMBean 上の登録済み Notification リスナーに、jmx.modelmbean.generic 通知として渡される Notification を送信します。 |
void |
sendNotification(String ntfyText)
ModelMBean 上の登録済み Notification リスナーに渡されるテキスト文字列を含む Notification を送信します。 |
| インタフェース javax.management.NotificationBroadcaster から継承されたメソッド |
|---|
addNotificationListener, getNotificationInfo, removeNotificationListener |
| メソッドの詳細 |
|---|
void sendNotification(Notification ntfyObj)
throws MBeanException,
RuntimeOperationsException
ntfyObj - リスナーオブジェクトの handleNotification メソッドに渡される通知
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - IllegalArgumentException をラップする。パラメータとして渡された Notification オブジェクトが null の場合
void sendNotification(String ntfyText)
throws MBeanException,
RuntimeOperationsException
ntfyText - Notification に指定され、 リスナーオブジェクトの handleNotification メソッドに渡されるテキスト。構築済みの Notification を次に示す。type "jmx.modelmbean.generic" source この ModelMBean インスタンス sequence 1
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - IllegalArgumentException をラップする。パラメータとして渡された Notification テキスト文字列が null の場合
void sendAttributeChangeNotification(AttributeChangeNotification notification)
throws MBeanException,
RuntimeOperationsException
notification - リスナーオブジェクトの handleNotification メソッドに渡される通知
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - IllegalArgumentException をラップする。パラメータとして渡された AttributeChangeNotification オブジェクトが null の場合
void sendAttributeChangeNotification(Attribute oldValue,
Attribute newValue)
throws MBeanException,
RuntimeOperationsException
oldValue - Attribute の初期値newValue - Attribute の現在の値
構築済みの attributeChangeNotification。 type "jmx.attribute.change" source この ModelMBean インスタンス sequence 1 attributeName oldValue.getName() attributeType oldValue のクラス attributeOldValue oldValue.getValue() attributeNewValue newValue.getValue()
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - IllegalArgumentException をラップする。パラメータとして渡される Attribute オブジェクトが null である場合、またはパラメータに同じ名前の Attribute オブジェクトが複数指定された場合
void addAttributeChangeNotificationListener(NotificationListener listener,
String attributeName,
Object handback)
throws MBeanException,
RuntimeOperationsException,
IllegalArgumentException
listener - 登録済み MBean が発行した通知を処理するリスナーオブジェクトattributeName - ModelMBean 属性の名前。この属性の変更通知を受信する。null の場合、どの属性が変更されたときも attributeChangeNotification が発行されるhandback - 通知が発行されたとき通知とともにリスナーに送信されるコンテキスト
IllegalArgumentException - リスナーは null にできない
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - IllegalArgumentException をラップする。パラメータとして渡される属性名が存在しない場合removeAttributeChangeNotificationListener(javax.management.NotificationListener, java.lang.String)
void removeAttributeChangeNotificationListener(NotificationListener listener,
String attributeName)
throws MBeanException,
RuntimeOperationsException,
ListenerNotFoundException
listener - 登録済み MBean が発行した通知を処理していたリスナーの名前。このメソッドはこのリスナーに関するすべての情報を削除するattributeName - 属性。リスナーは、この属性の attributeChangeNotification を受信する必要がなくなった。null の場合、すべての attributeChangeNotification のリスナーが削除される
ListenerNotFoundException - リスナーが MBean に登録されていないか、null の場合
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - inAttributeName パラメータが属性名に一致しない場合、 IllegalArgumentException をラップする。addAttributeChangeNotificationListener(javax.management.NotificationListener, java.lang.String, java.lang.Object)
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。