JavaTM Platform
Standard Ed. 6

javax.management.modelmbean
インタフェース ModelMBeanInfo

既知の実装クラスの一覧:
ModelMBeanInfoSupport

public interface ModelMBeanInfo

ModelMBeanInfo は、ModelMBean ごとにこのインタフェースを実装する必要があります。このインタフェースの実装は、すべての JMX エージェントに付属しています。

管理対象になる Java リソースは、MBeanServer の createMBean メソッドを使って、ModelMBean をインスタンス化します。次に、ModelMBean インスタンスの ModelMBeanInfo と Descriptor を設定します。ModelMBean の ModelMBeanInfo で公開された属性、オペレーション、および通知は管理インタフェースを構成します。 これらには、MBean、コネクタ、アダプタからアクセスできます。Descriptor を使って、管理対象アプリケーション内の値とメソッドを定義し、ModelMBean の属性およびオペレーションにマップすることができます。このマッピングは、ファイルを使った開発時、または実行時にプログラムを使って動的に定義できます。

MBeanServer でインスタンス化された MBean はすべて管理対象となります。これらの MBean の属性、オペレーション、および通知には、MBeanServer に接続されたコネクタまたはアダプタ経由でリモートアクセスできます。JMX 準拠の MBean でない Java オブジェクトは、MBeanServer に登録できません。リソースは、ModelMBean をインスタンス化することにより、MBean の有効性を保証します。 すべての public メソッドで、MBeanException および RuntimeOperationsException がスローされる必要があります。これにより、分散型通信 (RMI、EJB など) からの例外のラップが可能になります。

導入されたバージョン:
1.5

メソッドの概要
 Object clone()
          このオブジェクトのコピーを作成して、返します。
 ModelMBeanAttributeInfo getAttribute(String inName)
          名前で要求された ModelMBeanAttributeInfo を返します。
 MBeanAttributeInfo[] getAttributes()
          管理用の公開属性のリストを返します。
 String getClassName()
          この MBeanInfo によって記述された MBean の Java クラスの名前を返します。
 MBeanConstructorInfo[] getConstructors()
          MBean の public コンストラクタのリストを返します。
 String getDescription()
          人間が読める形式の MBean の説明を返します。
 Descriptor getDescriptor(String inDescriptorName, String inDescriptorType)
          名前と descriptorType で要求された Descriptor を返します。
 Descriptor[] getDescriptors(String inDescriptorType)
          inDescriptorType 型の ModelMBeanInfo のすべての Descriptor で構成される Descriptor 配列を返します。
 Descriptor getMBeanDescriptor()
          MBean 全体ポリシーを含む ModelMBean の記述子を返します。
 ModelMBeanNotificationInfo getNotification(String inName)
          名前で要求された ModelMBeanNotificationInfo を返します。
 MBeanNotificationInfo[] getNotifications()
          MBean によって発行された通知のリストを返します。
 ModelMBeanOperationInfo getOperation(String inName)
          名前で要求された ModelMBeanOperationInfo を返します。
 MBeanOperationInfo[] getOperations()
          MBean のオペレーションのリストを返します。
 void setDescriptor(Descriptor inDescriptor, String inDescriptorType)
          ModelMBean の inDescriptorType 型の情報配列内に記述子を設定します。
 void setDescriptors(Descriptor[] inDescriptors)
          ModelMBeanInfo に記述子を追加するか、ModelMBeanInfo 内の記述子を置き換えます。
 void setMBeanDescriptor(Descriptor inDescriptor)
          ModelMBean の記述子を設定します。
 

メソッドの詳細

getDescriptors

Descriptor[] getDescriptors(String inDescriptorType)
                            throws MBeanException,
                                   RuntimeOperationsException
inDescriptorType 型の ModelMBeanInfo のすべての Descriptor で構成される Descriptor 配列を返します。

パラメータ:
inDescriptorType - 返される記述子に対して設定する必要がある descriptorType フィールドの値。mbean、attribute、operation、constructor、notification のいずれか。 null または空の場合、すべての型が返される
戻り値:
型が inDescriptorType の場合、この ModelMBean のすべての記述子を含む記述子配列
例外:
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - パラメータとして渡された descriptorType が mbean、attribute、operation、constructor、notification のいずれでもない場合、 空の場合、または null の場合、IllegalArgumentException をラップする
関連項目:
setDescriptors(javax.management.Descriptor[])

setDescriptors

void setDescriptors(Descriptor[] inDescriptors)
                    throws MBeanException,
                           RuntimeOperationsException
