Version 5

    I want to change the outbound JCA implementation classes

     

    Motivation

     

    I want to change part of the JBoss JCA implementation, e.g. the connection pool implementation

     

    Outbound JCA deployment

     

    JBoss uses a -ds.xml file which is a flat xml model that gets transformed into -serivce.xml internally.

     

    As you can see below, the native MBean deployment is pretty complicated so we have simplified it with an XSLT transformation.

     

    Easy way to make the change

     

    1) Deploy your -ds.xml

     

    2) Look at the DEBUG statement in log/server.log that gives the equivalent -service.xml (or equivalently use the xslt in jboss-jca.jar)

    $ jar -tf jboss-jca.jar | grep xsl
    stylesheets/ConnectionFactoryTemplate.xsl
    

     

    e.g. for the default datasource that comes with JBoss you will get something like the follow:

    2007-01-31 17:36:49,574 DEBUG [org.jboss.deployment.XSLSubDeployer] transformed into doc: [#document: null]
    2007-01-31 17:36:49,667 DEBUG [org.jboss.deployment.XSLSubDeployer] transformed into doc: <server>
     <mbean code='org.jboss.resource.connectionmanager.TxConnectionManager' display-name='ConnectionManager for DataSource DefaultDS' name='jboss.jca:service=LocalTxCM,name=DefaultDS'>
      <attribute name='TrackConnectionByTx'>true</attribute>
      <attribute name='LocalTransactions'>true</attribute>
      <depends optional-attribute-name='ManagedConnectionPool'>
       <mbean code='org.jboss.resource.connectionmanager.JBossManagedConnectionPool' display-name='Connection Pool for DataSource DefaultDS' name='jboss.jca:service=ManagedConnectionPool,name=DefaultDS'>
        <depends optional-attribute-name='ManagedConnectionFactoryName'>
         <mbean code='org.jboss.resource.connectionmanager.RARDeployment' display-name='ManagedConnectionFactory for DataSource DefaultDS' name='jboss.jca:service=ManagedConnectionFactory,name=DefaultDS'>
          <depends>jboss:service=Hypersonic,database=localDB</depends>
          <depends optional-attribute-name='OldRarDeployment'>jboss.jca:service=RARDeployment,name='jboss-local-jdbc.rar'</depends>
          <attribute name='RARName'></attribute>
          <attribute name='ConnectionDefinition'>javax.sql.DataSource</attribute>
          <attribute name='ManagedConnectionFactoryProperties'>
           <properties>
            <config-property name='ConnectionURL' type='java.lang.String'>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</config-property>
            <config-property name='DriverClass' type='java.lang.String'>org.hsqldb.jdbcDriver</config-property>
            <config-property name='UserName' type='java.lang.String'>sa</config-property>
            <config-property name='Password' type='java.lang.String'></config-property>
            <config-property name='TrackStatements' type='java.lang.String'></config-property>
            <config-property name='PreparedStatementCacheSize' type='int'>32</config-property>
            <config-property name='ValidateOnMatch' type='boolean'>true</config-property>
           </properties>
          </attribute>
         </mbean>
        </depends>
        <attribute name='PoolJndiName'>DefaultDS</attribute>
        <attribute name='MinSize'>5</attribute>
        <attribute name='MaxSize'>20</attribute>
        <attribute name='BlockingTimeoutMillis'>30000</attribute>
        <attribute name='IdleTimeoutMinutes'>0</attribute>
        <attribute name='BackGroundValidation'>False</attribute>
        <attribute name='BackGroundValidationMinutes'>10</attribute>
        <attribute name='PreFill'>False</attribute>
        <attribute name='Criteria'>ByContainer</attribute>
       </mbean>
      </depends>
      <attribute name='JndiName'>DefaultDS</attribute>
      <depends optional-attribute-name='CachedConnectionManager'>jboss.jca:service=CachedConnectionManager</depends>
      <attribute name='SecurityDomainJndiName'>HsqlDbRealm</attribute>
      <depends optional-attribute-name='JaasSecurityManagerService'>jboss.security:service=JaasSecurityManager</depends>
      <depends optional-attribute-name='TransactionManagerService'>jboss:service=TransactionManager</depends>
     </mbean>
     <mbean code='org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService' display-name='Binding for DataSource DefaultDS' name='jboss.jca:service=DataSourceBinding,name=DefaultDS'>
      <attribute name='JndiName'>DefaultDS</attribute>
      <attribute name='UseJavaContext'>true</attribute>
      <depends optional-attribute-name='ConnectionManager'>jboss.jca:service=LocalTxCM,name=DefaultDS</depends>
      <depends optional-attribute-name='JMXInvokerName'>jboss:service=invoker,type=jrmp</depends>
     </mbean>
     <mbean code='org.jboss.ejb.plugins.cmp.jdbc.metadata.DataSourceMetaData' name='jboss.jdbc:service=metadata,datasource=DefaultDS'>
      <depends optional-attribute-name='MetadataLibrary'>jboss.jdbc:service=metadata</depends>
      <attribute name='TypeMapping'>Hypersonic SQL</attribute>
     </mbean>
     <mbean code='org.jboss.jdbc.HypersonicDatabase' name='jboss:service=Hypersonic,database=localDB'>
      <attribute name='Database'>localDB</attribute>
      <attribute name='InProcessMode'>true</attribute>
     </mbean>
    </server>
    

     

    3) Change it

    -   <mbean code='org.jboss.resource.connectionmanager.JBossManagedConnectionPool' 
    +   <mbean code='com.acme.MyManagedConnectionPool' 
    

     

    4) Deploy the modified -service.xml instead of the -ds.xml

     

    NOTE: This -service.xml ISN'T guaranteed to be portable across releases, so you will have to repeat the excercise with every release for anything permenant.