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 2011/12/08 17:51:30 UTC

svn commit: r1211972 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Author: rmannibucau
Date: Thu Dec  8 16:51:30 2011
New Revision: 1211972

URL: http://svn.apache.org/viewvc?rev=1211972&view=rev
Log:
some more work to be able to read all persistence.xml in web-inf/lib

Modified:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1211972&r1=1211971&r2=1211972&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java Thu Dec  8 16:51:30 2011
@@ -219,12 +219,14 @@ public class DeploymentLoader implements
                 AppModule appModule = new AppModule(OpenEJB.class.getClassLoader(), file.getAbsolutePath(), new Application(), true);
                 addWebModule(appModule, baseUrl, OpenEJB.class.getClassLoader(), getContextRoot(), getModuleName());
 
+                final Map<String, URL> otherDD;
                 if (Boolean.getBoolean(OPENEJB_READ_ALL_PERSISTENCE_XML)) {
                     WebModule webModule = appModule.getWebModules().iterator().next();
                     final List<URL> urls = webModule.getUrls();
                     final ResourceFinder finder = new ResourceFinder("", urls.toArray(new URL[urls.size()]));
-                    final Map<String, URL> dd = getDescriptors(finder, false);
-                    webModule.getAltDDs().putAll(dd);
+                    otherDD = getDescriptors(finder, false);
+                } else {
+                    otherDD = new HashMap<String, URL>();
                 }
 
                 URL persistenceUrl = null;
@@ -264,16 +266,22 @@ public class DeploymentLoader implements
                     }
                 }
 
-                if (persistenceUrl != null) {
+                if (persistenceUrl != null || otherDD.containsKey("persistence.xml")) {
                     List<URL> persistenceUrls = (List<URL>) appModule.getAltDDs().get("persistence.xml");
                     if (persistenceUrls == null) {
                         persistenceUrls = new ArrayList<URL>();
                         appModule.getAltDDs().put("persistence.xml", persistenceUrls);
                     }
-                    try {
-                        persistenceUrls.add(persistenceUrl);
-                    } catch (Exception e) {
-                        // no-op
+
+                    if (persistenceUrl != null) {
+                        try {
+                            persistenceUrls.add(persistenceUrl);
+                        } catch (Exception e) {
+                            // no-op
+                        }
+                    }
+                    if (otherDD.containsKey("persistence.xml")) {
+                        persistenceUrls.add(otherDD.get("persistence.xml"));
                     }
                 }