[jboss-cvs] JBossAS SVN: r108207 - projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 17 11:53:02 EDT 2010


Author: jesper.pedersen
Date: 2010-09-17 11:53:01 -0400 (Fri, 17 Sep 2010)
New Revision: 108207

Modified:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
Log:
[JBJCA-415] [JBJCA-416] Support enabled and overrides

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java	2010-09-17 15:34:46 UTC (rev 108206)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java	2010-09-17 15:53:01 UTC (rev 108207)
@@ -345,155 +345,161 @@
             // ManagedConnectionFactory
             if (cmd.getVersion() == Version.V_10)
             {
-               ManagedConnectionFactory mcf =
-                     (ManagedConnectionFactory) initAndInject(((ResourceAdapter10) cmd.getResourceadapter())
-                           .getManagedConnectionFactoryClass()
-                           .getValue(), ((ResourceAdapter10) cmd.getResourceadapter())
-                           .getConfigProperties(), cl);
-
-               if (trace)
-               {
-                  log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
-                  log.trace("ManagedConnectionFactory defined in classloader: " +
-                         mcf.getClass().getClassLoader());
-               }
-
                org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
-
+                        
                if (ijmd != null)
                {
-                  ijCD = findConnectionDefinition(mcf.getClass().getName(), ijmd.getConnectionDefinitions());
+                  ijCD = findConnectionDefinition(((ResourceAdapter10) cmd.getResourceadapter())
+                                                  .getManagedConnectionFactoryClass().getValue(),
+                                                  ijmd.getConnectionDefinitions());
                }
 
-               mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+               if (ijmd == null || ijCD == null || ijCD.isEnabled())
+               {
+                  ManagedConnectionFactory mcf =
+                     (ManagedConnectionFactory) initAndInject(((ResourceAdapter10) cmd.getResourceadapter())
+                                                              .getManagedConnectionFactoryClass().getValue(), 
+                                                              ((ResourceAdapter10) cmd.getResourceadapter())
+                                                              .getConfigProperties(), cl);
 
-               archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
-                                                               mcf,
-                                                               ((ResourceAdapter10) cmd.getResourceadapter())
-                                                               .getConfigProperties()));
-               beanValidationObjects.add(mcf);
-               associateResourceAdapter(resourceAdapter, mcf);
+                  if (trace)
+                  {
+                     log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                     log.trace("ManagedConnectionFactory defined in classloader: " +
+                               mcf.getClass().getClassLoader());
+                  }
 
-               // Create the pool
-               PoolConfiguration pc = new PoolConfiguration();
-               PoolFactory pf = new PoolFactory();
+                  mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
 
-               Boolean noTxSeparatePool = Boolean.FALSE;
+                  archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                  mcf,
+                                                                  ((ResourceAdapter10) cmd.getResourceadapter())
+                                                                  .getConfigProperties()));
+                  beanValidationObjects.add(mcf);
+                  associateResourceAdapter(resourceAdapter, mcf);
 
