views:

261

answers:

2

Is it possible to define a MBean with an array attribute. I currently have an MBean defined as:

<mbean code="corp.app.jmx.DNSServer" name="corp.app:service=DNSServer">
  <attribute name="Server">
    192.168.0.1 192.168.0.2 192.168.0.3
  </attribute>
</mbean>

In the MBean code I then split the String. However - for my next MBean I need to support Strings with spaces in them. I could do a comma-delimited, but I feel sure MBeans will have support for arrays so that I could define them something like this:

<mbean code="corp.app.jmx.DNSServer" name="corp.app:service=DNSServer">
  <attribute name="Server">
    <item>192.168.0.1</item>
    <item>192.168.0.2</item>
    <item>192.168.0.3</item>
  </attribute>
</mbean>

Am I wrong?

A: 

Ah - you can define them like this:

<attribute name="Server">192.168.0.1,192.168.0.2,192.168.0.3</attribute>
Robert Wilson
+1  A: 

You can have a partial DOM as argument and evaluate that in your application. There are actually a few MBeans in the JBoss server that do this (not that I had an example handy .. :-(

Heiko Rupp