geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r933129 - in /geronimo/server/trunk/plugins: client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/ openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/
Date Mon, 12 Apr 2010 07:53:32 GMT
Author: xuhaihong
Date: Mon Apr 12 07:53:32 2010
New Revision: 933129

URL: http://svn.apache.org/viewvc?rev=933129&view=rev
Log:
More update for using generic key in EARContext

Modified:
    geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.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/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?rev=933129&r1=933128&r2=933129&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/client/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
Mon Apr 12 07:53:32 2010
@@ -565,7 +565,7 @@ public class AppClientModuleBuilder impl
             } catch (IOException e) {
                 throw new DeploymentException("Unable to copy app client module jar into
configuration: " + moduleFile.getName(), e);
             }
-            ClassPathList libClasspath = (ClassPathList) earContext.getGeneralData().get(ClassPathList.class);
+            ClassPathList libClasspath = EARContext.CLASS_PATH_LIST_KEY.get(earContext.getGeneralData());
             if (libClasspath != null) {
                 for (String libEntryPath : libClasspath) {
                     try {
@@ -634,7 +634,6 @@ public class AppClientModuleBuilder impl
         //Share the ejb info with the ear.
         //TODO this might be too much, but I don't want to impose a dependency on geronimo-openejb
to get
         //EjbModuleBuilder.EarData.class
-        Map<EARContext.Key, Object> generalData = earContext.getGeneralData();
         for (Map.Entry<EARContext.Key, Object> entry : generalData.entrySet()) {
             EARContext.Key key = entry.getKey();
             if (key.getClass().getName().startsWith("org.apache.geronimo.openejb.deployment.EjbModuleBuilder$EarData"))
{

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=933129&r1=933128&r2=933129&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
Mon Apr 12 07:53:32 2010
@@ -45,6 +45,7 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
+import org.apache.geronimo.j2ee.deployment.EARContext.Key;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.Naming;
@@ -68,6 +69,14 @@ import org.osgi.framework.Bundle;
 public class PersistenceUnitBuilder implements ModuleBuilderExtension {
     private static final QName PERSISTENCE_QNAME = PersistenceDocument.type.getDocumentElementName();
 
+    public static final EARContext.Key<List<URL>> PERSISTENCE_URL_LIST_KEY =
new EARContext.Key<List<URL>>() {
+
+        @Override
+        public List<URL> get(Map<Key, Object> context) {
+            return (List<URL>) context.get(this);
+        }
+    };
+
     private final Environment defaultEnvironment;
     private final String defaultPersistenceProviderClassName;
     private final Properties defaultPersistenceUnitProperties;
@@ -124,7 +133,7 @@ public class PersistenceUnitBuilder impl
             String rootBase = rootBaseFile.toURI().normalize().toString();
             URI moduleBaseURI = moduleContext.getBaseDir().toURI();
             Map rootGeneralData = module.getRootEarContext().getGeneralData();
-            ClassPathList manifestcp = (ClassPathList) module.getEarContext().getGeneralData().get(ClassPathList.class);
+            ClassPathList manifestcp = EARContext.CLASS_PATH_LIST_KEY.get(rootGeneralData);
             if (manifestcp == null) {
                 manifestcp = new ClassPathList();
                 manifestcp.add(module.getTargetPath());
@@ -137,10 +146,10 @@ public class PersistenceUnitBuilder impl
                 urls[i++] = url;
             }
             ResourceFinder finder = new ResourceFinder("", null, urls);
-            List<URL> knownPersistenceUrls = (List<URL>) rootGeneralData.get(PersistenceUnitBuilder.class.getName());
+            List<URL> knownPersistenceUrls = PERSISTENCE_URL_LIST_KEY.get(rootGeneralData);
             if (knownPersistenceUrls == null) {
                 knownPersistenceUrls = new ArrayList<URL>();
-                rootGeneralData.put(PersistenceUnitBuilder.class.getName(), knownPersistenceUrls);
+                rootGeneralData.put(PERSISTENCE_URL_LIST_KEY, knownPersistenceUrls);
             }
             List<URL> persistenceUrls = finder.findAll("META-INF/persistence.xml");
             persistenceUrls.removeAll(knownPersistenceUrls);



Mime
View raw message