ModelMBeanInfo に記述子を追加するか、ModelMBeanInfo 内の記述子を置き換えます。

パラメータ:
inDescriptors - ModelMBeanInfo 内に設定される記述子。リストの null 要素は 無視される。すべての記述子が name および descriptorType フィールドを持っている必要がある
例外:
RuntimeOperationsException - 記述子が null または不正な場合、IllegalArgumentException をラップする
MBeanException - 分散通信 Exception をラップする
関連項目:
getDescriptors(java.lang.String)

getDescriptor

Descriptor getDescriptor(String inDescriptorName,
                         String inDescriptorType)
                         throws MBeanException,
                                RuntimeOperationsException
名前と descriptorType で要求された Descriptor を返します。

パラメータ:
inDescriptorName - 記述子の名前
inDescriptorType - 要求される記述子の 型。null または空の場合、 すべての型が検索される。有効な型は、mbean、attribute、constructor、 operation、および notification。この値は、 返される記述子の descriptorType フィールドと等しくなる
戻り値:
同じ名前および descriptorType の ModelMBean の記述子を 含む記述子。記述子が見つからない場合、 null が返される
例外:
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - 記述子名が null であるか、型が null または不正な場合、IllegalArgumentException をラップする。 型は、mbean、attribute、constructor、operation、notification のいずれかでなければならない
関連項目:
setDescriptor(javax.management.Descriptor, java.lang.String)

setDescriptor

void setDescriptor(Descriptor inDescriptor,
                   String inDescriptorType)
                   throws MBeanException,
                          RuntimeOperationsException
ModelMBean の inDescriptorType 型の情報配列内に記述子を設定します。指定された記述子を設定するため、対応する ModelMBean*Info の setDescriptor メソッドが呼び出されます。

パラメータ:
inDescriptor - ModelMBean 内に設定される 記述子。null 以外でなければならない。すべての記述子が name および descriptorType フィールドを 持っている必要がある
inDescriptorType - 設定される記述子の 型。null の場合、記述子の descriptorType フィールドが 使用される。指定されている場合、この値が記述子の descriptorType フィールドに 設定されなければならない。mbean、attribute、constructor、 operation、 notification のいずれか
例外:
RuntimeOperationsException - 引数が不正または null である場合、 または対応する MBeanAttributeInfo、 MBeanConstructorInfo、 MBeanNotificationInfo、 MBeanOperationInfo のいずれかで
MBeanException - 記述子の name フィールドが見つからない場合、 IllegalArgumentException をラップする
関連項目:
getDescriptor(java.lang.String, java.lang.String)

getMBeanDescriptor

Descriptor getMBeanDescriptor()
                              throws MBeanException,
                                     RuntimeOperationsException
MBean 全体ポリシーを含む ModelMBean の記述子を返します。この記述子には、MBean のメタデータと持続性機能およびキャッシング機能のデフォルトポリシーが含まれます。

記述子内のフィールドは以下のように定義済みですが、この内容に限定されません。

 name           :MBean 名  
 descriptorType :必ず mbean   
 displayName    :ディスプレイで使用される属性の名前 
 persistPolicy  :OnUpdate、OnTimer、NoMoreOftenThan、OnUnregister、Always、Never  
 persistLocation :完全修飾ディレクトリ名。MBean は、必要に応じてこのディレクトリに保持される 
 persistFile    :MBean を保持するファイルの名前
 persistPeriod  :秒数。OnTime および NoMoreOftenThan PersistPolicy の持続サイクルの頻度を表す 
 currencyTimeLimit :値の有効期間。 <0 無効、=0 常に有効、>0 秒  
 log            :t の場合はすべての通知をログに記録、f の場合は通知を記録しない
 logfile        :イベントの記録先ファイルの完全修飾ファイル名
 visibility     :1 〜 4 の値のうち 1:常に可視 4:ほとんど不可視
 export         :この MBean をエクスポートまたは公開するとき使用する名前。
                  ほかの JMX エージェントはこの名前を使って MBean を検索する   
 presentationString :データ表現と MBean を関連付けるための XML 形式の文字列 
 

デフォルトの記述子は、name=mbeanName,descriptorType=mbean, displayName=this.getClassName(), persistPolicy=never,log=F,export=F,visibility=1 です。記述子にこれらのいずれかのフィールドが不足している場合、不足しているフィールドがデフォルト値で追加されます。

注: 以前のバージョンの仕様との不整合があるため、currencyTimeLimit にはゼロ以下の値を使用しないようにしてください。キャッシュに入った値が有効でないことを示す場合は、currencyTimeLimit フィールドを省略します。この値が常に有効であることを示す場合は、このフィールドに非常に大きい値を指定します。

