类 MetadataMBeanInfoAssembler
- java.lang.Object
- org.springframework.jmx.export.assembler.AbstractMBeanInfoAssembler
- org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler
- org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler
public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssembler implements AutodetectCapableMBeanInfoAssembler, InitializingBean
Implementation of theMBeanInfoAssembler
interface that reads the management interface information from source level metadata.Uses the
JmxAttributeSource
strategy interface, so that metadata can be read using any supported implementation. Out of the box, Spring provides an implementation based on annotations:AnnotationJmxAttributeSource
.- 从以下版本开始:
- 1.2
- 作者:
- Rob Harrop, Juergen Hoeller, Jennifer Hickey
- 另请参阅:
setAttributeSource(org.springframework.jmx.export.metadata.JmxAttributeSource)
,AnnotationJmxAttributeSource
字段概要
从类继承的字段 org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler
ATTRIBUTE_OPERATION_VISIBILITY, FIELD_CLASS, FIELD_CURRENCY_TIME_LIMIT, FIELD_DEFAULT, FIELD_DISPLAY_NAME, FIELD_GET_METHOD, FIELD_LOG, FIELD_LOG_FILE, FIELD_METRIC_CATEGORY, FIELD_METRIC_TYPE, FIELD_PERSIST_LOCATION, FIELD_PERSIST_NAME, FIELD_PERSIST_PERIOD, FIELD_PERSIST_POLICY, FIELD_ROLE, FIELD_SET_METHOD, FIELD_UNITS, FIELD_VISIBILITY, ROLE_GETTER, ROLE_OPERATION, ROLE_SETTER
构造器概要
构造器 构造器 说明 MetadataMBeanInfoAssembler()
Create a newMetadataMBeanInfoAssembler
which needs to be configured through thesetAttributeSource(org.springframework.jmx.export.metadata.JmxAttributeSource)
method.MetadataMBeanInfoAssembler(JmxAttributeSource attributeSource)
Create a newMetadataMBeanInfoAssembler
for the givenJmxAttributeSource
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.protected void
checkManagedBean(Object managedBean)
Throws an IllegalArgumentException if it encounters a JDK dynamic proxy.protected String
getAttributeDescription(PropertyDescriptor propertyDescriptor, String beanKey)
Creates a description for the attribute corresponding to this property descriptor.protected String
getDescription(Object managedBean, String beanKey)
Reads managed resource description from the source level metadata.protected ModelMBeanNotificationInfo[]
getNotificationInfo(Object managedBean, String beanKey)
Reads theManagedNotification
metadata from theClass
of the managed resource and generates and returns the correspondingModelMBeanNotificationInfo
metadata.protected String
getOperationDescription(Method method, String beanKey)
Retrieves the description for the suppliedMethod
from the metadata.protected MBeanParameterInfo[]
getOperationParameters(Method method, String beanKey)
ReadsMBeanParameterInfo
from theManagedOperationParameter
attributes attached to a method.boolean
includeBean(Class<?> beanClass, String beanName)
Used for autodetection of beans.protected boolean
includeOperation(Method method, String beanKey)
Votes on the inclusion of an operation.protected boolean
includeReadAttribute(Method method, String beanKey)
Vote on the inclusion of an attribute accessor.protected boolean
includeWriteAttribute(Method method, String beanKey)
Votes on the inclusion of an attribute mutator.protected void
populateAttributeDescriptor(Descriptor desc, Method getter, Method setter, String beanKey)
Adds descriptor fields from theManagedAttribute
attribute or theManagedMetric
attribute to the attribute descriptor.protected void
populateMBeanDescriptor(Descriptor desc, Object managedBean, String beanKey)
Adds descriptor fields from theManagedResource
attribute to the MBean descriptor.protected void
populateOperationDescriptor(Descriptor desc, Method method, String beanKey)
Adds descriptor fields from theManagedAttribute
attribute to the attribute descriptor.void
setAttributeSource(JmxAttributeSource attributeSource)
Set theJmxAttributeSource
implementation to use for reading the metadata from the bean class.从类继承的方法 org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler
applyCurrencyTimeLimit, applyDefaultCurrencyTimeLimit, createModelMBeanOperationInfo, getAttributeInfo, getClassForDescriptor, getDefaultCurrencyTimeLimit, getOperationInfo, getParameterNameDiscoverer, isExposeClassDescriptor, isUseStrictCasing, setDefaultCurrencyTimeLimit, setExposeClassDescriptor, setParameterNameDiscoverer, setUseStrictCasing
从类继承的方法 org.springframework.jmx.export.assembler.AbstractMBeanInfoAssembler
getClassName, getClassToExpose, getClassToExpose, getConstructorInfo, getMBeanInfo, getTargetClass
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.jmx.export.assembler.MBeanInfoAssembler
getMBeanInfo
构造器详细资料
MetadataMBeanInfoAssembler
public MetadataMBeanInfoAssembler()
Create a newMetadataMBeanInfoAssembler
which needs to be configured through thesetAttributeSource(org.springframework.jmx.export.metadata.JmxAttributeSource)
method.
MetadataMBeanInfoAssembler
public MetadataMBeanInfoAssembler(JmxAttributeSource attributeSource)
Create a newMetadataMBeanInfoAssembler
for the givenJmxAttributeSource
.- 参数:
attributeSource
- the JmxAttributeSource to use
方法详细资料
setAttributeSource
public void setAttributeSource(JmxAttributeSource attributeSource)
Set theJmxAttributeSource
implementation to use for reading the metadata from the bean class.
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet
在接口中InitializingBean
checkManagedBean
protected void checkManagedBean(Object managedBean) throws IllegalArgumentException
Throws an IllegalArgumentException if it encounters a JDK dynamic proxy. Metadata can only be read from target classes and CGLIB proxies!- 覆盖:
checkManagedBean
在类中AbstractMBeanInfoAssembler
- 参数:
managedBean
- the bean that will be exposed (might be an AOP proxy)- 抛出:
IllegalArgumentException
- the bean is not valid for exposure
includeBean
public boolean includeBean(Class<?> beanClass, String beanName)
Used for autodetection of beans. Checks to see if the bean's class has aManagedResource
attribute. If so it will add it list of included beans.- 指定者:
includeBean
在接口中AutodetectCapableMBeanInfoAssembler
- 参数:
beanClass
- the class of the beanbeanName
- the name of the bean in the bean factory
includeReadAttribute
protected boolean includeReadAttribute(Method method, String beanKey)
Vote on the inclusion of an attribute accessor.- 指定者:
includeReadAttribute
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
method
- the accessor methodbeanKey
- the key associated with the MBean in the beans map- 返回:
- whether the method has the appropriate metadata
includeWriteAttribute
protected boolean includeWriteAttribute(Method method, String beanKey)
Votes on the inclusion of an attribute mutator.- 指定者:
includeWriteAttribute
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
method
- the mutator methodbeanKey
- the key associated with the MBean in the beans map- 返回:
- whether the method has the appropriate metadata
includeOperation
protected boolean includeOperation(Method method, String beanKey)
Votes on the inclusion of an operation.- 指定者:
includeOperation
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
method
- the operation methodbeanKey
- the key associated with the MBean in the beans map- 返回:
- whether the method has the appropriate metadata
getDescription
protected String getDescription(Object managedBean, String beanKey)
Reads managed resource description from the source level metadata. Returns an emptyString
if no description can be found.- 覆盖:
getDescription
在类中AbstractMBeanInfoAssembler
- 参数:
managedBean
- the bean instance (might be an AOP proxy)beanKey
- the key associated with the MBean in the beans map of theMBeanExporter
getAttributeDescription
protected String getAttributeDescription(PropertyDescriptor propertyDescriptor, String beanKey)
Creates a description for the attribute corresponding to this property descriptor. Attempts to create the description using metadata from either the getter or setter attributes, otherwise uses the property name.- 覆盖:
getAttributeDescription
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
propertyDescriptor
- the PropertyDescriptor for the attributebeanKey
- the key associated with the MBean in the beans map of theMBeanExporter
- 返回:
- the description for the attribute
getOperationDescription
protected String getOperationDescription(Method method, String beanKey)
Retrieves the description for the suppliedMethod
from the metadata. Uses the method name is no description is present in the metadata.- 覆盖:
getOperationDescription
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
method
- the operation methodbeanKey
- the key associated with the MBean in the beans map of theMBeanExporter
- 返回:
- the description for the operation
getOperationParameters
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey)
ReadsMBeanParameterInfo
from theManagedOperationParameter
attributes attached to a method. Returns an empty array ofMBeanParameterInfo
if no attributes are found.- 覆盖:
getOperationParameters
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
method
- theMethod
to get the parameter information forbeanKey
- the key associated with the MBean in the beans map of theMBeanExporter
- 返回:
- the
MBeanParameterInfo
array
getNotificationInfo
protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey)
Reads theManagedNotification
metadata from theClass
of the managed resource and generates and returns the correspondingModelMBeanNotificationInfo
metadata.- 覆盖:
getNotificationInfo
在类中AbstractMBeanInfoAssembler
- 参数:
managedBean
- the bean instance (might be an AOP proxy)beanKey
- the key associated with the MBean in the beans map of theMBeanExporter
- 返回:
- the notification metadata
populateMBeanDescriptor
protected void populateMBeanDescriptor(Descriptor desc, Object managedBean, String beanKey)
Adds descriptor fields from theManagedResource
attribute to the MBean descriptor. Specifically, adds thecurrencyTimeLimit
,persistPolicy
,persistPeriod
,persistLocation
andpersistName
descriptor fields if they are present in the metadata.- 覆盖:
populateMBeanDescriptor
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
desc
- theDescriptor
for the MBean resource.managedBean
- the bean instance (might be an AOP proxy)beanKey
- the key associated with the MBean in the beans map of theMBeanExporter
- 另请参阅:
AbstractReflectiveMBeanInfoAssembler.setDefaultCurrencyTimeLimit(Integer)
,AbstractReflectiveMBeanInfoAssembler.applyDefaultCurrencyTimeLimit(javax.management.Descriptor)
populateAttributeDescriptor
protected void populateAttributeDescriptor(Descriptor desc, @Nullable Method getter, @Nullable Method setter, String beanKey)
Adds descriptor fields from theManagedAttribute
attribute or theManagedMetric
attribute to the attribute descriptor.- 覆盖:
populateAttributeDescriptor
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
desc
- the attribute descriptorgetter
- the accessor method for the attributesetter
- the mutator method for the attributebeanKey
- the key associated with the MBean in the beans map of theMBeanExporter
- 另请参阅:
AbstractReflectiveMBeanInfoAssembler.setDefaultCurrencyTimeLimit(Integer)
,AbstractReflectiveMBeanInfoAssembler.applyDefaultCurrencyTimeLimit(javax.management.Descriptor)
populateOperationDescriptor
protected void populateOperationDescriptor(Descriptor desc, Method method, String beanKey)
Adds descriptor fields from theManagedAttribute
attribute to the attribute descriptor. Specifically, adds thecurrencyTimeLimit
descriptor field if it is present in the metadata.- 覆盖:
populateOperationDescriptor
在类中AbstractReflectiveMBeanInfoAssembler
- 参数:
desc
- the operation descriptormethod
- the method corresponding to the operationbeanKey
- the key associated with the MBean in the beans map of theMBeanExporter
- 另请参阅:
AbstractReflectiveMBeanInfoAssembler.setDefaultCurrencyTimeLimit(Integer)
,AbstractReflectiveMBeanInfoAssembler.applyDefaultCurrencyTimeLimit(javax.management.Descriptor)