org.springframework.jmx.export.assembler

Class MetadataMBeanInfoAssembler

    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Description copied from interface: InitializingBean
        Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, 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.

        Specified by:
        afterPropertiesSet in interface InitializingBean
      • checkManagedBean

        protected void checkManagedBean(java.lang.Object managedBean)
                                 throws java.lang.IllegalArgumentException
        Throws an IllegalArgumentException if it encounters a JDK dynamic proxy. Metadata can only be read from target classes and CGLIB proxies!
        Overrides:
        checkManagedBean in class AbstractMBeanInfoAssembler
        Parameters:
        managedBean - the bean that will be exposed (might be an AOP proxy)
        Throws:
        java.lang.IllegalArgumentException - the bean is not valid for exposure
      • includeBean

        public boolean includeBean(java.lang.Class<?> beanClass,
                                   java.lang.String beanName)
        Used for autodetection of beans. Checks to see if the bean's class has a ManagedResource attribute. If so it will add it list of included beans.
        Specified by:
        includeBean in interface AutodetectCapableMBeanInfoAssembler
        Parameters:
        beanClass - the class of the bean
        beanName - the name of the bean in the bean factory
      • includeReadAttribute

        protected boolean includeReadAttribute(java.lang.reflect.Method method,
                                               java.lang.String beanKey)
        Vote on the inclusion of an attribute accessor.
        Specified by:
        includeReadAttribute in class AbstractReflectiveMBeanInfoAssembler
        Parameters:
        method - the accessor method
        beanKey - the key associated with the MBean in the beans map
        Returns:
        whether the method has the appropriate metadata
      • includeWriteAttribute

        protected boolean includeWriteAttribute(java.lang.reflect.Method method,
                                                java.lang.String beanKey)
        Votes on the inclusion of an attribute mutator.
        Specified by:
        includeWriteAttribute in class AbstractReflectiveMBeanInfoAssembler
        Parameters:
        method - the mutator method
        beanKey - the key associated with the MBean in the beans map
        Returns:
        whether the method has the appropriate metadata
      • includeOperation

        protected boolean includeOperation(java.lang.reflect.Method method,
                                           java.lang.String beanKey)
        Votes on the inclusion of an operation.
        Specified by:
        includeOperation in class AbstractReflectiveMBeanInfoAssembler
        Parameters:
        method - the operation method
        beanKey - the key associated with the MBean in the beans map
        Returns:
        whether the method has the appropriate metadata
      • getDescription

        protected java.lang.String getDescription(java.lang.Object managedBean,
                                                  java.lang.String beanKey)
        Reads managed resource description from the source level metadata. Returns an empty String if no description can be found.
        Overrides:
        getDescription in class AbstractMBeanInfoAssembler
        Parameters:
        managedBean - the bean instance (might be an AOP proxy)
        beanKey - the key associated with the MBean in the beans map of the MBeanExporter
      • getAttributeDescription

        protected java.lang.String getAttributeDescription(java.beans.PropertyDescriptor propertyDescriptor,
                                                           java.lang.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.
        Overrides:
        getAttributeDescription in class AbstractReflectiveMBeanInfoAssembler
        Parameters:
        propertyDescriptor - the PropertyDescriptor for the attribute
        beanKey - the key associated with the MBean in the beans map of the MBeanExporter
        Returns:
        the description for the attribute
      • getOperationDescription

        protected java.lang.String getOperationDescription(java.lang.reflect.Method method,
                                                           java.lang.String beanKey)
        Retrieves the description for the supplied Method from the metadata. Uses the method name is no description is present in the metadata.
        Overrides:
        getOperationDescription in class AbstractReflectiveMBeanInfoAssembler
        Parameters:
        method - the operation method
        beanKey - the key associated with the MBean in the beans map of the MBeanExporter
        Returns:
        the description for the operation
      • getOperationParameters

        protected javax.management.MBeanParameterInfo[] getOperationParameters(java.lang.reflect.Method method,
                                                                               java.lang.String beanKey)
        Reads MBeanParameterInfo from the ManagedOperationParameter attributes attached to a method. Returns an empty array of MBeanParameterInfo if no attributes are found.
        Overrides:
        getOperationParameters in class AbstractReflectiveMBeanInfoAssembler
        Parameters:
        method - the Method to get the parameter information for
        beanKey - the key associated with the MBean in the beans map of the MBeanExporter
        Returns:
        the MBeanParameterInfo array
      • getNotificationInfo

        protected javax.management.modelmbean.ModelMBeanNotificationInfo[] getNotificationInfo(java.lang.Object managedBean,
                                                                                               java.lang.String beanKey)
        Reads the ManagedNotification metadata from the Class of the managed resource and generates and returns the corresponding ModelMBeanNotificationInfo metadata.
        Overrides:
        getNotificationInfo in class AbstractMBeanInfoAssembler
        Parameters:
        managedBean - the bean instance (might be an AOP proxy)
        beanKey - the key associated with the MBean in the beans map of the MBeanExporter
        Returns:
        the notification metadata