戻り値:
MBean 記述子
例外:
MBeanException - 分散通信 Exception を ラップする
RuntimeOperationsException - 記述子の取得時に RuntimeException が発生した場合
関連項目:
setMBeanDescriptor(javax.management.Descriptor)

setMBeanDescriptor

void setMBeanDescriptor(Descriptor inDescriptor)
                        throws MBeanException,
                               RuntimeOperationsException
ModelMBean の記述子を設定します。この記述子には、MBean に関する MBean 全体のデフォルトのメタデータと、持続性機能およびキャッシング機能のデフォルトポリシーが含まれます。このオペレーションは、記述子を完全に置換します。マージは行いません。記述子が null に設定された場合、デフォルトの記述子が作成されます。デフォルトの記述子は、name=mbeanName,descriptorType=mbean, displayName=this.getClassName(), persistPolicy=never,log=F,export=F,visibility=1 です。記述子にこれらのいずれかのフィールドが不足している場合、不足しているフィールドがデフォルト値で追加されます。 有効なフィールド名については、getMBeanDescriptor メソッドの javadoc を参照してください。

パラメータ:
inDescriptor - 設定する記述子
例外:
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - 記述子が無効な場合、IllegalArgumentException をラップする
関連項目:
getMBeanDescriptor()

getAttribute

ModelMBeanAttributeInfo getAttribute(String inName)
                                     throws MBeanException,
                                            RuntimeOperationsException
名前で要求された ModelMBeanAttributeInfo を返します。

パラメータ:
inName - 取得する ModelMBeanAttributeInfo の名前。 この名前の ModelMBeanAttributeInfo が存在しない場合は null が返される
戻り値:
指定された属性の属性情報。 存在しない場合は null
例外:
MBeanException - 分散通信 Exception を ラップする
RuntimeOperationsException - 属性名が null の場合、 IllegalArgumentException をラップする

getOperation

ModelMBeanOperationInfo getOperation(String inName)
                                     throws MBeanException,
                                            RuntimeOperationsException
名前で要求された ModelMBeanOperationInfo を返します。

パラメータ:
inName - 取得する ModelMBeanOperationInfo の名前。 この名前の ModelMBeanOperationInfo が存在しない場合は null が返される
戻り値:
指定されたオペレーションのオペレーション情報。 存在しない場合は null
例外:
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - オペレーション名が null の場合 IllegalArgumentException をラップする

getNotification

ModelMBeanNotificationInfo getNotification(String inName)
                                           throws MBeanException,
                                                  RuntimeOperationsException
名前で要求された ModelMBeanNotificationInfo を返します。

パラメータ:
inName - 取得する ModelMBeanNotificationInfo の名前。 この名前の ModelMBeanNotificationInfo が存在しない場合は null が返される
戻り値:
指定された通知の情報。 存在しない場合は null
例外:
MBeanException - 分散通信 Exception をラップする
RuntimeOperationsException - 通知名が null の場合 IllegalArgumentException をラップする

clone

Object clone()
このオブジェクトのコピーを作成して、返します。


getAttributes

MBeanAttributeInfo[] getAttributes()
管理用の公開属性のリストを返します。各属性は MBeanAttributeInfo オブジェクトによって記述されます。

戻り値:
MBeanAttributeInfo オブジェクトの配列

getClassName

String getClassName()
この MBeanInfo によって記述された MBean の Java クラスの名前を返します。

戻り値:
Java クラス名

getConstructors

MBeanConstructorInfo[] getConstructors()
MBean の public コンストラクタのリストを返します。各コンストラクタは MBeanConstructorInfo オブジェクトによって記述されます。

戻り値:
MBeanConstructorInfo オブジェクトの配列

getDescription

String getDescription()
人間が読める形式の MBean の説明を返します。

戻り値:
説明

getNotifications

MBeanNotificationInfo[] getNotifications()
MBean によって発行された通知のリストを返します。各通知は MBeanNotificationInfo オブジェクトによって記述されます。

ModelMBean は、アプリケーションによって指定された通知のほかに、常に 2 つの追加通知を送信できます。

すべての ModelMBeanInfo 実装は、アプリケーションによって指定された通知に、必ずこの 2 つの通知を追加します。

戻り値:
MBeanNotificationInfo オブジェクトの配列

getOperations

MBeanOperationInfo[] getOperations()
MBean のオペレーションのリストを返します。各オペレーションは MBeanOperationInfo オブジェクトによって記述されます。

戻り値:
MBeanOperationInfo オブジェクトの配列

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。