-               if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
-               {
-                  org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                     (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                  // Create the pool
+                  PoolConfiguration pc = new PoolConfiguration();
+                  PoolFactory pf = new PoolFactory();
 
-                  if (ijXaPool != null)
-                     noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
-               }
+                  Boolean noTxSeparatePool = Boolean.FALSE;
 
-               Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+                  if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                  {
+                     org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                        (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                     
+                     if (ijXaPool != null)
+                        noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+                  }
 
-               // Add a connection manager
-               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-               ConnectionManager cm = null;
+                  Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+               
+                  // Add a connection manager
+                  ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                  ConnectionManager cm = null;
 
-               TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-               TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                  TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                  TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
 
-               tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
+                  tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
 
-               if (tsmd == TransactionSupportEnum.NoTransaction)
-               {
-                  tsl = TransactionSupportLevel.NoTransaction;
-               }
-               else if (tsmd == TransactionSupportEnum.LocalTransaction)
-               {
-                  tsl = TransactionSupportLevel.LocalTransaction;
-               }
-               else if (tsmd == TransactionSupportEnum.XATransaction)
-               {
-                  tsl = TransactionSupportLevel.XATransaction;
-               }
-               // Section 7.13 -- Read from metadata -> overwrite with specified value if present
-               if (mcf instanceof TransactionSupport)
-                  tsl = ((TransactionSupport) mcf).getTransactionSupport();
+                  if (tsmd == TransactionSupportEnum.NoTransaction)
+                  {
+                     tsl = TransactionSupportLevel.NoTransaction;
+                  }
+                  else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                  {
+                     tsl = TransactionSupportLevel.LocalTransaction;
+                  }
+                  else if (tsmd == TransactionSupportEnum.XATransaction)
+                  {
+                     tsl = TransactionSupportLevel.XATransaction;
+                  }
 
-               // Connection manager properties
-               Integer allocationRetry = null;
-               Long allocationRetryWaitMillis = null;
+                  // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+                  if (mcf instanceof TransactionSupport)
+                     tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
-               if (ijCD != null && ijCD.getTimeOut() != null)
-               {
-                  allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-                  allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
-               }
+                  // Connection manager properties
+                  Integer allocationRetry = null;
+                  Long allocationRetryWaitMillis = null;
 
-               // Select the correct connection manager
-               if (tsl == TransactionSupportLevel.NoTransaction)
-               {
-                  cm = cmf.createNonTransactional(tsl,
-                                                  pool,
-                                                  allocationRetry,
-                                                  allocationRetryWaitMillis);
-               }
-               else
-               {
-                  Boolean interleaving = null;
-                  Integer xaResourceTimeout = null;
-                  Boolean isSameRMOverride = null;
-                  Boolean wrapXAResource = null;
-                  Boolean padXid = null;
+                  if (ijCD != null && ijCD.getTimeOut() != null)
+                  {
+                     allocationRetry = ijCD.getTimeOut().getAllocationRetry();
+                     allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+                  }
 
-                  if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                  // Select the correct connection manager
+                  if (tsl == TransactionSupportLevel.NoTransaction)
                   {
-                     org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                        (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                     cm = cmf.createNonTransactional(tsl,
+                                                     pool,
+                                                     allocationRetry,
+                                                     allocationRetryWaitMillis);
+                  }
+                  else
+                  {
+                     Boolean interleaving = null;
+                     Integer xaResourceTimeout = null;
+                     Boolean isSameRMOverride = null;
+                     Boolean wrapXAResource = null;
+                     Boolean padXid = null;
 
-                     if (ijXaPool != null)
+                     if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
                      {
-                        interleaving = ijXaPool.isInterleaving();
-                        isSameRMOverride = ijXaPool.isSameRmOverride();
-                        wrapXAResource = ijXaPool.isWrapXaDataSource();
-                        padXid = ijXaPool.isPadXid();
+                        org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                           (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                        
+                        if (ijXaPool != null)
+                        {
+                           interleaving = ijXaPool.isInterleaving();
+                           isSameRMOverride = ijXaPool.isSameRmOverride();
+                           wrapXAResource = ijXaPool.isWrapXaDataSource();
+                           padXid = ijXaPool.isPadXid();
+                        }
                      }
+
+                     cm = cmf.createTransactional(tsl,
+                                                  pool,
+                                                  allocationRetry,
+                                                  allocationRetryWaitMillis,
+                                                  getConfiguration().getTransactionManager(),
+                                                  interleaving,
+                                                  xaResourceTimeout,
+                                                  isSameRMOverride,
+                                                  wrapXAResource,
+                                                  padXid);
                   }
 
-                  cm = cmf.createTransactional(tsl,
-                                               pool,
-                                               allocationRetry,
-                                               allocationRetryWaitMillis,
-                                               getConfiguration().getTransactionManager(),
-                                               interleaving,
-                                               xaResourceTimeout,
-                                               isSameRMOverride,
-                                               wrapXAResource,
-                                               padXid);
-               }
-
-               // ConnectionFactory
-               Object cf = mcf.createConnectionFactory(cm);
-
-               if (cf == null)
-               {
-                  log.error("ConnectionFactory is null");
-               }
-               else
-               {
-                  if (trace)
+                  // ConnectionFactory
+                  Object cf = mcf.createConnectionFactory(cm);
+               
+                  if (cf == null)
                   {
-                     log.trace("ConnectionFactory: " + cf.getClass().getName());
-                     log.trace("ConnectionFactory defined in classloader: "
-                           + cf.getClass().getClassLoader());
+                     log.error("ConnectionFactory is null");
                   }
-               }
+                  else
+                  {
+                     if (trace)
+                     {
+                        log.trace("ConnectionFactory: " + cf.getClass().getName());
+                        log.trace("ConnectionFactory defined in classloader: "
+                                  + cf.getClass().getClassLoader());
+                     }
+                  }
 
-               archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                  archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
 
-               if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
-               {
-                  String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
-                  cfs = new Object[] {cf};
-                  jndis = new String[] {jndiNames[0]};
+                  if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+                  {
+                     String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
+                     cfs = new Object[] {cf};
+                     jndis = new String[] {jndiNames[0]};
 
-                  cm.setJndiName(jndiNames[0]);
+                     cm.setJndiName(jndiNames[0]);
+                  }
                }
             }
             else
@@ -510,159 +516,162 @@
                      {
                         ConnectionDefinition cdMeta = cdMetas.get(0);
 
-                        ManagedConnectionFactory mcf =
-                           (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
-                                                                    .getValue(), cdMeta
-                                                                    .getConfigProperties(), cl);
-
-                        if (trace)
-                        {
-                           log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
-                           log.trace("ManagedConnectionFactory defined in classloader: " +
-                                     mcf.getClass().getClassLoader());
-                        }
-
                         org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
-
+                        
                         if (ijmd != null)
                         {
-                           ijCD = findConnectionDefinition(mcf.getClass().getName(), ijmd.getConnectionDefinitions());
+                           ijCD = findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass().getValue(),
+                                                           ijmd.getConnectionDefinitions());
                         }
 
+                        if (ijmd == null || ijCD == null || ijCD.isEnabled())
+                        {
+                           ManagedConnectionFactory mcf =
+                              (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
+                                                                       .getValue(), cdMeta
+                                                                       .getConfigProperties(), cl);
+                           
+                           if (trace)
+                           {
+                              log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                              log.trace("ManagedConnectionFactory defined in classloader: " +
+                                        mcf.getClass().getClassLoader());
+                           }
 
-                        mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+                           mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+                           
+                           archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                           mcf,
+                                                                           cdMeta.getConfigProperties()));
+                           beanValidationObjects.add(mcf);
+                           associateResourceAdapter(resourceAdapter, mcf);
+                           
+                           // Create the pool
+                           PoolConfiguration pc = new PoolConfiguration();
+                           PoolFactory pf = new PoolFactory();
 
-                        archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
-                                                                        mcf,
-                                                                        cdMeta.getConfigProperties()));
-                        beanValidationObjects.add(mcf);
-                        associateResourceAdapter(resourceAdapter, mcf);
+                           Boolean noTxSeparatePool = Boolean.FALSE;
+                        
+                           if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                           {
+                              org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                                 (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                              
+                              if (ijXaPool != null)
+                                 noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+                           }
 
-                        // Create the pool
-                        PoolConfiguration pc = new PoolConfiguration();
-                        PoolFactory pf = new PoolFactory();
-
-                        Boolean noTxSeparatePool = Boolean.FALSE;
-                        
-                        if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
-                        {
-                           org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                              (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                           Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
                            
-                           if (ijXaPool != null)
-                              noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
-                        }
+                           // Add a connection manager
+                           ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                           ConnectionManager cm = null;
+                           TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                           TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
 
-                        Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+                           tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
 
-                        // Add a connection manager
-                        ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                        ConnectionManager cm = null;
-                        TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-                        TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                           if (tsmd == TransactionSupportEnum.NoTransaction)
+                           {
+                              tsl = TransactionSupportLevel.NoTransaction;
+                           }
+                           else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                           {
+                              tsl = TransactionSupportLevel.LocalTransaction;
+                           }
+                           else if (tsmd == TransactionSupportEnum.XATransaction)
+                           {
+                              tsl = TransactionSupportLevel.XATransaction;
+                           }
 
-                        tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
+                           // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+                           if (mcf instanceof TransactionSupport)
+                              tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
-                        if (tsmd == TransactionSupportEnum.NoTransaction)
-                        {
-                           tsl = TransactionSupportLevel.NoTransaction;
-                        }
-                        else if (tsmd == TransactionSupportEnum.LocalTransaction)
-                        {
-                           tsl = TransactionSupportLevel.LocalTransaction;
-                        }
-                        else if (tsmd == TransactionSupportEnum.XATransaction)
-                        {
-                           tsl = TransactionSupportLevel.XATransaction;
-                        }
-
-                        // Section 7.13 -- Read from metadata -> overwrite with specified value if present
-                        if (mcf instanceof TransactionSupport)
-                           tsl = ((TransactionSupport) mcf).getTransactionSupport();
-
-                        // Connection manager properties
-                        Integer allocationRetry = null;
-                        Long allocationRetryWaitMillis = null;
+                           // Connection manager properties
+                           Integer allocationRetry = null;
+                           Long allocationRetryWaitMillis = null;
                         
-                        if (ijCD != null && ijCD.getTimeOut() != null)
-                        {
-                           allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-                           allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
-                        }
-
-                        // Select the correct connection manager
-                        if (tsl == TransactionSupportLevel.NoTransaction)
-                        {
-                           cm = cmf.createNonTransactional(tsl,
+                           if (ijCD != null && ijCD.getTimeOut() != null)
+                           {
+                              allocationRetry = ijCD.getTimeOut().getAllocationRetry();
+                              allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+                           }
+                           
+                           // Select the correct connection manager
+                           if (tsl == TransactionSupportLevel.NoTransaction)
+                           {
+                              cm = cmf.createNonTransactional(tsl,
+                                                              pool,
+                                                              allocationRetry,
+                                                              allocationRetryWaitMillis);
+                           }
+                           else
+                           {
+                              Boolean interleaving = null;
+                              Integer xaResourceTimeout = null;
+                              Boolean isSameRMOverride = null;
+                              Boolean wrapXAResource = null;
+                              Boolean padXid = null;
+                              
+                              if (ijCD != null && ijCD.isXa())
+                              {
+                                 org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                                    (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                                 
+                                 interleaving = ijXaPool.isInterleaving();
+                                 isSameRMOverride = ijXaPool.isSameRmOverride();
+                                 wrapXAResource = ijXaPool.isWrapXaDataSource();
+                                 padXid = ijXaPool.isPadXid();
+                              }
+                           
+                              cm = cmf.createTransactional(tsl,
                                                            pool,
                                                            allocationRetry,
-                                                           allocationRetryWaitMillis);
-                        }
-                        else
-                        {
-                           Boolean interleaving = null;
-                           Integer xaResourceTimeout = null;
-                           Boolean isSameRMOverride = null;
-                           Boolean wrapXAResource = null;
-                           Boolean padXid = null;
+                                                           allocationRetryWaitMillis,
+                                                           getConfiguration().getTransactionManager(),
+                                                           interleaving,
+                                                           xaResourceTimeout,
+                                                           isSameRMOverride,
+                                                           wrapXAResource,
+                                                           padXid);
+                           }
 
-                           if (ijCD != null && ijCD.isXa())
+                           // ConnectionFactory
+                           Object cf = mcf.createConnectionFactory(cm);
+
+                           if (cf == null)
                            {
-                              org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                                 (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-                              
-                              interleaving = ijXaPool.isInterleaving();
-                              isSameRMOverride = ijXaPool.isSameRmOverride();
-                              wrapXAResource = ijXaPool.isWrapXaDataSource();
-                              padXid = ijXaPool.isPadXid();
+                              log.error("ConnectionFactory is null");
                            }
+                           else
+                           {
+                              if (trace)
+                              {
+                                 log.trace("ConnectionFactory: " + cf.getClass().getName());
+                                 log.trace("ConnectionFactory defined in classloader: "
+                                           + cf.getClass().getClassLoader());
+                              }
+                           }
+
+                           archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
                            
-                           cm = cmf.createTransactional(tsl,
-                                                        pool,
-                                                        allocationRetry,
-                                                        allocationRetryWaitMillis,
-                                                        getConfiguration().getTransactionManager(),
-                                                        interleaving,
-                                                        xaResourceTimeout,
-                                                        isSameRMOverride,
-                                                        wrapXAResource,
-                                                        padXid);
-                        }
-
-                        // ConnectionFactory
-                        Object cf = mcf.createConnectionFactory(cm);
-
-                        if (cf == null)
-                        {
-                           log.error("ConnectionFactory is null");
-                        }
-                        else
-                        {
-                           if (trace)
+                           if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
                            {
-                              log.trace("ConnectionFactory: " + cf.getClass().getName());
-                              log.trace("ConnectionFactory defined in classloader: "
-                                        + cf.getClass().getClassLoader());
+                              deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+                              String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
+                              cfs = new Object[] {cf};
+                              jndis = new String[] {jndiNames[0]};
+                              
+                              cm.setJndiName(jndiNames[0]);
                            }
                         }
-
-                        archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
-                        if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+                        else
                         {
-                           deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
-                           String[] jndiNames = bindConnectionFactory(url, deploymentName, cf);
-                           cfs = new Object[] {cf};
-                           jndis = new String[] {jndiNames[0]};
-
-                           cm.setJndiName(jndiNames[0]);
+                           log.warn("There are multiple connection factories for: " + f.getName());
+                           log.warn("Use an ironjacamar.xml or a -ra.xml to activate the deployment");
                         }
                      }
-                     else
-                     {
-                        log.warn("There are multiple connection factories for: " + f.getName());
-                        log.warn("Use an ironjacamar.xml or a -ra.xml to activate the deployment");
-                     }
                   }
                }
             }

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2010-09-17 15:34:46 UTC (rev 108206)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java	2010-09-17 15:53:01 UTC (rev 108207)
@@ -248,148 +248,159 @@
 
                if (activateDeployment)
                {
-                  ManagedConnectionFactory mcf =
-                     (ManagedConnectionFactory) initAndInject(ra10.getManagedConnectionFactoryClass().getValue(),
-                                                              ra10.getConfigProperties(), cl);
-
-                  if (trace)
-                  {
-                     log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
-                     log.trace("ManagedConnectionFactory defined in classloader: " +
-                               mcf.getClass().getClassLoader());
-                  }
-
                   org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
                   
                   if (ijmd != null)
                   {
-                     ijCD = findConnectionDefinition(mcf.getClass().getName(), ijmd.getConnectionDefinitions());
+                     ijCD = findConnectionDefinition(ra10.getManagedConnectionFactoryClass().getValue(),
+                                                     ijmd.getConnectionDefinitions());
                   }
 
-                  mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+                  if (ijmd == null || ijCD == null || ijCD.isEnabled())
+                  {
+                     ManagedConnectionFactory mcf =
+                        (ManagedConnectionFactory) initAndInject(ra10.getManagedConnectionFactoryClass().getValue(),
+                                                                 ra10.getConfigProperties(), cl);
 
-                  archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
-                                                                  mcf, ra10.getConfigProperties()));
-                  beanValidationObjects.add(mcf);
-                  associateResourceAdapter(resourceAdapter, mcf);
+                     if (trace)
+                     {
+                        log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                        log.trace("ManagedConnectionFactory defined in classloader: " +
+                                  mcf.getClass().getClassLoader());
+                     }
 
