Announcement Announcement Module
No announcement yet.
MBeanProxyFactoryBean + MetadataMBeanInfoAssembler Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MBeanProxyFactoryBean + MetadataMBeanInfoAssembler

    I have successfully exported a bean using MetadataMBeanInfoAssembler. Here is my object:

    @ManagedResource(description = "Manage")
    public class Mbean implements Configurer, BeanNameAware {
    	private String name;
    	@ManagedOperation(description = "Get Levels")
    	public Map<String, String> getLevels() {
    		Map<String, String> levels = new HashMap<String, String>();
    		return levels;
    As you can see, the "getLevels" method is an operation. Here is my spring config to export the object, it is working well:
    HTML Code:
    	<bean id="configurer" class="com.Mbean" />
    	<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
    		<property name="assembler" ref="assembler" />
    		<property name="namingStrategy" ref="namingStrategy" />
    		<property name="autodetect" value="true" />
    	<bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
    	<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
    		<property name="attributeSource" ref="jmxAttributeSource" />
    	<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
    		<property name="attributeSource" ref="jmxAttributeSource" />
    The problem is when connecting to this object client-side. Whenever i attempt to use the getLevels() method, the MBeanProxyFactoryBean automatically assumes that Levels is an attribute, because it starts with "get", when in fact I have it marked, both on my object and in the jmx repository, as an operation. Is there a way to enhance the MBeanProxyFactoryBean to interpret it correctly? As a workaround, i changed the method from "getLevels()" to "findLevels()", and it works fine. Is it possible for the MBeanProxyFactoryBean to also use a configurable AttributeSource to determine whether an invocation should be for an attribute or on operation?