- 既知のすべての実装クラス:
- ModelMBeanInfoSupport
管理対象になるJavaリソースは、MBeanServerのcreateMBeanメソッドを使って、ModelMBeanをインスタンス化します。 次に、ModelMBeanインスタンスのModelMBeanInfoとDescriptorを設定します。 ModelMBeanのModelMBeanInfoで公開された属性、オペレーション、および通知は管理インタフェースを構成します。これらには、他のMBeanと同様、MBean、コネクタ、アダプタからアクセスできます。 Descriptorを使って、管理対象アプリケーション内の値とメソッドを定義し、ModelMBeanの属性およびオペレーションにマップすることができます。 このマッピングは、ファイルを使った開発時、または実行時にプログラムを使って動的に定義できます。
ModelMBean内でインスタンス化される各ModelMBeanが管理対象になります。これらの属性、オペレーション、および通知には、MBeanServerに接続されたコネクタまたはアダプタ経由でリモート・アクセスできます。 JMX準拠のMBeanでないJavaオブジェクトは、MBeanServerに登録できません。 リソースは、ModelMBeanをインスタンス化することにより、MBeanの有効性を保証します。 すべてのpublicメソッドで、MBeanExceptionおよびRuntimeOperationsExceptionがスローされる必要があります。 これにより、分散型通信(RMI、EJBなど)からの例外のラップが可能になります。
- 導入されたバージョン:
- 1.5
- 
メソッドのサマリー修飾子と型メソッド説明clone()このオブジェクトのコピーを作成して、返します。getAttribute(String inName)名前で要求されたModelMBeanAttributeInfoを返します。管理用に公開された属性のリストを返します。このMBeanInfoによって記述されたMBeanのJavaクラスの名前を返します。MBeanのpublicコンストラクタのリストを返します。人間が読める形式のMBeanの説明を返します。getDescriptor(String inDescriptorName, String inDescriptorType)名前とdescriptorTypeで要求されたDescriptorを返します。getDescriptors(String inDescriptorType)inDescriptorType型のModelMBeanInfoのすべてのDescriptorで構成されるDescriptor配列を返します。MBean全体ポリシーを含むModelMBeanの記述子を返します。getNotification(String inName)名前で要求されたModelMBeanNotificationInfoを返します。MBeanによって発行された通知のリストを返します。getOperation(String inName)名前で要求されたModelMBeanOperationInfoを返します。MBeanのオペレーションのリストを返します。voidsetDescriptor(Descriptor inDescriptor, String inDescriptorType)ModelMBeanのinDescriptorType型の情報配列内に記述子を設定します。voidsetDescriptors(Descriptor[] inDescriptors)ModelMBeanInfoに記述子を追加するか、ModelMBeanInfo内の記述子を置き換えます。voidsetMBeanDescriptor(Descriptor inDescriptor)ModelMBeanの記述子を設定します。
- 
メソッドの詳細- 
getDescriptorsDescriptor[] getDescriptors(String inDescriptorType) throws MBeanException, RuntimeOperationsExceptioninDescriptorType型のModelMBeanInfoのすべてのDescriptorで構成されるDescriptor配列を返します。- パラメータ:
- inDescriptorType- 返される記述子に対して設定する必要があるdescriptorTypeフィールドの値。 mbean、attribute、operation、constructor、notificationのいずれか。 nullまたは空の場合、すべての型が返される。
- 戻り値:
- 型がinDescriptorTypeの場合、このModelMBeanのすべての記述子を含む記述子配列。
- 例外:
- MBeanException- 分散通信Exceptionをラップする。
- RuntimeOperationsException- パラメータとして渡されたdescriptorTypeが次のいずれでもない場合、IllegalArgumentExceptionをラップする。mbean、attribute、operation、constructor、notification、空の場合、またはnullの場合。
- 関連項目:
- setDescriptors(javax.management.Descriptor[])
 
- 
setDescriptorsvoid setDescriptors(Descriptor[] inDescriptors) throws MBeanException, RuntimeOperationsExceptionModelMBeanInfoに記述子を追加するか、ModelMBeanInfo内の記述子を置き換えます。- パラメータ:
- inDescriptors- ModelMBeanInfo内に設定される記述子。 リストのnull要素は無視される。 すべての記述子がnameおよびdescriptorTypeフィールドを持っている必要がある。
- 例外:
- RuntimeOperationsException- 記述子がnullまたは不正な場合、IllegalArgumentExceptionをラップする。
- MBeanException- 分散通信Exceptionをラップする。
- 関連項目:
- getDescriptors(java.lang.String)
 
