public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBeanInfoAssembler
AbstractMBeanInfoAssembler
スーパークラスに基づいて構築し、MBean クラスのリフレクトメタデータに基づいてメタデータを構築するための基本的なアルゴリズムを追加します。 リフレクトメタデータから MBean メタデータを作成するためのロジックはこのクラスに含まれていますが、このクラスはどのメソッドとプロパティを公開するかについて決定を行いません。代わりに、includeXXX
メソッドを介して各プロパティまたはメソッドに「投票」する機会をサブクラスに提供します。
サブクラスには、メタデータが populateXXXDescriptor
メソッドを介してアセンブルされると、属性と操作のメタデータに追加の記述子を追加する機会も与えられます。
includeOperation(java.lang.reflect.Method, java.lang.String)
, includeReadAttribute(java.lang.reflect.Method, java.lang.String)
, includeWriteAttribute(java.lang.reflect.Method, java.lang.String)
, populateAttributeDescriptor(javax.management.Descriptor, java.lang.reflect.Method, java.lang.reflect.Method, java.lang.String)
, populateOperationDescriptor(javax.management.Descriptor, java.lang.reflect.Method, java.lang.String)
修飾子と型 | フィールドと説明 |
---|---|
protected static int | ATTRIBUTE_OPERATION_VISIBILITY 最も低い可視性。属性のアクセサーまたはミューテーターに対応する操作に使用されます。 |
protected static java.lang.String | FIELD_CLASS JMX Descriptor のクラスフィールドの定数識別子。 |
protected static java.lang.String | FIELD_CURRENCY_TIME_LIMIT JMX Descriptor の通貨期限フィールドの定数識別子。 |
protected static java.lang.String | FIELD_DEFAULT JMX Descriptor のデフォルトフィールドの定数識別子。 |
protected static java.lang.String | FIELD_DISPLAY_NAME JMX Descriptor 内の displayName フィールドの定数識別子。 |
protected static java.lang.String | FIELD_GET_METHOD JMX Descriptor の getter メソッドを識別します。 |
protected static java.lang.String | FIELD_LOG JMX Descriptor のログフィールドの定数識別子。 |
protected static java.lang.String | FIELD_LOG_FILE JMX Descriptor のログファイルフィールドの定数識別子。 |
protected static java.lang.String | FIELD_METRIC_CATEGORY JMX Descriptor 内のカスタム metricCategory フィールドの定数識別子。 |
protected static java.lang.String | FIELD_METRIC_TYPE JMX Descriptor 内の metricType フィールドの定数識別子。 |
protected static java.lang.String | FIELD_PERSIST_LOCATION JMX Descriptor 内の persistLocation フィールドの定数識別子。 |
protected static java.lang.String | FIELD_PERSIST_NAME JMX Descriptor 内の persistName フィールドの定数識別子。 |
protected static java.lang.String | FIELD_PERSIST_PERIOD JMX Descriptor 内の persistPeriod フィールドの定数識別子。 |
protected static java.lang.String | FIELD_PERSIST_POLICY JMX Descriptor 内の persistPolicy フィールドの定数識別子。 |
protected static java.lang.String | FIELD_ROLE JMX Descriptor のロールフィールドの定数識別子。 |
protected static java.lang.String | FIELD_SET_METHOD JMX Descriptor の setter メソッドを識別します。 |
protected static java.lang.String | FIELD_UNITS JMX Descriptor の units フィールドの定数識別子。 |
protected static java.lang.String | FIELD_VISIBILITY JMX Descriptor の可視性フィールドの定数識別子。 |
protected static java.lang.String | ROLE_GETTER JMX Descriptor の getter ロールフィールド値の定数識別子。 |
protected static java.lang.String | ROLE_OPERATION JMX Descriptor の操作(メソッド)を識別します。 |
protected static java.lang.String | ROLE_SETTER JMX Descriptor の setter ロールフィールド値の定数識別子。 |
コンストラクターと説明 |
---|
AbstractReflectiveMBeanInfoAssembler() |
修飾子と型 | メソッドと説明 |
---|---|
protected void | applyCurrencyTimeLimit(javax.management.Descriptor desc, int currencyTimeLimit) 指定された JMX "currencyTimeLimit" 値を指定された記述子に適用します。 |
protected void | applyDefaultCurrencyTimeLimit(javax.management.Descriptor desc) 指定された "defaultCurrencyTimeLimit" がある場合は、 currencyTimeLimit フィールドをその値に設定します (デフォルトではなし)。 |
protected javax.management.modelmbean.ModelMBeanOperationInfo | createModelMBeanOperationInfo(java.lang.reflect.Method method, java.lang.String name, java.lang.String beanKey) 指定されたメソッドの ModelMBeanOperationInfo のインスタンスを作成します。 |
protected java.lang.String | getAttributeDescription(java.beans.PropertyDescriptor propertyDescriptor, java.lang.String beanKey) 特定の属性の説明を取得します。 |
protected javax.management.modelmbean.ModelMBeanAttributeInfo[] | getAttributeInfo(java.lang.Object managedBean, java.lang.String beanKey) MBean クラスのすべてのプロパティを反復処理し、サブクラスにアクセサーとミューテーターの両方を含めることについて投票する機会を与えます。 |
protected java.lang.Class<?> | getClassForDescriptor(java.lang.Object managedBean) JMX 記述子フィールド「クラス」に使用されるクラスを返します。 |
protected java.lang.Integer | getDefaultCurrencyTimeLimit() JMX フィールド "currencyTimeLimit" のデフォルト値を返します (存在する場合)。 |
protected java.lang.String | getOperationDescription(java.lang.reflect.Method method, java.lang.String beanKey) 特定の操作の説明を取得します。 |
protected javax.management.modelmbean.ModelMBeanOperationInfo[] | getOperationInfo(java.lang.Object managedBean, java.lang.String beanKey) MBean クラスのすべてのメソッドを反復処理し、サブクラスにそれらの包含に投票する機会を与えます。 |
protected javax.management.MBeanParameterInfo[] | getOperationParameters(java.lang.reflect.Method method, java.lang.String beanKey) 指定されたメソッドのパラメーター情報を作成します。 |
protected ParameterNameDiscoverer | getParameterNameDiscoverer() 必要に応じてメソッドのパラメーター名を解決するために使用する ParameterNameDiscoverer を返します(パラメーターの検出をスキップするために null の場合があります)。 |
protected abstract boolean | includeOperation(java.lang.reflect.Method method, java.lang.String beanKey) サブクラスが特定の操作の包含について投票できるようにします。 |
protected abstract boolean | includeReadAttribute(java.lang.reflect.Method method, java.lang.String beanKey) サブクラスが特定の属性アクセサーの包含について投票できるようにします。 |
protected abstract boolean | includeWriteAttribute(java.lang.reflect.Method method, java.lang.String beanKey) サブクラスが特定の属性ミューテーターの包含について投票できるようにします。 |
protected boolean | isExposeClassDescriptor() 管理された操作の JMX 記述子フィールド「クラス」を公開するかどうかを返します。 |
protected boolean | isUseStrictCasing() 属性の厳密な大文字小文字の区別が有効かどうかを返します。 |
protected void | populateAttributeDescriptor(javax.management.Descriptor desc, java.lang.reflect.Method getter, java.lang.reflect.Method setter, java.lang.String beanKey) サブクラスが特定の属性の Descriptor にフィールドを追加できるようにします。 |
protected void | populateMBeanDescriptor(javax.management.Descriptor descriptor, java.lang.Object managedBean, java.lang.String beanKey) サブクラスが MBean の Descriptor にフィールドを追加できるようにします。 |
protected void | populateOperationDescriptor(javax.management.Descriptor desc, java.lang.reflect.Method method, java.lang.String beanKey) サブクラスが特定の操作のために Descriptor にフィールドを追加できるようにします。 |
void | setDefaultCurrencyTimeLimit(java.lang.Integer defaultCurrencyTimeLimit) JMX フィールド "currencyTimeLimit" のデフォルトを設定します。 |
void | setExposeClassDescriptor(boolean exposeClassDescriptor) 管理対象オペレーションの JMX 記述子フィールド「クラス」を公開するかどうかを設定します。 |
void | setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer) 必要に応じて、メソッドパラメーター名の解決に使用する ParameterNameDiscoverer を設定します(例: |
void | setUseStrictCasing(boolean useStrictCasing) 属性に厳密な大文字小文字を使用するかどうかを設定します。 |
checkManagedBean, getClassName, getClassToExpose, getClassToExpose, getConstructorInfo, getDescription, getMBeanInfo, getNotificationInfo, getTargetClass
protected static final java.lang.String FIELD_GET_METHOD
Descriptor
の getter メソッドを識別します。protected static final java.lang.String FIELD_SET_METHOD
Descriptor
の setter メソッドを識別します。protected static final java.lang.String FIELD_ROLE
Descriptor
のロールフィールドの定数識別子。protected static final java.lang.String ROLE_GETTER
Descriptor
の getter ロールフィールド値の定数識別子。protected static final java.lang.String ROLE_SETTER
Descriptor
の setter ロールフィールド値の定数識別子。protected static final java.lang.String ROLE_OPERATION
Descriptor
の操作(メソッド)を識別します。protected static final java.lang.String FIELD_VISIBILITY
Descriptor
の可視性フィールドの定数識別子。protected static final int ATTRIBUTE_OPERATION_VISIBILITY
FIELD_VISIBILITY
, 定数フィールド値 protected static final java.lang.String FIELD_CLASS
Descriptor
のクラスフィールドの定数識別子。protected static final java.lang.String FIELD_LOG
Descriptor
のログフィールドの定数識別子。protected static final java.lang.String FIELD_LOG_FILE
Descriptor
のログファイルフィールドの定数識別子。protected static final java.lang.String FIELD_CURRENCY_TIME_LIMIT
Descriptor
の通貨期限フィールドの定数識別子。protected static final java.lang.String FIELD_DEFAULT
Descriptor
のデフォルトフィールドの定数識別子。protected static final java.lang.String FIELD_PERSIST_POLICY
Descriptor
内の persistPolicy フィールドの定数識別子。protected static final java.lang.String FIELD_PERSIST_PERIOD
Descriptor
内の persistPeriod フィールドの定数識別子。protected static final java.lang.String FIELD_PERSIST_LOCATION
Descriptor
内の persistLocation フィールドの定数識別子。protected static final java.lang.String FIELD_PERSIST_NAME
Descriptor
内の persistName フィールドの定数識別子。protected static final java.lang.String FIELD_DISPLAY_NAME
Descriptor
内の displayName フィールドの定数識別子。protected static final java.lang.String FIELD_UNITS
Descriptor
の units フィールドの定数識別子。protected static final java.lang.String FIELD_METRIC_TYPE
Descriptor
内の metricType フィールドの定数識別子。protected static final java.lang.String FIELD_METRIC_CATEGORY
Descriptor
内のカスタム metricCategory フィールドの定数識別子。public void setDefaultCurrencyTimeLimit(@Nullable java.lang.Integer defaultCurrencyTimeLimit)
デフォルトは none で、JMX 1.2 仕様で推奨されているように、そのフィールドを明示的に設定しません。これにより、「キャッシュしない」動作になり、常に属性値が新しく読み取られます (これは、JMX 1.2 の -1
の "currencyTimeLimit" に相当します)。
ただし、一部の JMX 実装(その点で JMX 1.2 仕様に準拠していない)では、「キャッシュしない」動作を取得するために、ここで明示的な値を設定する必要がある場合があります(JBoss 3.2.x など)。
"currencyTimeLimit" 値は、管理対象属性または操作にも指定できることに注意してください。そこで "currencyTimeLimit" 値 >= 0
で上書きされない場合は、デフォルト値が適用されます。メタデータ "currencyTimeLimit" 値 -1
は、デフォルトを使用することを示します。値 0
は「常にキャッシュする」ことを示し、Integer.MAX_VALUE
に変換されます。正の値は、キャッシュの秒数を示します。
@Nullable protected java.lang.Integer getDefaultCurrencyTimeLimit()
public void setUseStrictCasing(boolean useStrictCasing)
厳密な大文字小文字を使用する場合、getFoo()
などの getter を持つ JavaBean プロパティは、Foo
と呼ばれる属性に変換されます。厳密なケーシングを無効にすると、getFoo()
は foo
に変換されます。
protected boolean isUseStrictCasing()
public void setExposeClassDescriptor(boolean exposeClassDescriptor)
「クラス」フィールドを指定する必要がある JMX 実装の場合、このプロパティを true
に設定します(例: WebLogic)。その場合、プレーンな Bean インスタンスまたは CGLIB プロキシの場合、Spring はそこでターゲットクラス名を公開します。JDK 動的プロキシに遭遇すると、プロキシによって実装される最初のインターフェースが指定されます。
警告 : JMX を介して JDK 動的プロキシを公開する場合、特にこのプロパティが true
になっている場合は、プロキシ定義を確認してください。: この場合、指定されたインターフェースリストは管理インターフェースで始まり、他のすべてのインターフェースがそれに続きます。一般に、ターゲット Bean を直接公開するか、代わりに CGLIB プロキシを公開することを検討してください。
protected boolean isExposeClassDescriptor()
public void setParameterNameDiscoverer(@Nullable ParameterNameDiscoverer parameterNameDiscoverer)
デフォルトは DefaultParameterNameDiscoverer
です。
@Nullable protected ParameterNameDiscoverer getParameterNameDiscoverer()
null
の場合があります)。protected javax.management.modelmbean.ModelMBeanAttributeInfo[] getAttributeInfo(java.lang.Object managedBean, java.lang.String beanKey) throws javax.management.JMException
AbstractMBeanInfoAssembler
の getAttributeInfo
managedBean
- Bean インスタンス (AOP プロキシである可能性があります)beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー javax.management.JMException
- エラーの場合 populateAttributeDescriptor(javax.management.Descriptor, java.lang.reflect.Method, java.lang.reflect.Method, java.lang.String)
protected javax.management.modelmbean.ModelMBeanOperationInfo[] getOperationInfo(java.lang.Object managedBean, java.lang.String beanKey)
AbstractMBeanInfoAssembler
の getOperationInfo
managedBean
- Bean インスタンス (AOP プロキシである可能性があります)beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー populateOperationDescriptor(javax.management.Descriptor, java.lang.reflect.Method, java.lang.String)
protected javax.management.modelmbean.ModelMBeanOperationInfo createModelMBeanOperationInfo(java.lang.reflect.Method method, java.lang.String name, java.lang.String beanKey)
ModelMBeanOperationInfo
のインスタンスを作成します。操作のパラメーター情報を入力します。method
- ModelMBeanOperationInfo
を作成するための Method
name
- 操作の論理名(メソッド名またはプロパティ名)。デフォルトの実装では使用されませんが、サブクラスで使用される可能性があります beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー ModelMBeanOperationInfo
protected java.lang.Class<?> getClassForDescriptor(java.lang.Object managedBean)
デフォルトの実装は、JDK プロキシ用に最初に実装されたインターフェースと、それ以外のターゲットクラスを返します。
managedBean
- Bean インスタンス (AOP プロキシである可能性があります)setExposeClassDescriptor(boolean)
, AbstractMBeanInfoAssembler.getClassToExpose(Class)
, AopProxyUtils.proxiedUserInterfaces(Object)
protected abstract boolean includeReadAttribute(java.lang.reflect.Method method, java.lang.String beanKey)
method
- アクセサー Method
beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー true
、それ以外の場合は false
protected abstract boolean includeWriteAttribute(java.lang.reflect.Method method, java.lang.String beanKey)
method
- ミューテータ Method
。beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー true
、それ以外の場合は false
protected abstract boolean includeOperation(java.lang.reflect.Method method, java.lang.String beanKey)
method
- 操作方法 beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー protected java.lang.String getAttributeDescription(java.beans.PropertyDescriptor propertyDescriptor, java.lang.String beanKey)
デフォルトの実装は、対応する Method
の名前である操作の説明を返します。
propertyDescriptor
- 属性の PropertyDescriptorbeanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー protected java.lang.String getOperationDescription(java.lang.reflect.Method method, java.lang.String beanKey)
デフォルトの実装は、対応する Method
の名前である操作の説明を返します。
method
- 操作方法 beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー protected javax.management.MBeanParameterInfo[] getOperationParameters(java.lang.reflect.Method method, java.lang.String beanKey)
デフォルトの実装は、MBeanParameterInfo
の空の配列を返します。
method
- パラメーター情報を取得する Method
beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー MBeanParameterInfo
配列 protected void populateMBeanDescriptor(javax.management.Descriptor descriptor, java.lang.Object managedBean, java.lang.String beanKey)
Descriptor
にフィールドを追加できるようにします。 デフォルトの実装では、指定された "defaultCurrencyTimeLimit" が存在する場合(デフォルトではなし)、currencyTimeLimit
フィールドがそれに設定されます。
AbstractMBeanInfoAssembler
の populateMBeanDescriptor
descriptor
- MBean リソースの Descriptor
。managedBean
- Bean インスタンス (AOP プロキシである可能性があります)beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー setDefaultCurrencyTimeLimit(Integer)
, applyDefaultCurrencyTimeLimit(javax.management.Descriptor)
protected void populateAttributeDescriptor(javax.management.Descriptor desc, @Nullable java.lang.reflect.Method getter, @Nullable java.lang.reflect.Method setter, java.lang.String beanKey)
Descriptor
にフィールドを追加できるようにします。 デフォルトの実装では、指定された "defaultCurrencyTimeLimit" が存在する場合(デフォルトではなし)、currencyTimeLimit
フィールドがそれに設定されます。
desc
- 属性記述子 getter
- 属性のアクセサーメソッド setter
- 属性のミューテーターメソッド beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー setDefaultCurrencyTimeLimit(Integer)
, applyDefaultCurrencyTimeLimit(javax.management.Descriptor)
protected void populateOperationDescriptor(javax.management.Descriptor desc, java.lang.reflect.Method method, java.lang.String beanKey)
Descriptor
にフィールドを追加できるようにします。 デフォルトの実装では、指定された "defaultCurrencyTimeLimit" が存在する場合(デフォルトではなし)、currencyTimeLimit
フィールドがそれに設定されます。
desc
- 操作記述子 method
- 操作に対応するメソッド beanKey
- MBeanExporter
の Bean マップで MBean に関連付けられているキー setDefaultCurrencyTimeLimit(Integer)
, applyDefaultCurrencyTimeLimit(javax.management.Descriptor)
protected final void applyDefaultCurrencyTimeLimit(javax.management.Descriptor desc)
currencyTimeLimit
フィールドをその値に設定します (デフォルトではなし)。desc
- JMX 属性または操作記述子 setDefaultCurrencyTimeLimit(Integer)
protected void applyCurrencyTimeLimit(javax.management.Descriptor desc, int currencyTimeLimit)
デフォルトの実装では、値 >0
をそのまま (キャッシュ秒数として) 設定し、値 0
を Integer.MAX_VALUE
(「常にキャッシュ」) に変換し、値 <0
の場合は "defaultCurrencyTimeLimit" (存在する場合は「キャッシュしない」を示す) を設定します。これは、JMX 1.2 仕様の推奨事項に従います。
desc
- JMX 属性または操作記述子 currencyTimeLimit
- 適用する "currencyTimeLimit" 値 setDefaultCurrencyTimeLimit(Integer)
, applyDefaultCurrencyTimeLimit(javax.management.Descriptor)