-                  // Create the pool
-                  PoolConfiguration pc = new PoolConfiguration();
-                  PoolFactory pf = new PoolFactory();
-
-                  Boolean noTxSeparatePool = Boolean.FALSE;
+                     mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+                     
+                     archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                     mcf, ra10.getConfigProperties()));
+                     beanValidationObjects.add(mcf);
+                     associateResourceAdapter(resourceAdapter, mcf);
+                     
+                     // Create the pool
+                     PoolConfiguration pc = new PoolConfiguration();
+                     PoolFactory pf = new PoolFactory();
+                     
+                     Boolean noTxSeparatePool = Boolean.FALSE;
                   
-                  if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
-                  {
-                     org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                        (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                     if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                     {
+                        org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                           (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
                      
-                     if (ijXaPool != null)
-                        noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
-                  }
+                        if (ijXaPool != null)
+                           noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+                     }
 
-                  Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+                     Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+                  
+                     // Add a connection manager
+                     ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                     ConnectionManager cm = null;
 
-                  // Add a connection manager
-                  ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                  ConnectionManager cm = null;
+                     TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                     TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                     
+                     if (ijmd != null && ijmd.getTransactionSupport() != null)
+                     {
+                        tsmd = ijmd.getTransactionSupport();
+                     }
+                     else
+                     {
+                        tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
+                     }
 
-                  TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-                  TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                     if (tsmd == TransactionSupportEnum.NoTransaction)
+                     {
+                        tsl = TransactionSupportLevel.NoTransaction;
+                     }
+                     else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                     {
+                        tsl = TransactionSupportLevel.LocalTransaction;
+                     }
+                     else if (tsmd == TransactionSupportEnum.XATransaction)
+                     {
+                        tsl = TransactionSupportLevel.XATransaction;
+                     }
 
-                  tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
+                     // Connection manager properties
+                     Integer allocationRetry = null;
+                     Long allocationRetryWaitMillis = null;
 
-                  if (tsmd == TransactionSupportEnum.NoTransaction)
-                  {
-                     tsl = TransactionSupportLevel.NoTransaction;
-                  }
-                  else if (tsmd == TransactionSupportEnum.LocalTransaction)
-                  {
-                     tsl = TransactionSupportLevel.LocalTransaction;
-                  }
-                  else if (tsmd == TransactionSupportEnum.XATransaction)
-                  {
-                     tsl = TransactionSupportLevel.XATransaction;
-                  }
+                     if (ijCD != null && ijCD.getTimeOut() != null)
+                     {
+                        allocationRetry = ijCD.getTimeOut().getAllocationRetry();
+                        allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+                     }
+                     
+                     // Select the correct connection manager
+                     if (tsl == TransactionSupportLevel.NoTransaction)
+                     {
+                        cm = cmf.createNonTransactional(tsl,
+                                                        pool,
+                                                        allocationRetry,
+                                                        allocationRetryWaitMillis);
+                     }
+                     else
+                     {
+                        Boolean interleaving = null;
+                        Integer xaResourceTimeout = null;
+                        Boolean isSameRMOverride = null;
+                        Boolean wrapXAResource = null;
+                        Boolean padXid = null;
 
-                  // Connection manager properties
-                  Integer allocationRetry = null;
-                  Long allocationRetryWaitMillis = null;
+                        if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                        {
+                           org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                              (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
 
-                  if (ijCD != null && ijCD.getTimeOut() != null)
-                  {
-                     allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-                     allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
-                  }
+                           if (ijXaPool != null)
+                           {
+                              interleaving = ijXaPool.isInterleaving();
+                              isSameRMOverride = ijXaPool.isSameRmOverride();
+                              wrapXAResource = ijXaPool.isWrapXaDataSource();
+                              padXid = ijXaPool.isPadXid();
+                           }
+                        }
 
-                  // Select the correct connection manager
-                  if (tsl == TransactionSupportLevel.NoTransaction)
-                  {
-                     cm = cmf.createNonTransactional(tsl,
+                        cm = cmf.createTransactional(tsl,
                                                      pool,
                                                      allocationRetry,
-                                                     allocationRetryWaitMillis);
-                  }
-                  else
-                  {
-                     Boolean interleaving = null;
-                     Integer xaResourceTimeout = null;
-                     Boolean isSameRMOverride = null;
-                     Boolean wrapXAResource = null;
-                     Boolean padXid = null;
+                                                     allocationRetryWaitMillis,
+                                                     getConfiguration().getTransactionManager(),
+                                                     interleaving,
+                                                     xaResourceTimeout,
+                                                     isSameRMOverride,
+                                                     wrapXAResource,
+                                                     padXid);
+                     }
 
-                     if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                     // ConnectionFactory
+                     Object cf = mcf.createConnectionFactory(cm);
+
+                     if (cf == null)
                      {
-                        org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                           (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-
-                        if (ijXaPool != null)
+                        log.error("ConnectionFactory is null");
+                     }
+                     else
+                     {
+                        if (trace)
                         {
-                           interleaving = ijXaPool.isInterleaving();
-                           isSameRMOverride = ijXaPool.isSameRmOverride();
-                           wrapXAResource = ijXaPool.isWrapXaDataSource();
-                           padXid = ijXaPool.isPadXid();
+                           log.trace("ConnectionFactory: " + cf.getClass().getName());
+                           log.trace("ConnectionFactory defined in classloader: "
+                                     + cf.getClass().getClassLoader());
                         }
                      }
 
-                     cm = cmf.createTransactional(tsl,
-                                                  pool,
-                                                  allocationRetry,
-                                                  allocationRetryWaitMillis,
-                                                  getConfiguration().getTransactionManager(),
-                                                  interleaving,
-                                                  xaResourceTimeout,
-                                                  isSameRMOverride,
-                                                  wrapXAResource,
-                                                  padXid);
-                  }
+                     archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                     
+                     if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+                     {
+                        String[] jndis = bindConnectionFactory(url, deploymentName, cf);
+                        cfs = new Object[] {cf};
 
-                  // ConnectionFactory
-                  Object cf = mcf.createConnectionFactory(cm);
-
-                  if (cf == null)
-                  {
-                     log.error("ConnectionFactory is null");
-                  }
-                  else
-                  {
-                     if (trace)
-                     {
-                        log.trace("ConnectionFactory: " + cf.getClass().getName());
-                        log.trace("ConnectionFactory defined in classloader: "
-                                  + cf.getClass().getClassLoader());
+                        cm.setJndiName(jndis[0]);
                      }
                   }
-
-                  archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
-
-                  if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
-                  {
-                     String[] jndis = bindConnectionFactory(url, deploymentName, cf);
-                     cfs = new Object[] {cf};
-
-                     cm.setJndiName(jndis[0]);
-                  }
                }
             }
             else
@@ -419,158 +430,168 @@
                         {
                            if (activateDeployment)
                            {
-                              ManagedConnectionFactory mcf =
-                                 (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
-                                                                          .getValue(), cdMeta
-                                                                          .getConfigProperties(), cl);
-
-                              if (trace)
-                              {
-                                 log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
-                                 log.trace("ManagedConnectionFactory defined in classloader: " +
-                                           mcf.getClass().getClassLoader());
-                              }
-                              
                               org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
                               
                               if (ijmd != null)
                               {
-                                 ijCD = findConnectionDefinition(mcf.getClass().getName(), 
+                                 ijCD = findConnectionDefinition(cdMeta.getManagedConnectionFactoryClass().getValue(),
                                                                  ijmd.getConnectionDefinitions());
                               }
 
-                              mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
-
-                              archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
-                                                                              mcf,
-                                                                              cdMeta.getConfigProperties()));
-                              beanValidationObjects.add(mcf);
-                              associateResourceAdapter(resourceAdapter, mcf);
-
-                              // Create the pool
-                              PoolConfiguration pc = new PoolConfiguration();
-                              PoolFactory pf = new PoolFactory();
-
-                              Boolean noTxSeparatePool = Boolean.FALSE;
-                              
-                              if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                              if (ijmd == null || ijCD == null || ijCD.isEnabled())
                               {
-                                 org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                                    (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
-                              
-                                 if (ijXaPool != null)
-                                    noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
-                              }
-                              
-                              Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+                                 ManagedConnectionFactory mcf =
+                                    (ManagedConnectionFactory) initAndInject(cdMeta.getManagedConnectionFactoryClass()
+                                                                             .getValue(), cdMeta
+                                                                             .getConfigProperties(), cl);
 
-                              // Add a connection manager
-                              ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-                              ConnectionManager cm = null;
-                              TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-                              TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
-
-                              tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
-
-                              if (tsmd == TransactionSupportEnum.NoTransaction)
-                              {
-                                 tsl = TransactionSupportLevel.NoTransaction;
-                              }
-                              else if (tsmd == TransactionSupportEnum.LocalTransaction)
-                              {
-                                 tsl = TransactionSupportLevel.LocalTransaction;
-                              }
-                              else if (tsmd == TransactionSupportEnum.XATransaction)
-                              {
-                                 tsl = TransactionSupportLevel.XATransaction;
-                              }
-
-                              // Section 7.13 -- Read from metadata -> overwrite with specified value if present
-                              if (mcf instanceof TransactionSupport)
-                                 tsl = ((TransactionSupport) mcf).getTransactionSupport();
-
-                              // Connection manager properties
-                              Integer allocationRetry = null;
-                              Long allocationRetryWaitMillis = null;
+                                 if (trace)
+                                 {
+                                    log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                                    log.trace("ManagedConnectionFactory defined in classloader: " +
+                                              mcf.getClass().getClassLoader());
+                                 }
                               
-                              if (ijCD != null && ijCD.getTimeOut() != null)
-                              {
-                                 allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-                                 allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
-                              }
-
-                              // Select the correct connection manager
-                              if (tsl == TransactionSupportLevel.NoTransaction)
-                              {
-                                 cm = cmf.createNonTransactional(tsl,
-                                                                 pool,
-                                                                 allocationRetry,
-                                                                 allocationRetryWaitMillis);
-                              }
-                              else
-                              {
-                                 Boolean interleaving = null;
-                                 Integer xaResourceTimeout = null;
-                                 Boolean isSameRMOverride = null;
-                                 Boolean wrapXAResource = null;
-                                 Boolean padXid = null;
+                                 mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+                                 
+                                 archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                                 mcf,
+                                                                                 cdMeta.getConfigProperties()));
+                                 beanValidationObjects.add(mcf);
+                                 associateResourceAdapter(resourceAdapter, mcf);
+                                 
+                                 // Create the pool
+                                 PoolConfiguration pc = new PoolConfiguration();
+                                 PoolFactory pf = new PoolFactory();
+                                 
+                                 Boolean noTxSeparatePool = Boolean.FALSE;
                               
-                                 if (ijCD != null && ijCD.isXa())
+                                 if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
                                  {
                                     org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
                                        (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
                                     
-                                    interleaving = ijXaPool.isInterleaving();
-                                    isSameRMOverride = ijXaPool.isSameRmOverride();
-                                    wrapXAResource = ijXaPool.isWrapXaDataSource();
-                                    padXid = ijXaPool.isPadXid();
+                                    if (ijXaPool != null)
+                                       noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
                                  }
+                              
+                                 Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
 
-                                 cm = cmf.createTransactional(tsl,
-                                                              pool,
-                                                              allocationRetry,
-                                                              allocationRetryWaitMillis,
-                                                              getConfiguration().getTransactionManager(),
-                                                              interleaving,
-                                                              xaResourceTimeout,
-                                                              isSameRMOverride,
-                                                              wrapXAResource,
-                                                              padXid);
-                              }
+                                 // Add a connection manager
+                                 ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                                 ConnectionManager cm = null;
+                                 TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                                 TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
 
-                              // ConnectionFactory
-                              Object cf = mcf.createConnectionFactory(cm);
+                                 if (ijmd != null && ijmd.getTransactionSupport() != null)
+                                 {
+                                    tsmd = ijmd.getTransactionSupport();
+                                 }
+                                 else
+                                 {
+                                    tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
+                                 }
 
-                              if (cf == null)
-                              {
-                                 log.error("ConnectionFactory is null");
-                              }
-                              else
-                              {
-                                 if (trace)
+                                 if (tsmd == TransactionSupportEnum.NoTransaction)
                                  {
-                                    log.trace("ConnectionFactory: " + cf.getClass().getName());
-                                    log.trace("ConnectionFactory defined in classloader: "
-                                              + cf.getClass().getClassLoader());
+                                    tsl = TransactionSupportLevel.NoTransaction;
                                  }
-                              }
+                                 else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                                 {
+                                    tsl = TransactionSupportLevel.LocalTransaction;
+                                 }
+                                 else if (tsmd == TransactionSupportEnum.XATransaction)
+                                 {
+                                    tsl = TransactionSupportLevel.XATransaction;
+                                 }
 
-                              archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                                 // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+                                 if (mcf instanceof TransactionSupport)
+                                    tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
-                              if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
-                              {
-                                 if (cdMetas.size() == 1)
+                                 // Connection manager properties
+                                 Integer allocationRetry = null;
+                                 Long allocationRetryWaitMillis = null;
+                              
+                                 if (ijCD != null && ijCD.getTimeOut() != null)
                                  {
-                                    deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
-                                    String[] jndis = bindConnectionFactory(url, deploymentName, cf);
-                                    cfs = new Object[] {cf};
+                                    allocationRetry = ijCD.getTimeOut().getAllocationRetry();
+                                    allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+                                 }
 
-                                    cm.setJndiName(jndis[0]);
+                                 // Select the correct connection manager
+                                 if (tsl == TransactionSupportLevel.NoTransaction)
+                                 {
+                                    cm = cmf.createNonTransactional(tsl,
+                                                                    pool,
+                                                                    allocationRetry,
+                                                                    allocationRetryWaitMillis);
                                  }
                                  else
                                  {
-                                    log.warn("NYI: There are multiple connection factories for: " + f.getName());
+                                    Boolean interleaving = null;
+                                    Integer xaResourceTimeout = null;
+                                    Boolean isSameRMOverride = null;
+                                    Boolean wrapXAResource = null;
+                                    Boolean padXid = null;
+                              
+                                    if (ijCD != null && ijCD.isXa())
+                                    {
+                                       org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                                          (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                                    
+                                       interleaving = ijXaPool.isInterleaving();
+                                       isSameRMOverride = ijXaPool.isSameRmOverride();
+                                       wrapXAResource = ijXaPool.isWrapXaDataSource();
+                                       padXid = ijXaPool.isPadXid();
+                                    }
+
+                                    cm = cmf.createTransactional(tsl,
+                                                                 pool,
+                                                                 allocationRetry,
+                                                                 allocationRetryWaitMillis,
+                                                                 getConfiguration().getTransactionManager(),
+                                                                 interleaving,
+                                                                 xaResourceTimeout,
+                                                                 isSameRMOverride,
+                                                                 wrapXAResource,
+                                                                 padXid);
                                  }
+
+                                 // ConnectionFactory
+                                 Object cf = mcf.createConnectionFactory(cm);
+
+                                 if (cf == null)
+                                 {
+                                    log.error("ConnectionFactory is null");
+                                 }
+                                 else
+                                 {
+                                    if (trace)
+                                    {
+                                       log.trace("ConnectionFactory: " + cf.getClass().getName());
+                                       log.trace("ConnectionFactory defined in classloader: "
+                                                 + cf.getClass().getClassLoader());
+                                    }
+                                 }
+
+                                 archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                                 
+                                 if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+                                 {
+                                    if (cdMetas.size() == 1)
+                                    {
+                                       deploymentName = f.getName().substring(0, f.getName().indexOf(".rar"));
+                                       String[] jndis = bindConnectionFactory(url, deploymentName, cf);
+                                       cfs = new Object[] {cf};
+                                       
+                                       cm.setJndiName(jndis[0]);
+                                    }
+                                    else
+                                    {
+                                       log.warn("NYI: There are multiple connection factories for: " + f.getName());
+                                    }
+                                 }
                               }
                            }
                         }

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java	2010-09-17 15:34:46 UTC (rev 108206)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java	2010-09-17 15:53:01 UTC (rev 108207)
@@ -350,160 +350,215 @@
             if (cmd.getVersion() == Version.V_10)
             {
 
-               ManagedConnectionFactory mcf =
-                     (ManagedConnectionFactory) initAndInject(((ResourceAdapter10) cmd.getResourceadapter())
-                           .getManagedConnectionFactoryClass()
-                           .getValue(), ((ResourceAdapter10) cmd.getResourceadapter())
-                           .getConfigProperties(), cl);
+               org.jboss.jca.common.api.metadata.common.CommonConnDef cdRaXml =
+                  findConnectionDefinition(((ResourceAdapter10) cmd.getResourceadapter())
+                                           .getManagedConnectionFactoryClass().getValue(),
+                                           raxml.getConnectionDefinitions());
 
-               if (trace)
+               if (cdRaXml != null && cdRaXml.isEnabled())
                {
-                  log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
-                  log.trace("ManagedConnectionFactory defined in classloader: " +
-                         mcf.getClass().getClassLoader());
-               }
+                  ManagedConnectionFactory mcf =
+                     (ManagedConnectionFactory) initAndInject(((ResourceAdapter10) cmd.getResourceadapter())
+                                                              .getManagedConnectionFactoryClass().getValue(),
+                                                              ((ResourceAdapter10) cmd.getResourceadapter())
+                                                              .getConfigProperties(), cl);
+                  
+                  if (trace)
+                  {
+                     log.trace("ManagedConnectionFactory: " + mcf.getClass().getName());
+                     log.trace("ManagedConnectionFactory defined in classloader: " +
+                               mcf.getClass().getClassLoader());
+                  }
 
-               org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
+                  org.jboss.jca.common.api.metadata.common.CommonConnDef ijCD = null;
 
-               if (ijmd != null)
-               {
-                  ijCD = findConnectionDefinition(mcf.getClass().getName(), ijmd.getConnectionDefinitions());
-               }
+                  if (ijmd != null)
+                  {
+                     ijCD = findConnectionDefinition(mcf.getClass().getName(), ijmd.getConnectionDefinitions());
+                  }
 
-               mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+                  mcf.setLogWriter(new PrintWriter(getConfiguration().getPrintStream()));
+                  
+                  archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
+                                                                  mcf,
+                                                                  ((ResourceAdapter10) cmd.getResourceadapter())
+                                                                  .getConfigProperties()));
+                  beanValidationObjects.add(mcf);
+                  associateResourceAdapter(resourceAdapter, mcf);
 
-               archiveValidationObjects.add(new ValidateObject(Key.MANAGED_CONNECTION_FACTORY,
-                                                               mcf,
-                                                               ((ResourceAdapter10) cmd.getResourceadapter())
-                                                               .getConfigProperties()));
-               beanValidationObjects.add(mcf);
-               associateResourceAdapter(resourceAdapter, mcf);
+                  // Create the pool
+                  PoolConfiguration pc = new PoolConfiguration();
+                  PoolFactory pf = new PoolFactory();
+                  
+                  Boolean noTxSeparatePool = Boolean.FALSE;
+                  
+                  if (cdRaXml.getPool() != null && cdRaXml.isXa())
+                  {
+                     org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                        (org.jboss.jca.common.api.metadata.common.CommonXaPool)cdRaXml.getPool();
 
-               // Create the pool
-               PoolConfiguration pc = new PoolConfiguration();
-               PoolFactory pf = new PoolFactory();
+                     if (ijXaPool != null)
+                        noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+                  }
+                  else if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                  {
+                     org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                        (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                     
+                     if (ijXaPool != null)
+                        noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+                  }
 
-               Boolean noTxSeparatePool = Boolean.FALSE;
-               
-               if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
-               {
-                  org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                     (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                  Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+                  
+                  // Add a connection manager
+                  ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+                  ConnectionManager cm = null;
+                  
+                  TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
+                  TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                  
+                  if (raxml.getTransactionSupport() != null)
+                  {
+                     tsmd = raxml.getTransactionSupport();
+                  }
+                  else if (ijmd != null && ijmd.getTransactionSupport() != null)
+                  {
+                     tsmd = ijmd.getTransactionSupport();
+                  }
+                  else
+                  {
+                     tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
+                  }
 
-                  if (ijXaPool != null)
-                     noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
-               }
+                  if (tsmd == TransactionSupportEnum.NoTransaction)
+                  {
+                     tsl = TransactionSupportLevel.NoTransaction;
+                  }
+                  else if (tsmd == TransactionSupportEnum.LocalTransaction)
+                  {
+                     tsl = TransactionSupportLevel.LocalTransaction;
+                  }
+                  else if (tsmd == TransactionSupportEnum.XATransaction)
+                  {
+                     tsl = TransactionSupportLevel.XATransaction;
+                  }
 
-               Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, noTxSeparatePool.booleanValue());
+                  // Section 7.13 -- Read from metadata -> overwrite with specified value if present
+                  if (mcf instanceof TransactionSupport)
+                     tsl = ((TransactionSupport) mcf).getTransactionSupport();
 
-               // Add a connection manager
-               ConnectionManagerFactory cmf = new ConnectionManagerFactory();
-               ConnectionManager cm = null;
+                  // Connection manager properties
+                  Integer allocationRetry = null;
+                  Long allocationRetryWaitMillis = null;
 
-               TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
-               TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
+                  if (cdRaXml.getTimeOut() != null)
+                  {
+                     allocationRetry = cdRaXml.getTimeOut().getAllocationRetry();
+                     allocationRetryWaitMillis = cdRaXml.getTimeOut().getAllocationRetryWaitMillis();
+                  }
 
-               tsmd = ((ResourceAdapter10) cmd.getResourceadapter()).getTransactionSupport();
+                  if (ijCD != null && ijCD.getTimeOut() != null)
+                  {
+                     if (allocationRetry == null)
+                        allocationRetry = ijCD.getTimeOut().getAllocationRetry();
 
-               if (tsmd == TransactionSupportEnum.NoTransaction)
-               {
-                  tsl = TransactionSupportLevel.NoTransaction;
-               }
-               else if (tsmd == TransactionSupportEnum.LocalTransaction)
-               {
-                  tsl = TransactionSupportLevel.LocalTransaction;
-               }
-               else if (tsmd == TransactionSupportEnum.XATransaction)
-               {
-                  tsl = TransactionSupportLevel.XATransaction;
-               }
-               // Section 7.13 -- Read from metadata -> overwrite with specified value if present
-               if (mcf instanceof TransactionSupport)
-                  tsl = ((TransactionSupport) mcf).getTransactionSupport();
+                     if (allocationRetryWaitMillis == null)
+                        allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+                  }
 
-               // Connection manager properties
-               Integer allocationRetry = null;
-               Long allocationRetryWaitMillis = null;
-
-               if (ijCD != null && ijCD.getTimeOut() != null)
-               {
-                  allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-                  allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
-               }
-
-               // Select the correct connection manager
-               if (tsl == TransactionSupportLevel.NoTransaction)
-               {
-                  cm = cmf.createNonTransactional(tsl,
-                                                  pool,
-                                                  allocationRetry,
-                                                  allocationRetryWaitMillis);
-               }
-               else
-               {
-                  Boolean interleaving = null;
-                  Integer xaResourceTimeout = null;
-                  Boolean isSameRMOverride = null;
-                  Boolean wrapXAResource = null;
-                  Boolean padXid = null;
-
-                  if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                  // Select the correct connection manager
+                  if (tsl == TransactionSupportLevel.NoTransaction)
                   {
-                     org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                        (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                     cm = cmf.createNonTransactional(tsl,
+                                                     pool,
+                                                     allocationRetry,
+                                                     allocationRetryWaitMillis);
+                  }
+                  else
+                  {
+                     Boolean interleaving = null;
+                     Integer xaResourceTimeout = null;
+                     Boolean isSameRMOverride = null;
+                     Boolean wrapXAResource = null;
+                     Boolean padXid = null;
 
-                     if (ijXaPool != null)
+                     if (cdRaXml.isXa())
                      {
+                        org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                           (org.jboss.jca.common.api.metadata.common.CommonXaPool)cdRaXml.getPool();
+                        
                         interleaving = ijXaPool.isInterleaving();
                         isSameRMOverride = ijXaPool.isSameRmOverride();
                         wrapXAResource = ijXaPool.isWrapXaDataSource();
                         padXid = ijXaPool.isPadXid();
                      }
-                  }
 
-                  cm = cmf.createTransactional(tsl,
-                                               pool,
-                                               allocationRetry,
-                                               allocationRetryWaitMillis,
-                                               getConfiguration().getTransactionManager(),
-                                               interleaving,
-                                               xaResourceTimeout,
-                                               isSameRMOverride,
-                                               wrapXAResource,
-                                               padXid);
-               }
+                     if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                     {
+                        org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                           (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                        
+                        if (ijXaPool != null)
+                        {
+                           if (interleaving == null)
+                              interleaving = ijXaPool.isInterleaving();
 
-               // ConnectionFactory
-               Object cf = mcf.createConnectionFactory(cm);
+                           if (isSameRMOverride == null)
+                              isSameRMOverride = ijXaPool.isSameRmOverride();
 
-               if (cf == null)
-               {
-                  log.error("ConnectionFactory is null");
-               }
-               else
-               {
-                  if (trace)
-                  {
-                     log.trace("ConnectionFactory: " + cf.getClass().getName());
-                     log.trace("ConnectionFactory defined in classloader: "
-                           + cf.getClass().getClassLoader());
-                  }
-               }
+                           if (wrapXAResource == null)
+                              wrapXAResource = ijXaPool.isWrapXaDataSource();
 
-               archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
+                           if (padXid == null)
+                              padXid = ijXaPool.isPadXid();
+                        }
+                     }
 
-               if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
-               {
-                  org.jboss.jca.common.api.metadata.common.CommonConnDef cd =
-                     findConnectionDefinition(mcf.getClass().getName(), raxml.getConnectionDefinitions());
+                     cm = cmf.createTransactional(tsl,
+                                                  pool,
+                                                  allocationRetry,
+                                                  allocationRetryWaitMillis,
+                                                  getConfiguration().getTransactionManager(),
+                                                  interleaving,
+                                                  xaResourceTimeout,
+                                                  isSameRMOverride,
+                                                  wrapXAResource,
+                                                  padXid);
+                  }
 
-                  String jndiName = cd.getJndiName();
+                  // ConnectionFactory
+                  Object cf = mcf.createConnectionFactory(cm);
+                  
+                  if (cf == null)
+                  {
+                     log.error("ConnectionFactory is null");
+                  }
+                  else
+                  {
+                     if (trace)
+                     {
+                        log.trace("ConnectionFactory: " + cf.getClass().getName());
+                        log.trace("ConnectionFactory defined in classloader: "
+                                  + cf.getClass().getClassLoader());
+                     }
+                  }
 
-                  bindConnectionFactory(deployment, deploymentName, cf, jndiName);
-                  cfs = new Object[] {cf};
-                  jndiNames = new String[] {jndiName};
+                  archiveValidationObjects.add(new ValidateObject(Key.CONNECTION_FACTORY, cf));
 
-                  cm.setJndiName(jndiName);
+                  if (cf != null && cf instanceof Serializable && cf instanceof Referenceable)
+                  {
+                     org.jboss.jca.common.api.metadata.common.CommonConnDef cd =
+                        findConnectionDefinition(mcf.getClass().getName(), raxml.getConnectionDefinitions());
+                     
+                     String jndiName = cd.getJndiName();
+                     
+                     bindConnectionFactory(deployment, deploymentName, cf, jndiName);
+                     cfs = new Object[] {cf};
+                     jndiNames = new String[] {jndiName};
+                     
+                     cm.setJndiName(jndiName);
+                  }
                }
             }
             else
@@ -565,9 +620,17 @@
 
                            Boolean noTxSeparatePool = Boolean.FALSE;
                
-                           if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                           if (cdRaXml.getPool() != null && cdRaXml.isXa())
                            {
                               org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                                 (org.jboss.jca.common.api.metadata.common.CommonXaPool)cdRaXml.getPool();
+                              
+                              if (ijXaPool != null)
+                                 noTxSeparatePool = ijXaPool.isNoTxSeparatePool();
+                           }
+                           else if (ijCD != null && ijCD.getPool() != null && ijCD.isXa())
+                           {
+                              org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
                                  (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
                               
                               if (ijXaPool != null)
@@ -582,7 +645,18 @@
                            TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
                            TransactionSupportEnum tsmd = TransactionSupportEnum.NoTransaction;
 
-                           tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
+                           if (raxml.getTransactionSupport() != null)
+                           {
+                              tsmd = raxml.getTransactionSupport();
+                           }
+                           else if (ijmd != null && ijmd.getTransactionSupport() != null)
+                           {
+                              tsmd = ijmd.getTransactionSupport();
+                           }
+                           else
+                           {
+                              tsmd = ra.getOutboundResourceadapter().getTransactionSupport();
+                           }
 
                            if (tsmd == TransactionSupportEnum.NoTransaction)
                            {
@@ -605,10 +679,19 @@
                            Integer allocationRetry = null;
                            Long allocationRetryWaitMillis = null;
 
+                           if (cdRaXml.getTimeOut() != null)
+                           {
+                              allocationRetry = cdRaXml.getTimeOut().getAllocationRetry();
+                              allocationRetryWaitMillis = cdRaXml.getTimeOut().getAllocationRetryWaitMillis();
+                           }
+
                            if (ijCD != null && ijCD.getTimeOut() != null)
                            {
-                              allocationRetry = ijCD.getTimeOut().getAllocationRetry();
-                              allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
+                              if (allocationRetry == null)
+                                 allocationRetry = ijCD.getTimeOut().getAllocationRetry();
+
+                              if (allocationRetryWaitMillis == null)
+                                 allocationRetryWaitMillis = ijCD.getTimeOut().getAllocationRetryWaitMillis();
                            }
 
                            // Select the correct connection manager
@@ -627,10 +710,10 @@
                               Boolean wrapXAResource = null;
                               Boolean padXid = null;
                               
-                              if (ijCD != null && ijCD.isXa())
+                              if (cdRaXml.isXa())
                               {
                                  org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
-                                    (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                                    (org.jboss.jca.common.api.metadata.common.CommonXaPool)cdRaXml.getPool();
                                  
                                  interleaving = ijXaPool.isInterleaving();
                                  isSameRMOverride = ijXaPool.isSameRmOverride();
@@ -638,6 +721,24 @@
                                  padXid = ijXaPool.isPadXid();
                               }
 
+                              if (ijCD != null && ijCD.isXa())
+                              {
+                                 org.jboss.jca.common.api.metadata.common.CommonXaPool ijXaPool =
+                                    (org.jboss.jca.common.api.metadata.common.CommonXaPool)ijCD.getPool();
+                                 
+                                 if (interleaving == null)
+                                    interleaving = ijXaPool.isInterleaving();
+
+                                 if (isSameRMOverride == null)
+                                    isSameRMOverride = ijXaPool.isSameRmOverride();
+
+                                 if (wrapXAResource == null)
+                                    wrapXAResource = ijXaPool.isWrapXaDataSource();
+
+                                 if (padXid == null)
+                                    padXid = ijXaPool.isPadXid();
+                              }
+
                               cm = cmf.createTransactional(tsl,
                                                            pool,
                                                            allocationRetry,
@@ -798,6 +899,20 @@
                }
             }
 
+            if (groupsClasses == null &&
+                ijmd != null &&
+                ijmd.getBeanValidationGroups() != null &&
+                ijmd.getBeanValidationGroups().size() > 0)
+            {
+               List<String> groups = ijmd.getBeanValidationGroups();
+
+               groupsClasses = new ArrayList<Class>(groups.size());
+               for (String group : groups)
+               {
+                  groupsClasses.add(Class.forName(group, true, cl));
+               }
+            }
+
             if (beanValidationObjects.size() > 0)
             {
                BeanValidation beanValidator = new BeanValidation();
@@ -819,6 +934,14 @@
                bootstrapIdentifier = raxml.getBootstrapContext();
             }
 
+            if (bootstrapIdentifier == null &&
+                ijmd != null &&
+                ijmd.getBootstrapContext() != null &&
+                !ijmd.getBootstrapContext().trim().equals(""))
+            {
+               bootstrapIdentifier = ijmd.getBootstrapContext();
+            }
+
             startContext(resourceAdapter, bootstrapIdentifier);
          }
 



More information about the jboss-cvs-commits mailing list