- 
getDescriptorDescriptor 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)
 
- 
setDescriptorvoid setDescriptor(Descriptor inDescriptor, String inDescriptorType) throws MBeanException, RuntimeOperationsExceptionModelMBeanのinDescriptorType型の情報配列内に記述子を設定します。 指定された記述子を設定するため、対応するModelMBean*InfoのsetDescriptorメソッドが呼び出されます。- パラメータ:
- inDescriptor- ModelMBean内に設定される記述子。 null以外でなければならない。 すべての記述子がnameおよびdescriptorTypeフィールドを持っている必要がある。
- inDescriptorType- 設定される記述子の型。 nullの場合、記述子のdescriptorTypeフィールドが使用される。 指定されている場合、この値が記述子のdescriptorTypeフィールドに設定されなければならない。 mbean、attribute、constructor、operation、notificationのいずれか。
- 例外:
- RuntimeOperationsException- 引数が不正またはnullである場合、または対応するMBeanAttributeInfo、MBeanConstructorInfo、MBeanNotificationInfo、MBeanOperationInfoのいずれかで記述子のnameフィールドが見つからない場合、IllegalArgumentExceptionをラップする。
- MBeanException- 分散通信Exceptionをラップする。
- 関連項目:
- getDescriptor(java.lang.String, java.lang.String)
 
- 
getMBeanDescriptorDescriptor getMBeanDescriptor() throws MBeanException, RuntimeOperationsExceptionMBean全体ポリシーを含むModelMBeanの記述子を返します。 この記述子には、MBeanのメタデータと永続性機能およびキャッシング機能のデフォルト・ポリシーが含まれます。 記述子内のフィールドは次のように定義済みですが、この内容に限定されません。 この表で型がNumberである場合は、Longの10進数表現であるStringを使用することもできます。 名前 型 意味 name String MBean名。 descriptorType String 必ずmbean。 displayName String ディスプレイで使用されるMBeanの名前。 persistPolicy String 次のどれか: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never。 JMX仕様ドキュメントの「MBean Descriptor Fields」を参照。 persistLocation String 完全修飾ディレクトリ名。MBeanは、必要に応じてこのディレクトリに保持される。 persistFile String MBeanを保持するファイルの名前。 persistPeriod Number OnTimeおよびNoMoreOftenThan PersistPolicyの永続サイクルの頻度(秒単位) currencyTimeLimit Number キャッシュ値の有効期間。<0無効、=0常に有効、>0秒。 log String t: tの場合はすべての通知をログに記録、fの場合は通知を記録しない。 logfile String イベントの記録先ファイルの完全修飾ファイル名。 visibility Number 1 - 4の値のうち1: 常に可視4:ほとんど不可視。 export String このMBeanをほかのJMXエージェントにエクスポートまたは公開するとき使用する名前。 presentationString String データ表現とMBeanを関連付けるためのXML形式の文字列。 デフォルトの記述子は、name=className,descriptorType="mbean", displayName=className, persistPolicy="never",log="F",visibility="1"です。記述子にこれらのいずれかのフィールドが不足している場合、不足しているフィールドがデフォルト値で追加されます。 ノート: 以前のバージョンの仕様との不整合があるため、 currencyTimeLimitにはゼロ以下の値を使用しないようにしてください。 キャッシュに入った値が有効でないことを示す場合は、currencyTimeLimitフィールドを省略します。 この値が常に有効であることを示す場合は、このフィールドに非常に大きい値を指定します。- 戻り値:
- MBean記述子。
- 例外:
- MBeanException- 分散通信Exceptionをラップする。
- RuntimeOperationsException- 記述子の取得時に- RuntimeExceptionが発生した場合。
- 関連項目:
- setMBeanDescriptor(javax.management.Descriptor)
 
