Announcement Announcement Module
Collapse
No announcement yet.
How do I override the description for an MBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I override the description for an MBean

    Hi,

    I've managed to successfully export an MBean using the following:


    <bean id="jmxServer" class="org.springframework.jmx.support.MBeanServer FactoryBean">
    <property name="defaultDomain" value="com.acme.widget" />
    </bean>

    <bean id="assembler" class="org.springframework.jmx.export.assembler.Me tadataMBeanInfoAssembler">
    <property name="attributeSource" ref="attributeSource" />
    </bean>

    <bean id="htmlAdaptor" class="com.sun.jdmk.comm.HtmlAdaptorServer" init-method="start" destroy-method="stop">
    <property name="port" value="7001" />
    </bean>

    <bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <entry key="adaptor:name=htmlAdaptor" value-ref="htmlAdaptor" />
    </map>
    </property>
    <property name="assembler" ref="assembler" />
    <property name="autodetectModeName" value="AUTODETECT_ASSEMBLER" />
    <property name="namingStrategy" ref="namingStrategy" />
    <property name="server" ref="jmxServer" />
    </bean>

    <bean id="attributeSource" class="org.springframework.jmx.export.annotation.A nnotationJmxAttributeSource" />

    <bean id="namingStrategy" class="org.springframework.jmx.export.naming.Metad ataNamingStrategy">
    <property name="attributeSource" ref="attributeSource" />
    </bean>


    I can see my classes/operations/attributes that I annotate but what I also want to do is provide a more "custom" description for the agent. Is there a way I can manually override the getDescription() on the ModelMBeanInfo resource ? ....I managine I'll always be exporting to HTML and what I'd ideally like to do is provide a HTML table in the description detailing a list of elements relevant to the agent.

    I'm a bit of a newbie to JMX so please go easy on me.

    ta

  • #2
    public class AnnotatedStandardMBean extends StandardMBean {

    /** Instance where the MBean interface is implemented by another object. */
    public <T> AnnotatedStandardMBean(T impl, Class<T> mbeanInterface)
    throws NotCompliantMBeanException {
    super(impl, mbeanInterface);
    }

    /** Instance where the MBean interface is implemented by this object. */
    protected AnnotatedStandardMBean(Class<?> mbeanInterface)
    throws NotCompliantMBeanException {
    super(mbeanInterface);
    }

    @Override
    protected String getDescription(MBeanOperationInfo op) {
    ...
    }

    ...other overrides...
    }


    Business School Rankings
    Best MBA Programs

    Comment

    Working...
    X