Robert Wilson
Robert Wilson

Reputation: 851

JBoss MBeans: How to have an array attribute?

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?

Upvotes: 0

Views: 1455

Answers (2)

Heiko Rupp
Heiko Rupp

Reputation: 30954

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 .. :-(

Upvotes: 1

Robert Wilson
Robert Wilson

Reputation: 851

Ah - you can define them like this:

<attribute name="Server">192.168.0.1,192.168.0.2,192.168.0.3</attribute>

Upvotes: 0

Related Questions