How do I XMBean-ize an existing Standard MBean?
If you want to load an existing Standard MBean as an XMBean (for example,
in order to make it persistent, introduce a jmx interceptor, etc.) then you
obviously need to write an xmbean descriptor. However, writing the xmbean
descriptor is often tedious to do by hand
Starting from JBoss v4.0.3, you can use the new twiddle command
xmbean to connect to a running MBeanServer, query the MBeanInfo
of a specified (running) MBean and print it out in the form
of a JBoss xmbean descriptor.
Then simply redirect the output to a file and use this as a skeleton.
The file should be named XXX-xmbean.xml and be accessible from the root of the CLASSPATH.
You can also use this as a debugging aid, too, to print out the detailed
MBeanInfo available for an MBean, including constructor and notification
information (which is not printed by the twiddle info command).
For example, this is the output when targeting jboss:service=MailServer:
X:\jboss-4.0.3\bin>twiddle xmbean "jboss:service=Mail" <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd"> <!-- xmbean descriptor generated by 'twiddle' on Mon Jun 20 20:08:18 EEST 2005 for 'jboss:service=Mail' --> <mbean> <description>Management Bean.</description> <class>org.jboss.mail.MailService</class> <constructor> <description>MBean Constructor.</description> <name>org.jboss.mail.MailService</name> </constructor> <attribute access='read-only' getMethod='getStateString'> <description>MBean Attribute.</description> <name>StateString</name> <type>java.lang.String</type </attribute> <attribute access='read-only' getMethod='getState'> <description>MBean Attribute.</description> <name>State</name> <type>int</type </attribute> <attribute access='read-write' getMethod='getConfiguration' setMethod='setConfiguration'> <description>MBean Attribute.</description> <name>Configuration</name> <type>org.w3c.dom.Element</type </attribute> <attribute access='read-only' getMethod='getDefaultSender'> <description>MBean Attribute.</description> <name>DefaultSender</name> <type>java.lang.String</type </attribute> <attribute access='read-only' getMethod='getTransportProtocol'> <description>MBean Attribute.</description> <name>TransportProtocol</name> <type>java.lang.String</type </attribute> <attribute access='read-only' getMethod='getPOP3ServerHost'> <description>MBean Attribute.</description> <name>POP3ServerHost</name> <type>java.lang.String</type </attribute> <attribute access='read-only' getMethod='getStoreProtocol'> <description>MBean Attribute.</description> <name>StoreProtocol</name> <type>java.lang.String</type </attribute> <attribute access='read-write' getMethod='getUser' setMethod='setUser'> <description>MBean Attribute.</description> <name>User</name> <type>java.lang.String</type </attribute> <attribute access='read-only' getMethod='getName'> <description>MBean Attribute.</description> <name>Name</name> <type>java.lang.String</type </attribute> <attribute access='read-write' getMethod='getJNDIName' setMethod='setJNDIName'> <description>MBean Attribute.</description> <name>JNDIName</name> <type>java.lang.String</type </attribute> <attribute access='read-only' getMethod='getSMTPServerHost'> <description>MBean Attribute.</description> <name>SMTPServerHost</name> <type>java.lang.String</type </attribute> <attribute access='write-only' setMethod='setPassword'> <description>MBean Attribute.</description> <name>Password</name> <type>java.lang.String</type </attribute> <operation> <description>MBean Operation.</description> <name>start</name> <return-type>void</return-type> </operation> <operation> <description>MBean Operation.</description> <name>jbossInternalLifecycle</name> <parameter> <description></description> <name>p1</name> <type>java.lang.String</type> </parameter <return-type>void</return-type> </operation> <operation> <description>MBean Operation.</description> <name>destroy</name> <return-type>void</return-type> </operation> <operation> <description>MBean Operation.</description> <name>create</name> <return-type>void</return-type> </operation> <operation> <description>MBean Operation.</description> <name>stop</name> <return-type>void</return-type> </operation> </mbean>
Referenced by:
Comments