Results 1 to 2 of 2

Thread: How do I override the description for an MBean

  1. #1
    Join Date
    Sep 2011
    Posts
    1

    Default 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. #2
    Join Date
    Jan 2012
    Posts
    6

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •