geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r982493 [2/2] - in /geronimo/server/trunk/plugins: axis/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/ bval/geronimo-bval-builder/src/main/java/org/apache/geronimo/bval/deployment/ client/client/src/main/history/ clie...
Date Thu, 05 Aug 2010 07:54:33 GMT
Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?rev=982493&r1=982492&r2=982493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
Thu Aug  5 07:54:32 2010
@@ -31,6 +31,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
 
+import javax.naming.NamingException;
+import javax.naming.Reference;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
 import org.apache.geronimo.gbean.AbstractName;
@@ -40,11 +42,13 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.jndi.JndiKey;
 import org.apache.geronimo.j2ee.jndi.JndiScope;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
 import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
+import org.apache.geronimo.naming.reference.JndiReference;
 import org.apache.geronimo.openejb.EntityDeploymentGBean;
 import org.apache.geronimo.openejb.ManagedDeploymentGBean;
 import org.apache.geronimo.openejb.MessageDrivenDeploymentGBean;
@@ -58,6 +62,9 @@ import org.apache.geronimo.security.depl
 import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
 import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.InterfaceType;
+import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.assembler.classic.EnterpriseBeanInfo;
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.EntityBean;
@@ -73,6 +80,8 @@ import org.apache.openejb.jee.oejb3.EjbD
 import org.apache.xbean.finder.ClassFinder;
 import org.osgi.framework.Bundle;
 
+import static org.apache.openejb.assembler.classic.JndiBuilder.format;
+
 /**
  * Handles building ejb deployment gbeans.
  */
@@ -376,23 +385,41 @@ public class EjbDeploymentBuilder {
             // classFinder in the module will convey whether metadata-complete is set (or
not)
 //            ejbModule.setClassFinder(createEjbJarClassFinder(ejbModule));
         }
+        //TODO well, what is the appName?
+        String appName = null;
+        EjbJarInfo ejbJarInfo = ejbModule.getEjbJarInfo();
         for (EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
+            String ejbName = bean.getEjbName();
+            String deploymentId = getDeploymentId(ejbName, ejbJarInfo);
+            GBeanData gbean = getEjbGBean(ejbName);
+            addEnc(gbean, bean, appName, deploymentId);
+        }
 
+        OpenejbGeronimoEjbJarType geronimoOpenejb = ejbModule.getVendorDD();
+        for (EnterpriseBean bean: ejbJar.getEnterpriseBeans()) {
             String ejbName = bean.getEjbName().trim();
-            String beanClass = bean.getEjbClass().trim();
             GBeanData gbean = getEjbGBean(ejbName);
             Collection<ResourceRef> resourceRefs = bean.getResourceRef();
-            addEnc(gbean, beanClass, bean, resourceRefs);
+            processResourceEnvironment(gbean, resourceRefs, geronimoOpenejb);
         }
 
+
         if (!ejbJar.isMetadataComplete()) {
             ejbJar.setMetadataComplete(true);
             ejbModule.setOriginalSpecDD(ejbModule.getSpecDD().toString());
         }
     }
 
-    private void addEnc(GBeanData gbean, String beanClass, EnterpriseBean bean, Collection<ResourceRef>
resourceRefs) throws DeploymentException {
-        OpenejbGeronimoEjbJarType geronimoOpenejb = ejbModule.getVendorDD();
+    private String getDeploymentId(String ejbName, EjbJarInfo ejbJarInfo) throws DeploymentException
{
+        for (EnterpriseBeanInfo info: ejbJarInfo.enterpriseBeans) {
+            if (ejbName.equals(info.ejbName)) {
+                return info.ejbDeploymentId;
+            }
+        }
+        throw new DeploymentException("EnterpriseBeanInfo not found for ejb: " + ejbName);
+    }
+
+    private void addEnc(GBeanData gbean, EnterpriseBean bean, String appName, String deploymentId)
throws DeploymentException {
 
         //
         // Build ENC
@@ -401,7 +428,7 @@ public class EjbDeploymentBuilder {
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, gbean.getAbstractName());
         Class ejbClass;
         try {
-            ejbClass = ejbModule.getEarContext().getDeploymentBundle().loadClass(beanClass);
+            ejbClass = ejbModule.getEarContext().getDeploymentBundle().loadClass(bean.getEjbClass());
         } catch (ClassNotFoundException e) {
             throw new DeploymentException("Could not load ejb class", e);
         }
@@ -412,10 +439,11 @@ public class EjbDeploymentBuilder {
         }
 
         ClassFinder finder = new ClassFinder(classes);
-//        AnnotatedApp annotatedApp = AnnotatedEjbJar.getAnnotatedApp(xmlbeansEjb);
-
 
         Module module = ejbModule.newEJb(finder, bean);
+        bind(bean, appName, ejbModule.getName(), deploymentId, module.getJndiContext());
+
+        OpenejbGeronimoEjbJarType geronimoOpenejb = ejbModule.getVendorDD();
         namingBuilder.buildNaming(bean,
                 geronimoOpenejb,
                 module,
@@ -432,6 +460,9 @@ public class EjbDeploymentBuilder {
         //
         // Process resource refs
         //
+    }
+
+    private void processResourceEnvironment(GBeanData gbean, Collection<ResourceRef>
resourceRefs, OpenejbGeronimoEjbJarType geronimoOpenejb) throws DeploymentException {
         GerResourceRefType[] gerResourceRefs = null;
 
         if (geronimoOpenejb != null) {
@@ -442,26 +473,111 @@ public class EjbDeploymentBuilder {
         resourceEnvironmentSetter.setResourceEnvironment(refBuilder, resourceRefs, gerResourceRefs);
     }
 
-//    private ClassFinder createEjbJarClassFinder(EjbModule ejbModule) throws DeploymentException
{
-//
-//        try {
-//            // Get the classloader from the module's EARContext
-//            Bundle bundle = ejbModule.getEarContext().getDeploymentBundle();
-//
-//            //----------------------------------------------------------------------------------------
-//            // Find the list of classes from the ejb-jar.xml we want to search for annotations
in
-//            //----------------------------------------------------------------------------------------
-//            List<Class> classes = new ArrayList<Class>();
-//
-//            for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
-//                classes.add(bundle.loadClass(bean.getEjbClass()));
-//            }
-//
-//            return new ClassFinder(classes);
-//        } catch (ClassNotFoundException e) {
-//            throw new DeploymentException("Unable to load bean class.", e);
-//        }
-//    }
+    public void bind(EnterpriseBean bean, String appName, String moduleName, String id, Map<JndiKey,
Map<String, Object>> jndiContext) {
+
+
+        appName = appName == null? "": appName + "/";
+        moduleName = moduleName + "/";
+        String beanName = bean.getEjbName();
+        int count = 0;
+        Reference singleRef = null;
+
+        if (bean instanceof RemoteBean) {
+            try {
+                String homeInterface = ((RemoteBean) bean).getHome();
+                if (homeInterface != null) {
+
+                    String name = "openejb/Deployment/" + format(id, homeInterface, InterfaceType.EJB_OBJECT);
+                    Reference ref = new JndiReference(name);
+                    count ++;
+                    singleRef = ref;
+                    bindJava(appName, moduleName, beanName, homeInterface, ref, jndiContext);
+                }
+            } catch (NamingException e) {
+                throw new RuntimeException("Unable to bind remote home interface for deployment
" + id, e);
+            }
+            try {
+                String localHomeInterface = ((RemoteBean) bean).getLocalHome();
+                if (localHomeInterface != null) {
+
+                    String name = "openejb/Deployment/" + format(id, localHomeInterface,
InterfaceType.EJB_LOCAL);
+                    Reference ref = new JndiReference(name);
+                    count++;
+                    singleRef = ref;
+                    bindJava(appName, moduleName, beanName, localHomeInterface, ref, jndiContext);
+                }
+            } catch (NamingException e) {
+                throw new RuntimeException("Unable to bind local home interface for deployment
" + id, e);
+            }
+
+            try {
+                for (String interfce : ((RemoteBean) bean).getBusinessLocal()) {
+
+                    String name = "openejb/Deployment/" + format(id, interfce, InterfaceType.BUSINESS_LOCAL);
+                    Reference ref = new JndiReference(name);
+                    count++;
+                    singleRef = ref;
+                    bindJava(appName, moduleName, beanName, interfce, ref, jndiContext);
+                }
+            } catch (NamingException e) {
+                throw new RuntimeException("Unable to bind business local interface for deployment
" + id, e);
+            }
+
+            try {
+                for (String interfce : ((RemoteBean) bean).getBusinessRemote()) {
+
+                    String name = "openejb/Deployment/" + format(id, interfce, InterfaceType.BUSINESS_REMOTE);
+                    Reference ref = new JndiReference(name);
+                    count++;
+                    singleRef = ref;
+                    bindJava(appName, moduleName, beanName, interfce, ref, jndiContext);
+                }
+            } catch (NamingException e) {
+                throw new RuntimeException("Unable to bind business remote deployment in
jndi.", e);
+            }
+
+        }
+
+        try {
+            if (bean instanceof SessionBean && ((SessionBean)bean).getLocal() !=
null) {
+                String beanClass = bean.getEjbClass();
+
+                String name = "openejb/Deployment/" + format(id, beanClass, InterfaceType.BUSINESS_LOCALBEAN_HOME);
+                Reference ref = new JndiReference(name);
+                count ++;
+                singleRef = ref;
+                bindJava(appName, moduleName, beanName, beanClass, ref, jndiContext);
+            }
+        } catch (NamingException e) {
+            throw new RuntimeException("Unable to bind business remote deployment in jndi.",
e);
+        }
+        if (count == 1) {
+            try {
+                bindJava(appName, moduleName, beanName, null, singleRef, jndiContext);
+            } catch (NamingException e) {
+                throw new RuntimeException("Unable to single interface in jndi.", e);
+            }
+        }
+    }
+
+    private void bindJava(String appName, String moduleName, String beanName, String interfaceName,
Reference ref, Map<JndiKey, Map<String, Object>> contexts) throws NamingException
{
+         if (interfaceName != null) {
+             beanName = beanName + "!" + interfaceName;
+         }
+        bind("global", appName + moduleName + beanName, ref, contexts);
+        bind("app", moduleName + beanName, ref, contexts);
+        bind("module", beanName, ref, contexts);
+    }
+
+    private void bind(String context, String name, Object object,  Map<JndiKey, Map<String,
Object>> contexts) throws NamingException {
+        JndiKey jndiKey = JndiScope.valueOf(context);
+        Map<String, Object> scope = contexts.get(jndiKey);
+        if (scope == null) {
+            scope = new HashMap<String, Object>();
+            contexts.put(jndiKey, scope);
+        }
+        scope.put(context + "/" + name, object);
+    }
 
     private GBeanData getEjbGBean(String ejbName) throws DeploymentException {
         GBeanData gbean = gbeans.get(ejbName);

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java?rev=982493&r1=982492&r2=982493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
Thu Aug  5 07:54:32 2010
@@ -51,8 +51,8 @@ import org.apache.openejb.config.JndiEnc
 import org.apache.openejb.core.ivm.naming.IntraVmJndiReference;
 import org.apache.openejb.jee.EjbLocalRef;
 import org.apache.openejb.jee.EjbRef;
+import org.apache.openejb.jee.InjectionTarget;
 import org.apache.openejb.jee.JndiConsumer;
-import org.apache.openejb.jee.SessionBean;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 import org.slf4j.Logger;
@@ -109,6 +109,17 @@ public class EjbRefBuilder extends Abstr
             processAnnotations(specDD, module);
         }
 
+        Map<String, List<InjectionTarget>> injectionsMap = new HashMap<String,
List<InjectionTarget>>();
+        for (Map.Entry<String, EjbRef> entry: specDD.getEjbRefMap().entrySet()) {
+            if (!entry.getValue().getInjectionTarget().isEmpty()) {
+                injectionsMap.put(entry.getKey(), entry.getValue().getInjectionTarget());
+            }
+        }
+        for (Map.Entry<String, EjbLocalRef> entry: specDD.getEjbLocalRefMap().entrySet())
{
+            if (!entry.getValue().getInjectionTarget().isEmpty()) {
+                injectionsMap.put(entry.getKey(), entry.getValue().getInjectionTarget());
+            }
+        }
         Map<String, Object> map = null;
         try {
             EjbModuleBuilder.EarData earData = EjbModuleBuilder.EarData.KEY.get(module.getRootEarContext().getGeneralData());
@@ -121,29 +132,21 @@ public class EjbRefBuilder extends Abstr
             appInfo.ejbJars.addAll(ejbJars);
 
             JndiEncInfoBuilder jndiEncInfoBuilder = new JndiEncInfoBuilder(appInfo);
-            String moduleId = (module.isStandAlone()) ? null : module.getTargetPath();
-            JndiEncInfo moduleJndiEnc = new JndiEncInfo();
-            JndiEncInfo compJndiEnc = new JndiEncInfo();       
+            JndiEncInfo moduleJndi = new JndiEncInfo();
+            JndiEncInfo compJndi = new JndiEncInfo();
 
-            jndiEncInfoBuilder.build(specDD, "GeronimoEnc", moduleId, moduleJndiEnc, compJndiEnc);
+            String moduleId = module.getName();
+            jndiEncInfoBuilder.build(specDD, "GeronimoEnc", moduleId, moduleJndi, compJndi);
             
             JndiEncInfo ejbEncInfo = new JndiEncInfo();
-            
-            // add java:global/
             ejbEncInfo.ejbReferences.addAll(appInfo.globalJndiEnc.ejbReferences);
-            ejbEncInfo.ejbLocalReferences.addAll(appInfo.globalJndiEnc.ejbLocalReferences);
-            
-            // add java:app/
             ejbEncInfo.ejbReferences.addAll(appInfo.appJndiEnc.ejbReferences);
+            ejbEncInfo.ejbReferences.addAll(moduleJndi.ejbReferences);
+            ejbEncInfo.ejbReferences.addAll(compJndi.ejbReferences);
+            ejbEncInfo.ejbLocalReferences.addAll(appInfo.globalJndiEnc.ejbLocalReferences);
             ejbEncInfo.ejbLocalReferences.addAll(appInfo.appJndiEnc.ejbLocalReferences);
-            
-            // add java:module/            
-            ejbEncInfo.ejbReferences.addAll(moduleJndiEnc.ejbReferences);
-            ejbEncInfo.ejbLocalReferences.addAll(moduleJndiEnc.ejbLocalReferences);
-            
-            // add java:comp/
-            ejbEncInfo.ejbReferences.addAll(compJndiEnc.ejbReferences);
-            ejbEncInfo.ejbLocalReferences.addAll(compJndiEnc.ejbLocalReferences);
+            ejbEncInfo.ejbLocalReferences.addAll(moduleJndi.ejbLocalReferences);
+            ejbEncInfo.ejbLocalReferences.addAll(compJndi.ejbLocalReferences);
 
             JndiEncBuilder jndiEncBuilder = new JndiEncBuilder(ejbEncInfo, null, module.getName(),
getClass().getClassLoader());
 
@@ -164,8 +167,9 @@ public class EjbRefBuilder extends Abstr
                 if (uri != null) {
                     value = createClientRef(value);
                 }
+                name = "java:" + name;
                 if (value instanceof Serializable) {
-                    put("java:" + name, value, module.getJndiContext());
+                    put(name, value, module.getJndiContext(), injectionsMap.get(name), sharedContext);
                 }
             }
         }

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java?rev=982493&r1=982492&r2=982493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/XBeanJndiFactory.java
Thu Aug  5 07:54:32 2010
@@ -21,11 +21,14 @@
 package org.apache.geronimo.openejb;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import org.apache.geronimo.j2ee.jndi.JndiKey;
+import org.apache.geronimo.j2ee.jndi.JndiScope;
 import org.apache.openejb.SystemException;
 import org.apache.openejb.core.JndiFactory;
 import org.apache.xbean.naming.context.ImmutableFederatedContext;

Modified: geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/history/dependencies.xml?rev=982493&r1=982492&r2=982493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/history/dependencies.xml
(original)
+++ geronimo/server/trunk/plugins/openejb/openejb-deployer/src/main/history/dependencies.xml
Thu Aug  5 07:54:32 2010
@@ -36,9 +36,4 @@
         <artifactId>openejb-osgi-core</artifactId>
         <type>jar</type>
     </dependency>
-    <dependency>
-        <groupId>org.osgi</groupId>
-        <artifactId>org.osgi.core</artifactId>
-        <type>jar</type>
-    </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml?rev=982493&r1=982492&r2=982493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml Thu Aug
 5 07:54:32 2010
@@ -122,6 +122,11 @@
         <type>jar</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>xbean-bundleutils</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.yoko</groupId>
         <artifactId>yoko-spec-corba</artifactId>
         <type>jar</type>

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=982493&r1=982492&r2=982493&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
Thu Aug  5 07:54:32 2010
@@ -53,6 +53,7 @@ import org.apache.geronimo.xbeans.geroni
 import org.apache.geronimo.xbeans.geronimo.naming.GerPersistenceUnitRefDocument;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPersistenceUnitRefType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPropertyType;
+import org.apache.openejb.jee.InjectionTarget;
 import org.apache.openejb.jee.JndiConsumer;
 import org.apache.openejb.jee.PersistenceContextRef;
 import org.apache.openejb.jee.PersistenceContextType;
@@ -93,7 +94,7 @@ public class PersistenceRefBuilder exten
         return plan != null && plan.selectChildren(PersistenceRefBuilder.GER_PERSISTENCE_UNIT_REF_QNAME_SET).length
> 0;
     }
 
-    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key,
Object> componentContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key,
Object> sharedContext) throws DeploymentException {
         Configuration localConfiguration = module.getEarContext().getConfiguration();
         List<DeploymentException> problems = new ArrayList<DeploymentException>();
 
@@ -105,11 +106,10 @@ public class PersistenceRefBuilder exten
         //persistenceUnit refs
         Collection<PersistenceUnitRef> specPersistenceUnitRefsUntyped = specDD.getPersistenceUnitRef();
         Map<String, GerPersistenceUnitRefType> gerPersistenceUnitRefsUntyped = getGerPersistenceUnitRefs(plan);
-        for (PersistenceUnitRef persistenceUnitRef : specPersistenceUnitRefsUntyped) {
+        for (Map.Entry<String, PersistenceUnitRef> entry : specDD.getPersistenceUnitRefMap().entrySet())
{
             try {
-                String persistenceUnitRefName = persistenceUnitRef.getPersistenceUnitRefName().trim();
-
-                addInjections(persistenceUnitRefName, persistenceUnitRef.getInjectionTarget(),
componentContext);
+                String persistenceUnitRefName = entry.getKey();
+                PersistenceUnitRef persistenceUnitRef = entry.getValue();
                 AbstractNameQuery persistenceUnitNameQuery;
                 GerPersistenceUnitRefType gerPersistenceUnitRef = gerPersistenceUnitRefsUntyped.remove(persistenceUnitRefName);
                 if (gerPersistenceUnitRef != null) {
@@ -121,19 +121,20 @@ public class PersistenceRefBuilder exten
 
                 PersistenceUnitReference reference = new PersistenceUnitReference(module.getConfigId(),
persistenceUnitNameQuery);
 
-                put(persistenceUnitRefName, reference, module.getJndiContext());
+                put(persistenceUnitRefName, reference, module.getJndiContext(), persistenceUnitRef.getInjectionTarget(),
sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }
 
         }
+        //geronimo-only persistence unit refs have no injections
         for (GerPersistenceUnitRefType gerPersistenceUnitRef : gerPersistenceUnitRefsUntyped.values())
{
             try {
-                String PersistenceUnitRefName = gerPersistenceUnitRef.getPersistenceUnitRefName();
+                String persistenceUnitRefName = gerPersistenceUnitRef.getPersistenceUnitRefName();
                 AbstractNameQuery persistenceUnitNameQuery = findPersistenceUnit(gerPersistenceUnitRef);
                 checkForGBean(localConfiguration, persistenceUnitNameQuery, true);
                 PersistenceUnitReference reference = new PersistenceUnitReference(module.getConfigId(),
persistenceUnitNameQuery);
-                put(PersistenceUnitRefName, reference, module.getJndiContext());
+                put(persistenceUnitRefName, reference, module.getJndiContext(), Collections.<InjectionTarget>emptyList(),
sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }
@@ -143,11 +144,10 @@ public class PersistenceRefBuilder exten
         //persistence context refs
         Collection<PersistenceContextRef> specPersistenceContextRefsUntyped = specDD.getPersistenceContextRef();
         Map<String, GerPersistenceContextRefType> gerPersistenceContextRefsUntyped
= getGerPersistenceContextRefs(plan);
-        for (PersistenceContextRef persistenceContextRef : specPersistenceContextRefsUntyped)
{
+        for (Map.Entry<String, PersistenceContextRef> entry : specDD.getPersistenceContextRefMap().entrySet())
{
             try {
-                String persistenceContextRefName = persistenceContextRef.getPersistenceContextRefName().trim();
-
-                addInjections(persistenceContextRefName, persistenceContextRef.getInjectionTarget(),
componentContext);
+                String persistenceContextRefName = entry.getKey();
+                PersistenceContextRef persistenceContextRef = entry.getValue();
                 PersistenceContextType persistenceContextType = persistenceContextRef.getPersistenceContextType();
                 boolean transactionScoped = persistenceContextType == null || persistenceContextType.equals(PersistenceContextType.TRANSACTION);
 
@@ -169,7 +169,7 @@ public class PersistenceRefBuilder exten
                     persistenceUnitNameQuery = findPersistenceUnitQuery(module, localConfiguration,
persistenceContextRef);
                 }
                 PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(),
persistenceUnitNameQuery, transactionScoped, properties);
-                put(persistenceContextRefName, reference, module.getJndiContext());
+                put(persistenceContextRefName, reference, module.getJndiContext(), persistenceContextRef.getInjectionTarget(),
sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }
@@ -186,7 +186,7 @@ public class PersistenceRefBuilder exten
                 AbstractNameQuery persistenceUnitNameQuery = findPersistenceUnit(gerPersistenceContextRef);
                 checkForGBean(localConfiguration, persistenceUnitNameQuery, true);
                 PersistenceContextReference reference = new PersistenceContextReference(module.getConfigId(),
persistenceUnitNameQuery, transactionScoped, properties);
-                put(persistenceContextRefName, reference, module.getJndiContext());
+                put(persistenceContextRefName, reference, module.getJndiContext(), Collections.<InjectionTarget>emptyList(),
sharedContext);
             } catch (DeploymentException e) {
                 problems.add(e);
             }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=982493&r1=982492&r2=982493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Thu Aug  5 07:54:32 2010
@@ -596,22 +596,21 @@ public class TomcatModuleBuilder extends
                 //Those elements have been processed by Geronimo, Tomatt no need to do it
now.
                 //Also, currently, it seems that Tomcat could not handle those jndi elements
correctly
                 webApp.setMetadataComplete(true);
-                webApp.getEjbLocalRef().clear();
-                webApp.getEjbRef().clear();
-                webApp.getEnvEntry().clear();
-                webApp.getMessageDestination().clear();
-                webApp.getMessageDestinationRef().clear();
-                webApp.getPersistenceContextRef().clear();
-                webApp.getPersistenceUnitRef().clear();
-                webApp.getPostConstruct().clear();
-                webApp.getPreDestroy().clear();
-                webApp.getResourceEnvRef().clear();
-                webApp.getResourceRef().clear();
-                webApp.getServiceRef().clear();
-                webApp.getDataSource().clear();
-                String specDeploymentPlan = getSpecDDAsString(webModule);
-                module.setOriginalSpecDD(specDeploymentPlan);
-                earContext.addFile(new URI("./WEB-INF/web.xml"), specDeploymentPlan);
+                if (INITIAL_WEB_XML_SCHEMA_VERSION.get(earContext.getGeneralData()) >=
2.5f) {
+                    String specDeploymentPlan = getSpecDDAsString(webModule);
+                    module.setOriginalSpecDD(specDeploymentPlan);
+                    //remove naming stuff from webApp so tomcat doesn't process it uselessly
+                    webApp.getEjbLocalRef().clear();
+                    webApp.getEjbRef().clear();
+                    webApp.getEnvEntry().clear();
+                    webApp.getDataSource().clear();
+                    webApp.getMessageDestinationRef().clear();
+                    webApp.getResourceEnvRef().clear();
+                    webApp.getResourceRef().clear();
+                    webApp.getServiceRef().clear();
+                    specDeploymentPlan = getSpecDDAsString(webModule);
+                    earContext.addFile(new URI("./WEB-INF/web.xml"), specDeploymentPlan);
+                }
             }
             //}
             webModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());

Modified: geronimo/server/trunk/plugins/tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/pom.xml?rev=982493&r1=982492&r2=982493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/pom.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/pom.xml Thu Aug  5 07:54:32 2010
@@ -48,9 +48,9 @@
         <module>tomcat7-clustering-wadi</module>
         <module>tomcat7-clustering-builder-wadi</module>
     </modules>
-    <properties>
-        <tomcatVersion>7.0.0.1</tomcatVersion>
-    </properties>
+    <!--<properties>-->
+        <!--<tomcatVersion>7.0.0.2-SNAPSHOT</tomcatVersion>-->
+    <!--</properties>-->
     <dependencyManagement>
         <dependencies>
             <!-- Tomcat web container -->



Mime
View raw message