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

  • How do I override the description for an MBean


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

    <bean id="jmxServer" class=" FactoryBean">
    <property name="defaultDomain" value="com.acme.widget" />

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

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

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

    <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" />

    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.


  • #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 {

    protected String getDescription(MBeanOperationInfo op) {

    ...other overrides...

    Business School Rankings
    Best MBA Programs