You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/11/23 10:45:23 UTC

tomee git commit: TOMEE-1455 try to skip pu properties configured datasources

Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x e7e3c866e -> 2b10697b4


TOMEE-1455 try to skip pu properties configured datasources


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2b10697b
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2b10697b
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2b10697b

Branch: refs/heads/tomee-1.7.x
Commit: 2b10697b4a718a3ad67028e4784ac2c61955df55
Parents: e7e3c86
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Sun Nov 23 10:45:01 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Sun Nov 23 10:45:01 2014 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/openejb/config/AutoConfig.java  | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/2b10697b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
index d9c00d3..2548325 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfig.java
@@ -1278,6 +1278,9 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
 
             // if jta datasource is specified it can be used as model fo rnon jta datasource
             final boolean resourceLocal = TransactionType.RESOURCE_LOCAL.equals(unit.getTransactionType()) && unit.getJtaDataSource() == null;
+            if (resourceLocal && isDataSourcePropertiesConfigured(unit.getProperties())) {
+                continue;
+            }
 
             final Properties required = new Properties();
 
@@ -1741,6 +1744,11 @@ public class AutoConfig implements DynamicDeployer, JndiConstants {
         }
     }
 
+    private boolean isDataSourcePropertiesConfigured(final Properties properties) {
+        return "true".equals(SystemInstance.get().getProperty("openejb.guess.resource-local-datasource-properties-configured", "true")) &&
+                (properties.containsKey("javax.persistence.jdbc.driver") || properties.containsKey("javax.persistence.jdbc.url"));
+    }
+
     private static void suffixAliases(final ResourceInfo ri, final String suffix) {
         final Collection<String> aliases = ri.aliases;
         final List<String> newAliases = new ArrayList<String>();