|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjavax.management.StandardMBean
public class StandardMBean
Java インタフェースのリフレクションによって管理インタフェースを決定する MBean です。
このクラスは、Standard MBean の使用における管理インタフェースの概念の柔軟性を向上させます。JMX 仕様に説明されている Standard MBean のパターンの単純な使用方法には、MBean の実装クラスと管理インタフェース間に固定した関係があると説明されています (つまり、実装クラスが Thing の場合、管理インタフェースは ThingMBean でなければならない)。このクラスは、実装クラスとインタフェースクラス間の名前の関連性を必要とせず、Java インタフェースによる管理インタフェースの指定に役立ちます。
MBean から DynamicMBean を除外することにより、このクラスは、MBean が実装する任意のインタフェースを管理インタフェースとして選択できます。ただし、JMX パターンに準拠するインタフェースでなければなりません (取得メソッドまたは設定メソッドによって定義された属性など)。
このクラスは、DynamicMBean インタフェースから返される MBeanInfo にカスタムの記述と名前を割り当てることができるフックを提供します。
このクラスを使って、任意の実装クラス名 Impl と、任意のインタフェース Intf で定義された管理インタフェース (現在の Standard MBean 用) を指定して MBean を作成できます。一般に、次のいずれかの作成方法を選択します。
StandardMBean(impl,interface) を使用
MBeanServer mbs; ... Impl impl = new Impl(...); StandardMBean mbean = new StandardMBean(impl, Intf.class); mbs.registerMBean(mbean, objectName);
public class Impl extends StandardMBean implements Intf { public Impl() { super(Intf.class);
} // implement methods of Intf }
[...]
MBeanServer mbs; .... Impl impl = new Impl(); mbs.registerMBean(impl, objectName); いずれの場合も、クラス Impl はインタフェース Intf を実装する必要があります。
実装クラスとインタフェースクラス間の名前の関連性に基づいた Standard MBean も、引き続き使用可能です。
| コンストラクタの概要 | |
|---|---|
protected |
StandardMBean(Class mbeanInterface)
特定の mbeanInterface クラスを使って、DynamicMBean を this から除外します。 |
|
StandardMBean(Object implementation,
Class mbeanInterface)
特定の mbeanInterface クラスを使って、DynamicMBean をオブジェクト implementation から除外します。 |
| メソッドの概要 | |
|---|---|
protected void |
cacheMBeanInfo(MBeanInfo info)
カスタマイズフック: このオブジェクト用に構築された MBeanInfo をキャッシュに入れます。 |
Object |
getAttribute(String attribute)
Dynamic MBean の特定の属性の値を取得します。 |
AttributeList |
getAttributes(String[] attributes)
Dynamic MBean の複数の属性の値を取得します。 |
protected MBeanInfo |
getCachedMBeanInfo()
カスタマイズフック: このオブジェクト用にキャッシュされた MBeanInfo を返します。 |
protected String |
getClassName(MBeanInfo info)
カスタマイズフック: この MBean から返される MBeanInfo 内で使用される className を取得します。 |
protected MBeanConstructorInfo[] |
getConstructors(MBeanConstructorInfo[] ctors,
Object impl)
カスタマイズフック: この MBean から返される MBeanInfo で使用される MBeanConstructorInfo[] を取得します。 |
protected String |
getDescription(MBeanAttributeInfo info)
カスタマイズフック: この MBean が返す MBeanAttributeInfo 内で使用される説明を取得します。 |
protected String |
getDescription(MBeanConstructorInfo info)
カスタマイズフック: この MBean から返される MBeanConstructorInfo 内で使用される説明を取得します。 |
protected String |
getDescription(MBeanConstructorInfo ctor,
MBeanParameterInfo param,
int sequence)
カスタマイズフック: この MBean から返される MBeanConstructorInfo の sequence MBeanParameterInfo に使用される説明を取得します。 |
protected String |
getDescription(MBeanFeatureInfo info)
カスタマイズフック: この MBean が返す MBeanFeatureInfo 内で使用される説明を取得します。 |
protected String |
getDescription(MBeanInfo info)
カスタマイズフック: この MBean から返される MBeanInfo 内で使用される説明を取得します。 |
protected String |
getDescription(MBeanOperationInfo info)
カスタマイズフック: この MBean から返される MBeanOperationInfo 内で使用される説明を取得します。 |
protected String |
getDescription(MBeanOperationInfo op,
MBeanParameterInfo param,
int sequence)
カスタマイズフック: この MBean から返される MBeanOperationInfo の sequence MBeanParameterInfo に使用される説明を取得します。 |
protected int |
getImpact(MBeanOperationInfo info)
カスタマイズフック: この MBean から返される MBeanOperationInfo で使用されるオペレーションの impact フラグを取得します。 |
Object |
getImplementation()
この MBean の実装を取得します。 |
Class |
getImplementationClass()
この MBean の実装クラスを取得します。 |
MBeanInfo |
getMBeanInfo()
この MBean の MBeanInfo を取得します。 |
Class |
getMBeanInterface()
この MBean の管理インタフェースを取得します。 |
protected String |
getParameterName(MBeanConstructorInfo ctor,
MBeanParameterInfo param,
int sequence)
カスタマイズフック: この MBean から返される MBeanConstructorInfo の sequence MBeanParameterInfo に使用される名前を取得します。 |
protected String |
getParameterName(MBeanOperationInfo op,
MBeanParameterInfo param,
int sequence)
カスタマイズフック: この MBean から返される MBeanOperationInfo の sequence MBeanParameterInfo に使用される名前を取得します。 |
Object |
invoke(String actionName,
Object[] params,
String[] signature)
Dynamic MBean 上でのアクションの実行を許可します。 |
void |
setAttribute(Attribute attribute)
Dynamic MBean の特定の属性の値を設定します。 |
AttributeList |
setAttributes(AttributeList attributes)
Dynamic MBean の複数の属性の値を設定します。 |
void |
setImplementation(Object implementation)
このオブジェクト内のラップされた実装オブジェクトを置換します。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public StandardMBean(Object implementation,
Class mbeanInterface)
throws NotCompliantMBeanException
特定の mbeanInterface クラスを使って、DynamicMBean をオブジェクト implementation から除外します。
implementation - この MBean の実装mbeanInterface - この MBean の実装によってエクスポートされる管理インタフェース。null の場合、このオブジェクトは標準 JMX 設計パターンを使って、指定された実装に関連付けられた管理インタフェースを特定する
IllegalArgumentException - 指定された implementation が null である場合
NotCompliantMBeanException - mbeanInterface が管理インタフェースの JMX 設計パターンに従っていない場合、または指定された implementation が特定のインタフェースを実装していない場合
protected StandardMBean(Class mbeanInterface)
throws NotCompliantMBeanException
特定の mbeanInterface クラスを使って、DynamicMBean を this から除外します。
this(this,mbeanInterface) を呼び出します。このコンストラクタはサブクラス用として予約されています。
mbeanInterface - この MBean によってエクスポートされる管理インタフェース
NotCompliantMBeanException - mbeanInterface が管理インタフェースの JMX 設計パターンに従っていない場合、または this が特定のインタフェースを実装していない場合| メソッドの詳細 |
|---|
public void setImplementation(Object implementation)
throws NotCompliantMBeanException
このオブジェクト内のラップされた実装オブジェクトを置換します。
implementation - この MBean の新しい実装。implementation オブジェクトは、この StandardMBean の構築時に提供された MBean インタフェースを実装する必要がある
IllegalArgumentException - 指定された implementation が null である場合
NotCompliantMBeanException - 指定された implementation が構築時に提供された MBean インタフェースを実装していない場合getImplementation()public Object getImplementation()
setImplementation(java.lang.Object)public final Class getMBeanInterface()
public Class getImplementationClass()
public Object getAttribute(String attribute)
throws AttributeNotFoundException,
MBeanException,
ReflectionException
DynamicMBean の記述:
DynamicMBean 内の getAttributeattribute - 取得される属性の名前
AttributeNotFoundException - @exception MBeanException MBean の取得メソッドによってスローされる java.lang.Exception をラップする場合
ReflectionException - 取得メソッドの呼び出し時にスローされる java.lang.Exception をラップする場合
MBeanExceptionDynamicMBean.setAttribute(javax.management.Attribute)
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException
DynamicMBean の記述:
DynamicMBean 内の setAttributeattribute - 設定される属性の ID と設定される値
AttributeNotFoundException - @exception InvalidAttributeValueException
MBeanException - MBean の設定メソッドによってスローされる java.lang.Exception をラップする場合
ReflectionException - MBean の設定メソッドの呼び出し時にスローされる java.lang.Exception をラップする場合
InvalidAttributeValueExceptionDynamicMBean.getAttribute(java.lang.String)public AttributeList getAttributes(String[] attributes)
DynamicMBean の記述:
DynamicMBean 内の getAttributesattributes - 取得される属性のリスト
DynamicMBean.setAttributes(javax.management.AttributeList)public AttributeList setAttributes(AttributeList attributes)
DynamicMBean の記述:
DynamicMBean 内の setAttributesattributes - 属性のリスト (設定される属性の ID と設定される値)
DynamicMBean.getAttributes(java.lang.String[])
public Object invoke(String actionName,
Object[] params,
String[] signature)
throws MBeanException,
ReflectionException
DynamicMBean の記述:
DynamicMBean 内の invokeactionName - 呼び出されるアクションの名前params - アクションの呼び出し時に設定されるパラメータを含む配列signature - アクションのシグニチャーを含む配列。クラスオブジェクトのロードには、アクションを呼び出す MBean をロードするときと同じクラスローダが使用される
MBeanException - MBean の呼び出しメソッドによってスローされる java.lang.Exception をラップする場合
ReflectionException - メソッドの呼び出し時にスローされる java.lang.Exception をラップする場合public MBeanInfo getMBeanInfo()
MBeanInfo を取得します。
このメソッドは、DynamicMBean.getMBeanInfo() を実装します。
このメソッドは、最初に、キャッシュされているこの MBean の MBeanInfo を取得するため、getCachedMBeanInfo() を呼び出します。getCachedMBeanInfo() は null 以外の MBeanInfo を返します。
MBeanInfo が null の場合、このメソッドは、この MBean の指定の管理インタフェースを使って、この MBean のデフォルトの MBeanInfo を構築します。
このメソッドは、MBeanInfo の構築時に、サブクラスがカスタムの記述、パラメータ、名前などを提供できるようにするカスタマイズフックを呼び出します。
最終的には、新しい MBeanInfo をキャッシュするため、cacheMBeanInfo() を呼び出します。
DynamicMBean 内の getMBeanInfoprotected String getClassName(MBeanInfo info)
info.getClassName() を返します。
info - リフレクションによって派生したデフォルトの MBeanInfo
protected String getDescription(MBeanInfo info)
info.getDescription() を返します。
info - リフレクションによって派生したデフォルトの MBeanInfo
protected String getDescription(MBeanFeatureInfo info)
カスタマイズフック: この MBean が返す MBeanFeatureInfo 内で使用される説明を取得します。
サブクラスは、カスタムの説明を提供するため、このメソッドを再定義できます。デフォルトの実装は info.getDescription() を返します。
このメソッドは、getDescription(MBeanAttributeInfo)、getDescription(MBeanOperationInfo)、getDescription(MBeanConstructorInfo) に呼び出されます。
info - リフレクションによって派生したデフォルトの MBeanFeatureInfo
protected String getDescription(MBeanAttributeInfo info)
サブクラスは、カスタムの説明を提供するため、このメソッドを再定義できます。デフォルトの実装は getDescription((MBeanFeatureInfo) info) を返します。
info - リフレクションによって派生したデフォルトの MBeanAttributeInfo
protected String getDescription(MBeanConstructorInfo info)
getDescription((MBeanFeatureInfo) info) を返します。
info - リフレクションによって派生したデフォルトの MBeanConstructorInfo
protected String getDescription(MBeanConstructorInfo ctor,
MBeanParameterInfo param,
int sequence)
param.getDescription() を返します。
ctor - リフレクションによって派生したデフォルトの MBeanConstructorInfoparam - リフレクションによって派生したデフォルトの MBeanParameterInfosequence - パラメータのシーケンス番号。0 は最初のパラメータ、1 は 2 番目のパラメータ (以下同様)
protected String getParameterName(MBeanConstructorInfo ctor,
MBeanParameterInfo param,
int sequence)
param.getName() を返します。
ctor - リフレクションによって派生したデフォルトの MBeanConstructorInfoparam - リフレクションによって派生したデフォルトの MBeanParameterInfosequence - パラメータのシーケンス番号。0 は最初のパラメータ、1 は 2 番目のパラメータ (以下同様)
protected String getDescription(MBeanOperationInfo info)
getDescription((MBeanFeatureInfo) info) を返します。
info - リフレクションによって派生したデフォルトの MBeanOperationInfo
protected int getImpact(MBeanOperationInfo info)
info.getImpact() を返します。
info - リフレクションによって派生したデフォルトの MBeanOperationInfo
protected String getParameterName(MBeanOperationInfo op,
MBeanParameterInfo param,
int sequence)
param.getName() を返します。
op - リフレクションによって派生したデフォルトの MBeanOperationInfoparam - リフレクションによって派生したデフォルトの MBeanParameterInfosequence - パラメータのシーケンス番号。0 は最初のパラメータ、1 は 2 番目のパラメータ (以下同様)
protected String getDescription(MBeanOperationInfo op,
MBeanParameterInfo param,
int sequence)
param.getDescription() を返します。
op - リフレクションによって派生したデフォルトの MBeanOperationInfoparam - リフレクションによって派生したデフォルトの MBeanParameterInfosequence - パラメータのシーケンス番号。0 は最初のパラメータ、1 は 2 番目のパラメータ (以下同様)
protected MBeanConstructorInfo[] getConstructors(MBeanConstructorInfo[] ctors,
Object impl)
null を返します。ラップされた実装がこのオブジェクト自体でない場合、MBeanServer.createMBean(...) を通して実装コンストラクタを呼び出しても、ラップされた実装を作成し直すことはできません。
ctors - リフレクションによって派生したデフォルトの MBeanConstructorInfo[]impl - ラップされた実装。null が渡されると、ラップされた実装は無視され、ctors が返される
protected MBeanInfo getCachedMBeanInfo()
サブクラスは、固有のキャッシングポリシーを実装するため、このメソッドを再定義できます。デフォルトの実装は、インスタンスごとに MBeanInfo オブジェクトを 1 つずつ格納します。
cacheMBeanInfo(MBeanInfo)protected void cacheMBeanInfo(MBeanInfo info)
サブクラスは、固有のキャッシングポリシーを実装するため、このメソッドを再定義できます。デフォルトの実装は、このインスタンスに info を格納します。サブクラスは、その他のポリシーも定義できます。たとえば、getMBeanInfo() の呼び出しのたびに再構築されるように info を保存しないポリシーや、複数の StandardMBean インスタンスが同等の MBeanInfo 値を持つ場合に単一の MBeanInfo オブジェクトを共有するポリシーなどを定義できます。
info - キャッシュする新しい MBeanInfo。以前にキャッシュされた値はすべて破棄される。新しくキャッシュされた値がない場合、このパラメータは null
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。