geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r524850 - in /geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment: EjbModuleBuilder.java EjbRefBuilder.java
Date Mon, 02 Apr 2007 17:47:31 GMT
Author: dain
Date: Mon Apr  2 10:47:30 2007
New Revision: 524850

URL: http://svn.apache.org/viewvc?view=rev&rev=524850
Log:
Another attempt at making corba refs work

Modified:
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?view=diff&rev=524850&r1=524849&r2=524850
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Mon Apr  2 10:47:30 2007
@@ -28,6 +28,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.TreeSet;
 import java.util.jar.JarFile;
 
 import javax.ejb.EntityContext;
@@ -91,6 +92,7 @@
 import org.apache.openejb.jee.ResourceEnvRef;
 import org.apache.openejb.jee.ResourceRef;
 import org.apache.openejb.jee.ServiceRef;
+import org.apache.openejb.jee.EjbRef;
 import org.apache.openejb.jee.jpa.unit.Persistence;
 import org.apache.openejb.jee.jpa.unit.PersistenceUnit;
 import org.apache.openejb.jee.jpa.unit.TransactionType;
@@ -99,6 +101,7 @@
 import org.apache.openejb.jee.oejb2.PatternType;
 import org.apache.openejb.jee.oejb2.OpenejbJarType;
 import org.apache.openejb.jee.oejb2.MessageDrivenBeanType;
+import org.apache.openejb.jee.oejb2.EjbRefType;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 
@@ -277,12 +280,31 @@
         return module;
     }
 
-    protected static void unmapReferences(EjbJar ejbJar) {
+    protected static void unmapReferences(EjbJar ejbJar, GeronimoEjbJarType geronimoEjbJarType)
{
+        Set<String> corbaEjbRefs = new TreeSet<String>();
+        for (EjbRefType ejbRef : geronimoEjbJarType.getEjbRef()) {
+            if (ejbRef.getNsCorbaloc() != null) {
+                corbaEjbRefs.add(ejbRef.getRefName());
+            }
+        }
+
         for (EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
             enterpriseBean.getEnvEntry().clear();
             enterpriseBean.getEjbRef().clear();
             enterpriseBean.getEjbLocalRef().clear();
 
+            for (Iterator<EjbRef> iterator = enterpriseBean.getEjbRef().iterator();
iterator.hasNext();) {
+                EjbRef ref = iterator.next();
+                 if (!corbaEjbRefs.contains(ref.getEjbRefName())) {
+                     // remove all non corba refs to avoid overwriting normal ejb refs
+                     iterator.remove();
+                 } else {
+                     // clear mapped named data from corba refs
+                    ref.setMappedName(null);
+                    ref.getInjectionTarget().clear();
+                 }
+            }
+
             for (MessageDestinationRef ref : enterpriseBean.getMessageDestinationRef()) {
                 ref.setMappedName(null);
                 ref.getInjectionTarget().clear();
@@ -410,15 +432,17 @@
         EjbJar ejbJar = ejbModule.getEjbJar();
         ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));
 
+        // Get the geronimo-openejb plan
+        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
+
         // We must set all mapped name references back to null or Geronimo will blow up
-        unmapReferences(ejbJar);
+        unmapReferences(ejbJar, geronimoEjbJarType);
 
         // create a xmlbeans version of the ejb-jar.xml file, because the jndi code is coupled
based on xmlbeans objects
         EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
         ejbModule.setSpecDD(ejbJarType);
 
         // convert the plan to xmlbeans since geronimo naming is coupled on xmlbeans objects
-        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
         OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.convertToXmlbeans(geronimoEjbJarType);
         ejbModule.setVendorDD(geronimoOpenejb);
 

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java?view=diff&rev=524850&r1=524849&r2=524850
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
Mon Apr  2 10:47:30 2007
@@ -187,6 +187,13 @@
                 continue;
             }
 
+            // skip corba refs
+            GerEjbRefType ejbRefType = refMap.get(refName);
+            if (ejbRefType != null) {
+                if (ejbRefType.getNsCorbaloc() != null) {
+                    continue;
+                }
+            }
             // create the ejb-ref
             EjbRef ref = new EjbRef();
             jndiConsumer.getEjbRef().add(ref);
@@ -217,7 +224,6 @@
             ref.setMappedName(getStringValue(xmlbeansRef.getMappedName()));
 
             // handle external refs
-            GerEjbRefType ejbRefType = refMap.get(ref.getEjbRefName());
             if (ejbRefType != null) {
                 if (ejbRefType.getNsCorbaloc() != null) {
                     // corba refs are simple delegated back to Geronimo



Mime
View raw message