Example usage for org.springframework.jmx.export.assembler AutodetectCapableMBeanInfoAssembler includeBean

List of usage examples for org.springframework.jmx.export.assembler AutodetectCapableMBeanInfoAssembler includeBean

Introduction

In this page you can find the example usage for org.springframework.jmx.export.assembler AutodetectCapableMBeanInfoAssembler includeBean.

Prototype

boolean includeBean(Class<?> beanClass, String beanName);

Source Link

Document

Indicate whether a particular bean should be included in the registration process, if it is not specified in the beans map of the MBeanExporter .

Usage

From source file:org.springframework.jmx.export.assembler.AbstractAutodetectTests.java

public void testAutodetect() throws Exception {
    if (Attributes.getAttributes(JmxTestBean.class).size() == 0) {
        return;/*from   www .j av  a2  s.com*/
    }
    JmxTestBean bean = new JmxTestBean();

    AutodetectCapableMBeanInfoAssembler assembler = getAssembler();
    assertTrue("The bean should be included", assembler.includeBean(bean.getClass(), "testBean"));
}

From source file:org.springframework.jmx.export.MBeanExporter.java

/**
 * Invoked when using an <code>AutodetectCapableMBeanInfoAssembler</code>.
 * Gives the assembler the opportunity to add additional beans from the
 * <code>BeanFactory</code> to the list of beans to be exposed via JMX.
 * <p>This implementation prevents a bean from being added to the list
 * automatically if it has already been added manually, and it prevents
 * certain internal classes from being registered automatically.
 *//*from  w w  w  .ja  v a  2s. c  om*/
private void autodetectBeans(final AutodetectCapableMBeanInfoAssembler assembler) {
    autodetect(new AutodetectCallback() {
        public boolean include(Class beanClass, String beanName) {
            return assembler.includeBean(beanClass, beanName);
        }
    });
}