geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r960162 - in /geronimo/server/trunk/plugins: j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/
Date Sat, 03 Jul 2010 06:33:24 GMT
Author: djencks
Date: Sat Jul  3 06:33:23 2010
New Revision: 960162

URL: http://svn.apache.org/viewvc?rev=960162&view=rev
Log:
GERONIMO-5423 make lib/ persistence units in an ear global

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

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=960162&r1=960161&r2=960162&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Sat Jul  3 06:33:23 2010
@@ -646,6 +646,9 @@ public class EARConfigBuilder implements
                 for (ModuleBuilderExtension mbe : persistenceUnitBuilders) {
                     mbe.initContext(earContext, applicationInfo, earContext.getDeploymentBundle());
                 }
+                for (ModuleBuilderExtension mbe : persistenceUnitBuilders) {
+                    mbe.addGBeans(earContext, applicationInfo, earContext.getDeploymentBundle(),
repositories);
+                }
 
                 // Create the J2EEApplication managed object
                 GBeanData gbeanData = new GBeanData(earContext.getModuleName(), J2EEApplicationImpl.class);

Modified: geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java?rev=960162&r1=960161&r2=960162&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceRefBuilder.java
Sat Jul  3 06:33:23 2010
@@ -38,6 +38,7 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.annotation.PersistenceUnitAnnotationHelper;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
@@ -210,7 +211,10 @@ public class PersistenceRefBuilder exten
                 checkForGBean(localConfiguration, persistenceUnitNameQuery, true);
             }
         } else {
-            persistenceUnitNameQuery = new AbstractNameQuery(null, Collections.EMPTY_MAP,
PERSISTENCE_UNIT_INTERFACE_TYPES);
+            AbstractName childName = module.getEarContext().getNaming().createChildName(module.getModuleName(),
"", NameFactory.PERSISTENCE_UNIT);
+            Map<String, String> name = new HashMap<String, String>(childName.getName());
+            name.remove(NameFactory.J2EE_NAME);
+            persistenceUnitNameQuery = new AbstractNameQuery(null, name, PERSISTENCE_UNIT_INTERFACE_TYPES);
             Set<AbstractNameQuery> patterns = Collections.singleton(persistenceUnitNameQuery);
             LinkedHashSet<GBeanData> gbeans = localConfiguration.findGBeanDatas(localConfiguration,
patterns);
             persistenceUnitNameQuery = checkForDefaultPersistenceUnit(gbeans);

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=960162&r1=960161&r2=960162&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
Sat Jul  3 06:33:23 2010
@@ -23,7 +23,6 @@ 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;
@@ -75,19 +74,6 @@ import org.osgi.service.packageadmin.Pac
 @GBean(j2eeType = NameFactory.MODULE_BUILDER)
 public class PersistenceUnitBuilder implements ModuleBuilderExtension {
 
-//    private static final EARContext.Key<List<URL>> PERSISTENCE_URL_LIST_KEY
= new EARContext.Key<List<URL>>() {
-//
-//        @Override
-//        public List<URL> get(Map<EARContext.Key, Object> keyObjectMap) {
-//            List<URL> list = (List<URL>) keyObjectMap.get(this);
-//            if (list == null) {
-//                list = new ArrayList<URL>();
-//                keyObjectMap.put(this, list);
-//            }
-//            return list;
-//        }
-//    };
-
     private static final QName PERSISTENCE_QNAME = new QName("http://java.sun.com/xml/ns/persistence",
"persistence");
 
     private final Environment defaultEnvironment;
@@ -132,7 +118,6 @@ public class PersistenceUnitBuilder impl
             return;
         }
         XmlObject container = (XmlObject) module.getVendorDD();
-        EARContext moduleContext = module.getEarContext();
         XmlObject[] raws = container.selectChildren(PERSISTENCE_QNAME);
 
         Map<String, Persistence.PersistenceUnit> overrides = new HashMap<String,
Persistence.PersistenceUnit>();
@@ -148,12 +133,7 @@ public class PersistenceUnitBuilder impl
         }
         try {
 
-            final Collection<String> manifestcp = new LinkedHashSet<String>();
-            for (Module m = module; m != null; m = m.getParentModule()){
-                manifestcp.addAll(m.getClassPath());
-            }
-            //should not be needed??
-//            manifestcp.add(module.getTargetPath());
+            final Collection<String> manifestcp = module.getClassPath();
             BundleResourceFinder finder = new BundleResourceFinder(packageAdmin, bundle,
"", "META-INF/persistence.xml", new ResourceDiscoveryFilter() {
 
                 @Override
@@ -171,7 +151,6 @@ public class PersistenceUnitBuilder impl
                     return manifestcp.contains(s);
                 }
             });
-//            List<URL> knownPersistenceUrls = PERSISTENCE_URL_LIST_KEY.get(module.getRootEarContext().getGeneralData());
             final Map<URL, String> persistenceURLs = new HashMap<URL, String>();
             finder.find(new BundleResourceFinder.ResourceFinderCallback() {
 
@@ -187,7 +166,6 @@ public class PersistenceUnitBuilder impl
                     persistenceURLs.put(url, jarName);
                 }
             });
-//            persistenceURLs.keySet().removeAll(knownPersistenceUrls);
             if (raws.length > 0 || persistenceURLs.size() > 0) {
                 EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);
             }
@@ -204,7 +182,6 @@ public class PersistenceUnitBuilder impl
                     in.close();
                 }
                 buildPersistenceUnits(persistence, overrides, module, persistenceLocation);
-//                knownPersistenceUrls.add(persistenceUrl);
             }
         } catch (Exception e) {
             throw new DeploymentException("Could not look for META-INF/persistence.xml files",
e);



Mime
View raw message