geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r518850 - /geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Date Fri, 16 Mar 2007 03:15:45 GMT
Author: dain
Date: Thu Mar 15 20:15:45 2007
New Revision: 518850

URL: http://svn.apache.org/viewvc?view=rev&rev=518850
Log:
Set cmp persistence unit data source to the one declared in the openejb2 configuration

Modified:
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.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=518850&r1=518849&r2=518850
==============================================================================
--- 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
Thu Mar 15 20:15:45 2007
@@ -445,12 +445,12 @@
         ejbModule.setSpecDD(ejbJarType);
 
         // add the cmp persistence unit if needed
-        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
         if (appInfo.cmpMappingsXml != null) {
-            addGeronimmoOpenEJBPersistenceUnit(geronimoEjbJarType);
+            addGeronimmoOpenEJBPersistenceUnit(ejbModule);
         }
 
         // 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);
 
@@ -485,7 +485,9 @@
         }
     }
 
-    private void addGeronimmoOpenEJBPersistenceUnit(GeronimoEjbJarType geronimoEjbJarType)
{
+    private void addGeronimmoOpenEJBPersistenceUnit(EjbModule ejbModule) {
+        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
+
         // search for the cmp persistence unit
         PersistenceUnit persistenceUnit = null;
         for (Persistence persistence : geronimoEjbJarType.getPersistence()) {
@@ -502,11 +504,13 @@
         if (persistenceUnit == null) {
             String jtaDataSource = null;
             // todo Persistence Unit Data Sources need to be global JNDI names
-            // Object altDD = ejbModule.getEjbModule().getAltDDs().get("openejb-jar.xml");
-            // if (altDD instanceof OpenejbJarType) {
-            //     String datasourceName = ((OpenejbJarType) altDD).getCmpConnectionFactory().getResourceLink();
-            //     jtaDataSource = "?name=" + datasourceName;
-            // }
+            Object altDD = ejbModule.getEjbModule().getAltDDs().get("openejb-jar.xml");
+            if (altDD instanceof OpenejbJarType) {
+                String datasourceName = ((OpenejbJarType) altDD).getCmpConnectionFactory().getResourceLink();
+                if (datasourceName != null) {
+                    jtaDataSource = "?name=" + datasourceName;
+                }
+            }
 
             persistenceUnit = new PersistenceUnit();
             persistenceUnit.setName("cmp");
@@ -515,8 +519,8 @@
                 persistenceUnit.setJtaDataSource(jtaDataSource);
             } else {
                 persistenceUnit.setJtaDataSource("?name=SystemDatasource");
-                persistenceUnit.setNonJtaDataSource("?name=NoTxDatasource");
             }
+            persistenceUnit.setNonJtaDataSource("?name=NoTxDatasource");
 
             Persistence persistence = new Persistence();
             persistence.setVersion("1.0");



Mime
View raw message