Spring Framework MetadataMBeanInfoAssembler - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MetadataMBeanInfoAssembler class.

This code example shows how to use the following methods:setAttributeSource
    private static final Logger LOG = LoggerFactory.getLogger(SpringManagementMBeanAssembler.class); 
    private final MetadataMBeanInfoAssembler springAssembler;
    public SpringManagementMBeanAssembler(CamelContext camelContext) {
        this.springAssembler = new MetadataMBeanInfoAssembler();
        this.springAssembler.setAttributeSource(new AnnotationJmxAttributeSource());
    public ModelMBean assemble(MBeanServer mBeanServer, Object obj, ObjectName name) throws JMException {
        ModelMBeanInfo mbi = null;
        // prefer to use the managed instance if it has been annotated with Spring JMX annotations 
        if (obj instanceof ManagedInstance) {
            Object custom = ((ManagedInstance) obj).getInstance();
            if (custom != null && ObjectHelper.hasAnnotation(custom.getClass().getAnnotations(), ManagedResource.class)) {
                LOG.trace("Assembling MBeanInfo for: {} from custom @ManagedResource object: {}", name, custom);
                // get the mbean info from the custom managed object 
                mbi = springAssembler.getMBeanInfo(custom, name.toString());
                // and let the custom object be registered in JMX 
See Code Examples for Spring Framework MetadataMBeanInfoAssembler Methods: