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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 28 09:11:04 EDT 2011


Author: jesper.pedersen
Date: 2011-03-28 09:11:04 -0400 (Mon, 28 Mar 2011)
New Revision: 111044

Modified:
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
Log:
[JBJCA-535] Only activate enabled datasources

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java	2011-03-28 10:49:41 UTC (rev 111043)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java	2011-03-28 13:11:04 UTC (rev 111044)
@@ -194,31 +194,34 @@
 
                for (DataSource dataSource : ds)
                {
-                  try
+                  if (dataSource.isEnabled())
                   {
-                     String jndiName = dataSource.getJndiName();
-
-                     if (dataSource.isUseJavaContext() != null && dataSource.isUseJavaContext().booleanValue() &&
-                         !jndiName.startsWith("java:/"))
+                     try
                      {
-                        jndiName = "java:/" + jndiName;
-                     }
+                        String jndiName = dataSource.getJndiName();
 
-                     org.jboss.jca.core.api.management.DataSource mgtDataSource =
-                        new org.jboss.jca.core.api.management.DataSource(false);
-                     Object cf = deployDataSource(dataSource, jndiName, 
-                                                  uniqueJdbcLocalId, mgtDataSource, jdbcLocalDeploymentCl);
+                        if (dataSource.isUseJavaContext() != null && dataSource.isUseJavaContext().booleanValue() &&
+                            !jndiName.startsWith("java:/"))
+                        {
+                           jndiName = "java:/" + jndiName;
+                        }
 
-                     bindConnectionFactory(deploymentName, jndiName, cf);
+                        org.jboss.jca.core.api.management.DataSource mgtDataSource =
+                           new org.jboss.jca.core.api.management.DataSource(false);
+                        Object cf = deployDataSource(dataSource, jndiName, 
+                                                     uniqueJdbcLocalId, mgtDataSource, jdbcLocalDeploymentCl);
 
-                     cfs.add(cf);
-                     jndis.add(jndiName);
-                     mgts.add(mgtDataSource);
+                        bindConnectionFactory(deploymentName, jndiName, cf);
+                        
+                        cfs.add(cf);
+                        jndis.add(jndiName);
+                        mgts.add(mgtDataSource);
+                     }
+                     catch (Throwable t)
+                     {
+                        log.error("Error during the deployment of " + dataSource.getJndiName(), t);
+                     }
                   }
-                  catch (Throwable t)
-                  {
-                     log.error("Error during the deployment of " + dataSource.getJndiName(), t);
-                  }
                }
             }
          }
@@ -237,37 +240,40 @@
 
                for (XaDataSource xaDataSource : xads)
                {
-                  try
+                  if (xaDataSource.isEnabled())
                   {
-                     String jndiName = xaDataSource.getJndiName();
-
-                     if (xaDataSource.isUseJavaContext() != null && xaDataSource.isUseJavaContext().booleanValue() &&
-                         !jndiName.startsWith("java:/"))
+                     try
                      {
-                        jndiName = "java:/" + jndiName;
-                     }
+                        String jndiName = xaDataSource.getJndiName();
 
-                     org.jboss.jca.core.api.management.DataSource mgtDataSource =
-                        new org.jboss.jca.core.api.management.DataSource(true);
-                     XAResourceRecovery recovery = null;
-                     Object cf = deployXADataSource(xaDataSource,
-                                                    jndiName, uniqueJdbcXAId,
-                                                    recovery,
-                                                    mgtDataSource,
-                                                    jdbcXADeploymentCl);
+                        if (xaDataSource.isUseJavaContext() != null && xaDataSource.isUseJavaContext().booleanValue() &&
+                            !jndiName.startsWith("java:/"))
+                        {
+                           jndiName = "java:/" + jndiName;
+                        }
 
-                     recoveryModules.add(recovery);
+                        org.jboss.jca.core.api.management.DataSource mgtDataSource =
+                           new org.jboss.jca.core.api.management.DataSource(true);
+                        XAResourceRecovery recovery = null;
+                        Object cf = deployXADataSource(xaDataSource,
+                                                       jndiName, uniqueJdbcXAId,
+                                                       recovery,
+                                                       mgtDataSource,
+                                                       jdbcXADeploymentCl);
+                        
+                        recoveryModules.add(recovery);
 
-                     bindConnectionFactory(deploymentName, jndiName, cf);
+                        bindConnectionFactory(deploymentName, jndiName, cf);
 
-                     cfs.add(cf);
-                     jndis.add(jndiName);
-                     mgts.add(mgtDataSource);
+                        cfs.add(cf);
+                        jndis.add(jndiName);
+                        mgts.add(mgtDataSource);
+                     }
+                     catch (Throwable t)
+                     {
+                        log.error("Error during the deployment of " + xaDataSource.getJndiName(), t);
+                     }
                   }
-                  catch (Throwable t)
-                  {
-                     log.error("Error during the deployment of " + xaDataSource.getJndiName(), t);
-                  }
                }
             }
          }



More information about the jboss-cvs-commits mailing list