0 Replies Latest reply on Nov 8, 2006 8:35 AM by bossy

    Map type attribute for an XMBean

    bossy

      I want to include an attribute to an XMBean that is of type Map. I need to store in it key/value pairs. I have a class called ConfigXMBean with methods public Map getMyMapProperty() and public void setMyMapProperty(Map prop). In my config-xmbean.xml file I have the following description:

      <attribute access="read-write" getMethod="getMyMapProperty" setMethod="setMyMapProperty">
       <description>My Map Property </description>
       <name>setMyMapProperty</name>
       <type>java.util.Map</type>
       </attribute>


      I also have the following persistence descriptor for this mbean:
      <descriptors>
       <persistence persistPolicy="OnUpdate"
       persistPeriod="10"
       persistLocation="${jboss.server.data.dir}"
       persistName="JNDIMap.ser"/>
       <currencyTimeLimit value="10"/>
       <state-action-on-update value="keep-running"/>
       <persistence-manager value="org.jboss.mx.persistence.ObjectStreamPersistenceManager" />
       </descriptors>



      The problem is when I change the value of this property by adding an item, it doesn't persist the property - that is when I restart JBoss I loose the item I added before.

      My questions are:
      - is it possible to have a Map attribute for an MBean,
      - if Yes - is it possible to persist it the way I'm trying to do it or am I missing something?
      Thanks.