3 Replies Latest reply on Nov 2, 2006 10:15 AM by dimitris

    Dynamicly adding attributes to MBean

    bossy

      Hi,
      I need to use JMX for configuration purposes in my app. I have an MBean that has most of my configuration properties. These appear fine in JMX Web console, I can change their values and so on. The problem is I know that in the feature I'll need to add more properties that i'm going to use dynamically(for example adding a host name and a corresponding value). I cannot hard code these as attributes, because I don't even know how are they going to be called. I tried adding an attribute with type Map, but that makes things very messy. The implementation of the MBean I was given to use as a base is as follows:
      1. I have class SomeXMBean that extends ServiceMBeanSupport
      it has all the getters/setters for the attributes as well as stopService() and startService()
      2. In jboss-service.xml I have a definition for this mbean. Its "xmbean-dd" attribute points to another xml file that describes the MBean with its attributes, their types etc.
      3. This is all packed in a sar file.
      My question is - is it possible to create an MBean for which you don't declare the attributes in advance, but create them at runtime. Also is it possible to do it using this deployment mechanism, or do I have to register and work with the MBean programatically?
      Any help would be greatly appreciated.
      Thanks