インタフェースModelMBean
- すべてのスーパー・インタフェース:
DynamicMBean, ModelMBeanNotificationBroadcaster, NotificationBroadcaster, PersistentMBean
- 既知のすべての実装クラス:
RequiredModelMBean
管理対象になるJavaリソースは、MBeanServerのcreateMBeanメソッドを使って、ModelMBeanをインスタンス化します。 次に、ModelMBeanインスタンスのModelMBeanInfo (Descriptor付き)を設定します。 ModelMBeanのModelMBeanInfoで公開された属性とオペレーションには、MBean、コネクタ、アダプタからアクセスできます。 ModelMBeanInfo Descriptorを使って、管理対象アプリケーション内の値とメソッドを定義し、ModelMBeanの属性およびオペレーションにマップすることができます。 このマッピングは、XML形式のファイルを使った開発時、または実行時にプログラムを使って動的に定義できます。
ModelMBean内でインスタンス化される各ModelMBeanが管理対象になります。これらの属性およびオペレーションには、MBeanServerに接続されたコネクタまたはアダプタ経由でリモート・アクセスできます。 JMX準拠のMBeanでないJavaオブジェクトは、MBeanServerに登録できません。 リソースは、ModelMBeanをインスタンス化することにより、MBeanの有効性を保証します。
すべてのpublicメソッドで、MBeanExceptionおよびRuntimeOperationsExceptionがスローされる必要があります。 こうすることにより、分散型通信(RMI、EJBなど)による例外をラップできます。 仕様およびjavadocに記載されているシナリオ以外では、実装が必ずしもこれらの例外をスローするとは限りません。
- 導入されたバージョン:
- 1.5
-
メソッドのサマリー
修飾子と型メソッド説明voidsetManagedResource(Object mr, String mr_type) このModelMBean管理インタフェース(MBeanInfoとDescriptor)内のすべてのメソッドの実行先オブジェクトのインスタンス・ハンドルを設定します。voidsetModelMBeanInfo(ModelMBeanInfo inModelMBeanInfo) 渡されたModelMBeanInfoを使ってModelMBeanオブジェクトを初期化します。インタフェースで宣言されたメソッド DynamicMBean
getAttribute, getAttributes, getMBeanInfo, invoke, setAttribute, setAttributes修飾子と型メソッド説明getAttribute(String attribute) Dynamic MBeanの特定の属性の値を取得します。getAttributes(String[] attributes) Dynamic MBeanの複数の属性の値を取得します。MBeanInfoオブジェクトを使って、Dynamic MBeanの公開属性およびアクションを提供します。Dynamic MBean上でのアクションの呼出しを許可します。voidsetAttribute(Attribute attribute) Dynamic MBeanの特定の属性の値を設定します。setAttributes(AttributeList attributes) Dynamic MBeanの複数の属性の値を設定します。インタフェースで宣言されたメソッド ModelMBeanNotificationBroadcaster
addAttributeChangeNotificationListener, removeAttributeChangeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification修飾子と型メソッド説明voidaddAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) NotificationListenerインタフェースを実装するオブジェクトをリスナーとして登録します。voidremoveAttributeChangeNotificationListener(NotificationListener listener, String attributeName) RequiredModelMBeanからattributeChangeNotificationのリスナーを削除します。voidsendAttributeChangeNotification(AttributeChangeNotification notification) ModelMBean上の登録済みattributeChangeNotificationリスナーに渡されるattributeChangeNotificationを送信します。voidsendAttributeChangeNotification(Attribute oldValue, Attribute newValue) ModelMBean上の登録済みAttributeChangeNotificationリスナーに、属性の古い値と新しい値を含むattributeChangeNotificationを送信します。voidsendNotification(String ntfyText) ModelMBean上の登録済みNotificationリスナーに渡されるテキスト文字列を含むNotificationを送信します。voidsendNotification(Notification ntfyObj) ModelMBean上の登録済みNotificationリスナーに、jmx.modelmbean.generic通知として渡されるNotificationを送信します。インタフェースで宣言されたメソッド NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener修飾子と型メソッド説明voidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) このMBeanにリスナーを追加します。このMBeanが送信する可能性のある各通知について、その通知のJavaクラス名と通知タイプを示す配列を返します。voidこのMBeanからリスナーを削除します。インタフェースで宣言されたメソッド PersistentMBean
load, store
-
メソッドの詳細
-
setModelMBeanInfo
void setModelMBeanInfo(ModelMBeanInfo inModelMBeanInfo) throws MBeanException, RuntimeOperationsException 渡されたModelMBeanInfoを使ってModelMBeanオブジェクトを初期化します。 このメソッドを使用すると、ModelMBean上に、MBeanServerに登録されていないカスタムModelMBeanInfoを設定できます。
ModelMBeanのModelMBeanInfo (Descriptor付き)をカスタマイズし、ModelMBeanに設定したあと、ModelMBeanをMBeanServerに登録することができます。ModelMBeanが現在登録されている場合、このメソッドは
IllegalStateExceptionをラップするRuntimeOperationsExceptionをスローします。- パラメータ:
inModelMBeanInfo- ModelMBeanによって使用されるModelMBeanInfoオブジェクト。- スロー:
MBeanException- 分散通信Exceptionをラップする。RuntimeOperationsException-- パラメータとして渡されたMBeanInfoがnullの場合、
IllegalArgumentExceptionをラップする。 - ModelMBeanが現在MBeanServerに登録されている場合、
IllegalStateExceptionをラップする。
- パラメータとして渡されたMBeanInfoがnullの場合、
-
setManagedResource
void setManagedResource(Object mr, String mr_type) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException このModelMBean管理インタフェース(MBeanInfoとDescriptor)内のすべてのメソッドの実行先オブジェクトのインスタンス・ハンドルを設定します。- パラメータ:
mr- 管理対象のリソースになっているオブジェクトmr_type- 管理対象のリソースの参照の型。 ObjectReference、Handle、IOR、EJBHandle、RMIReferenceのいずれか。 MBeanServerが渡されたmr_typeを処理できない場合、InvalidTargetTypeExceptionがスローされる。- スロー:
MBeanException- オブジェクトのイニシャライザが例外をスローした場合。RuntimeOperationsException- IllegalArgumentExceptionをラップする場合: パラメータとして渡された管理対象のリソースの型がnullの場合。InstanceNotFoundException- 管理対象のリソース・オブジェクトが見つからない場合InvalidTargetObjectTypeException- 管理対象のリソースの型をModelMBeanまたはJMXエージェントで処理できない場合。
-