6 Replies Latest reply on Dec 22, 2008 4:14 AM by makas

    How can persist JCA  Mbean's attributes using PersistenceMan

    makas

      Hi all.
      I have a JCA Connector. When JBoss 4.2.2 GA is started it made four beans for this connector:
      1)jboss.jca:name='rarname.rar', service=RARDeployment
      2)jboss.jca:name='myJndiname', service=ConnectionFactoryBinding
      3)jboss.jca:name='myJndiname', service=ManagedConnectionFactory
      4)jboss.jca:name='myJndiname', service=ManagedConnectionPool.
      Could anyone please tell me the steps to persist the attributes for this beans using PersistenceManager, if it is possible.

        • 1. Re: How can persist JCA  Mbean's attributes using Persistenc
          peterj

          Why would you want to persist the attributes for those beans? What do you think that will buy you? What is the use case for this?

          • 2. Re: How can persist JCA  Mbean's attributes using Persistenc
            makas

            Sorry for cross-port.
            Persistence of the attributes is necessary to I have a possibility to edit JCA connector's parameters and that after reboot JBoss this changes remained.
            I think to do this something like this http://www.jboss.org/community/docs/DOC-12775.
            But, when I specifi the DelegatingPersistenceManager in jboss-service.xml descriptor

            <mbean code="org.jboss.resource.connectionmanager.ConnectionFactoryBindingService"
             name="jboss.jca:name=Aurora/baxi/green/maxi,service=ConnectionFactoryBinding"
             xmbean-dd="">
             <description>PersistentServiceExample</description>
             <descriptors>
             <persistence persistPolicy="OnUpdate"/>
             <persistence-manager value="org.jboss.mx.persistence.DelegatingPersistenceManager"/>
             <descriptor name="attribute-persistence-operation" value="apmCreate"></descriptor>
             </descriptors>
             <class>org.jboss.resource.connectionmanager.ConnectionFactoryBindingService</class>
            
             <!-- Attributes -->
            
             <attribute access="read-write" getMethod="getJndiName" setMethod="setJndiName">
             <name>JndiName</name>
             <type>java.lang.String</type>
             </attribute>
            </mbean>

            I catch MBeanRegistrationException which reports that this bean has been registered.
            How can I say that JBoss will not regist new MBean and persist needed Mbean?

            • 3. Re: How can persist JCA  Mbean's attributes using Persistenc
              peterj

              If you have created a *-service.xml file that deploys the the four mbeans created from *-ds.xml, then you could simply remove the *-ds.xml file. Note that your *-service.xml must contain all four mbeans, not just the one whose attributes you want to persist.

              Caveat: I do not claim that the above will work, I have never tried it.

              • 4. Re: How can persist JCA  Mbean's attributes using Persistenc
                makas

                I can't remove -ds.xml. Access for -ds.xml is banned for me.
                I can create new JMX service that contain in attributes needed JCA MBEAn's attributers, and persist it. When Service is started, I give persistence data and set up it in JCA MBeans.(past this logic in startService() method )

                public class SimpleMBeanIMpl extends ServiceMBeanSupport implements SimpleMBean {
                 private List<AtributesClass> data;
                 protected void startService(){
                 //set up JCa MBeans Attributes
                 }
                 public setData(...){ ...}
                 public getData(){ ...}
                }

                Do you know how is it possible to edit Jca MBean's attributes and restore them after reloading without PersitentManager and more simple than I ?

                • 5. Re: How can persist JCA  Mbean's attributes using Persistenc
                  peterj

                  If the properties whose values you want to persist are read/write, then you could create your own MBean to read and persist the properties, and then reset the properties on a restart. Have your MBean depend on the data source MBean so that it is started in the correct order.

                  • 6. Re: How can persist JCA  Mbean's attributes using Persistenc
                    makas

                    >Have your MBean depend on the data source MBean so that it is started in the correct order?
                    Yes, i have. First of all starts deploy of JCA Connectors and initialization of JCA Mbeans, after that initializes my MBean and starts my service.