- 
setMBeanDescriptorvoid setMBeanDescriptor(Descriptor inDescriptor) throws MBeanException, RuntimeOperationsExceptionModelMBeanの記述子を設定します。 この記述子には、MBeanに関するMBean全体のデフォルトのメタデータと、永続性機能およびキャッシング機能のデフォルト・ポリシーが含まれます。 このオペレーションは、記述子を完全に置換します。マージは行いません。 記述子がnullに設定された場合、デフォルトの記述子が作成されます。 デフォルトの記述子は、name=className,descriptorType="mbean", displayName=className, persistPolicy="never",log="F",visibility="1"です。記述子にこれらのいずれかのフィールドが不足している場合、不足しているフィールドがデフォルト値で追加されます。 有効なフィールド名については、getMBeanDescriptorメソッドのJavadocを参照してください。- パラメータ:
- inDescriptor- 設定する記述子。
- 例外:
- MBeanException- 分散通信Exceptionをラップする。
- RuntimeOperationsException- 記述子が無効な場合、IllegalArgumentExceptionをラップする。
- 関連項目:
- getMBeanDescriptor()
 
- 
getAttributeModelMBeanAttributeInfo getAttribute(String inName) throws MBeanException, RuntimeOperationsException名前で要求されたModelMBeanAttributeInfoを返します。- パラメータ:
- inName- 取得するModelMBeanAttributeInfoの名前。 この名前のModelMBeanAttributeInfoが存在しない場合はnullが返される。
- 戻り値:
- 指定された属性の属性情報。存在しない場合はnull。
- 例外:
- MBeanException- 分散通信Exceptionをラップする。
- RuntimeOperationsException- 属性名がnullの場合、IllegalArgumentExceptionをラップする。
 
- 
getOperationModelMBeanOperationInfo getOperation(String inName) throws MBeanException, RuntimeOperationsException名前で要求されたModelMBeanOperationInfoを返します。- パラメータ:
- inName- 取得するModelMBeanOperationInfoの名前。 この名前のModelMBeanOperationInfoが存在しない場合はnullが返される。
- 戻り値:
- 指定されたオペレーションのオペレーション情報。存在しない場合はnull。
- 例外:
- MBeanException- 分散通信Exceptionをラップする。
- RuntimeOperationsException- オペレーション名がnullの場合IllegalArgumentExceptionをラップする。
 
- 
getNotificationModelMBeanNotificationInfo getNotification(String inName) throws MBeanException, RuntimeOperationsException名前で要求されたModelMBeanNotificationInfoを返します。- パラメータ:
- inName- 取得するModelMBeanNotificationInfoの名前。 この名前のModelMBeanNotificationInfoが存在しない場合はnullが返される。
- 戻り値:
- 指定された通知の情報。存在しない場合はnull。
- 例外:
- MBeanException- 分散通信Exceptionをラップする。
- RuntimeOperationsException- 通知名がnullの場合IllegalArgumentExceptionをラップする。
 
- 
cloneObject clone()このオブジェクトのコピーを作成して、返します。- 戻り値:
- このオブジェクトのコピー
 
- 
getAttributesMBeanAttributeInfo[] getAttributes()管理用に公開された属性のリストを返します。 各属性はMBeanAttributeInfoオブジェクトによって記述されます。- 戻り値:
- MBeanAttributeInfoオブジェクトの配列。
 
- 
getClassNameString getClassName()このMBeanInfoによって記述されたMBeanのJavaクラスの名前を返します。- 戻り値:
- Javaクラス名。
 
- 
getConstructorsMBeanConstructorInfo[] getConstructors()MBeanのpublicコンストラクタのリストを返します。 各コンストラクタはMBeanConstructorInfoオブジェクトによって記述されます。- 戻り値:
- MBeanConstructorInfoオブジェクトの配列。
 
- 
getDescriptionString getDescription()人間が読める形式のMBeanの説明を返します。- 戻り値:
- 説明。
 
- 
getNotificationsMBeanNotificationInfo[] getNotifications()MBeanによって発行された通知のリストを返します。 各通知はMBeanNotificationInfoオブジェクトによって記述されます。ModelMBeanは、アプリケーションによって指定された通知のほかに、常に2つの追加通知を送信できます。 - 1つは記述子名がGENERIC、displayNameがjmx.modelmbean.genericの通知
- もう1つは記述子名がATTRIBUTE_CHANGE、displayNameがjmx.attribute.changeの標準属性変更通知
 - 戻り値:
- MBeanNotificationInfoオブジェクトの配列。
 
- 
getOperationsMBeanOperationInfo[] getOperations()MBeanのオペレーションのリストを返します。 各オペレーションはMBeanOperationInfoオブジェクトによって記述されます。- 戻り値:
- MBeanOperationInfoオブジェクトの配列。
 
 
-