2 Replies Latest reply on May 7, 2003 11:49 AM by toddrun

    Nesting attributes in MBeans - Stupid Newbie Question

    toddrun

      I just got my first MBean to run (much easier than I expected). Now I'm trying to figure out how to really use MBeans.

      Is there are way to either:
      1) nest "attributes" in the -service.xml file
      2) use the same attribute more than once and have the values placed into an array or collection?

      For example, my little first try has:
      Sam

      And I either want:
      Sam
      HR

      Mary
      Accounting

      which I doubt will work, so I could also work with:
      Sam
      HR
      Mary
      Accouting
      The second option means that the admin is going to have to be really really careful to make sure Name/Depts are in the right order (which is why I don't like it as much).

      Hopefully this gives an idea of what I'm trying to accomplish. Any suggestions are very much appreciated!

        • 1. Re: Nesting attributes in MBeans - Stupid Newbie Question

          You can specify an array, there is a property
          editor for String arrays at least.

          It was broken for a while, but you should be
          able to get the fixed version from cvs.

          The service configurator tries to convert the
          text for an attribute into the correct type of the
          MBean attribute.

          Property editors aren't difficult to write.
          See the java beans docs or look at the jboss
          examples.
          You could write one that converts a comma separated
          value into an ArrayList for example.

          The property editors are also used by the jmx-console.

          Regards,
          Adrian

          • 2. Re: Nesting attributes in MBeans - Stupid Newbie Question
            toddrun

            So, I've taken my simple MBean and changed the one attribute, which was a String type and changed it to String[].

            I can deploy the MBean and the -service.xml file, but the value I get (still just using a single tag in the -service.xml file) is [Ljava.lang.String;@dcdffc and the Type in the MBean view is [Ljava.lang.String;

            Is this the "broken" behavior, or have I mucked it up? BTW, I'm running jboss3.0.4 with tomcat4.1.1 on a RedHat 7.2 system.