geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanhongf...@apache.org
Subject svn commit: r1135393 - /geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
Date Tue, 14 Jun 2011 07:15:27 GMT
Author: hanhongfang
Date: Tue Jun 14 07:15:27 2011
New Revision: 1135393

URL: http://svn.apache.org/viewvc?rev=1135393&view=rev
Log:
update PersistenceUnitBuilder to correctly process standalone ejb module and war module in
ear file

Modified:
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java?rev=1135393&r1=1135392&r2=1135393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java
Tue Jun 14 07:15:27 2011
@@ -23,6 +23,7 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -52,6 +53,7 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.ResourceSource;
@@ -135,8 +137,25 @@ public class PersistenceUnitBuilder impl
             throw new DeploymentException("Parse Persistence configuration file failed",
e);
         }
         try {
-
+            
             final Collection<String> manifestcp = module.getClassPath();
+            // add "" into manifestcp to make META-INF/persistence.xml in standalone ejb
be processed
+            if (module.isStandAlone() && module.getType() == ConfigurationModuleType.EJB)
{
+                manifestcp.add("");
+            }
+            // resolve the classpath for non-standalone war file since module.getClassPath

+            // returns the classpath relative to the war file
+            if (!module.isStandAlone() && module.getType() == ConfigurationModuleType.WAR)
{
+                Collection<String> cps = new LinkedHashSet<String> ();
+                for (String classpath : manifestcp) {
+                     cps.add(module.resolve(classpath).toString());
+                }
+                manifestcp.clear();
+                for (String cp : cps) {
+                    manifestcp.add(cp);
+                }
+            }            
+            
             BundleResourceFinder finder = new BundleResourceFinder(packageAdmin, bundle,
"", "META-INF/persistence.xml", new ResourceDiscoveryFilter() {
 
                 @Override



Mime
View raw message