tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1076928 - /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Date Fri, 04 Mar 2011 03:01:37 GMT
Author: xuhaihong
Date: Fri Mar  4 03:01:36 2011
New Revision: 1076928

URL: http://svn.apache.org/viewvc?rev=1076928&view=rev
Log:
Only load persistence.xml if required

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

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1076928&r1=1076927&r2=1076928&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Fri Mar  4 03:01:36 2011
@@ -37,9 +37,7 @@ import org.apache.openejb.jee.TldTaglib;
 import org.apache.openejb.jee.WebApp;
 import org.apache.openejb.jee.WebserviceDescription;
 import org.apache.openejb.jee.Webservices;
-import org.apache.openejb.jee.oejb3.OpenejbJar;
 import org.apache.openejb.loader.FileUtils;
-import org.apache.openejb.loader.Options;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.AnnotationFinder;
 import org.apache.openejb.util.JarExtractor;
@@ -225,25 +223,25 @@ public class DeploymentLoader implements
                 final File file = toFile(baseUrl);
 
                 // Standalone Web Module
-                
+
                 AppModule appModule = new AppModule(OpenEJB.class.getClassLoader(), file.getAbsolutePath(),
new Application(), true);
                 addWebModule(appModule, baseUrl, OpenEJB.class.getClassLoader(), getContextRoot(),
getModuleName());
-                
-				File persistenceXml = new File(file, "WEB-INF/classes/META-INF/persistence.xml");
-				if (persistenceXml.exists() && persistenceXml.isFile()) {
-					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(persistenceXml.toURI().toURL());
-					} catch (Exception e) {
-					}
-				}
-				
-				addPersistenceUnits(appModule, baseUrl);
+
+                if (loadingRequiredModuleTypes.contains(PersistenceModule.class)) {
+                    File persistenceXml = new File(file, "WEB-INF/classes/META-INF/persistence.xml");
+                    if (persistenceXml.exists() && persistenceXml.isFile()) {
+                        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(persistenceXml.toURI().toURL());
+                        } catch (Exception e) {
+                        }
+                    }
+                    addPersistenceUnits(appModule, baseUrl);
+                }
 				return appModule;
             } else if (PersistenceModule.class.equals(moduleClass) && loadingRequiredModuleTypes.contains(PersistenceModule.class))
{
                 String jarLocation = URLs.toFilePath(baseUrl);
@@ -631,7 +629,7 @@ public class DeploymentLoader implements
         appModule.getEjbModules().add(webEjbModule);
 
         try {
-            // TODO:  Put our scanning ehnancements back, here 
+            // TODO:  Put our scanning ehnancements back, here
             AbstractFinder finder = FinderFactory.createFinder(webModule);
             webModule.setFinder(finder);
             webEjbModule.setFinder(finder);



Mime
View raw message