geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1061722 - in /geronimo/server/trunk/plugins: openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ openejb/geronimo-openejb-builder/src/main/xsd/ openjpa2/geronimo-persistence-jpa20-builder/src/main/java/or...
Date Fri, 21 Jan 2011 10:30:27 GMT
Author: genspring
Date: Fri Jan 21 10:30:26 2011
New Revision: 1061722

URL: http://svn.apache.org/viewvc?rev=1061722&view=rev
Log:
enable cmp entity bean in geronimo.

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd
    geronimo/server/trunk/plugins/openjpa2/geronimo-persistence-jpa20-builder/src/main/java/org/apache/geronimo/persistence/builder/PersistenceUnitBuilder.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?rev=1061722&r1=1061721&r2=1061722&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
Fri Jan 21 10:30:26 2011
@@ -633,15 +633,19 @@ public class EjbModuleBuilder implements
         ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbJar));
 
         // Get the geronimo-openejb plan
-//            GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
+           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, geronimoEjbJarType);
+        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
-//            ejbModule.setVendorDD(geronimoOpenejb);
+            OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.convertToXmlbeans(geronimoEjbJarType);
+            
+           ejbModule.getVendorDD().set(geronimoOpenejb);
 
         // todo move namingBuilders.buildEnvironment() here when geronimo naming supports
it
 

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd?rev=1061722&r1=1061721&r2=1061722&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd
Fri Jan 21 10:30:26 2011
@@ -66,7 +66,7 @@
             <!-- GBeans -->
             <xs:choice minOccurs="0" maxOccurs="unbounded">
                 <xs:element ref="sys:service"/>
-                <xs:any namespace="http://java.sun.com/xml/ns/persistence"/>
+                <xs:any processContents="lax" namespace="http://java.sun.com/xml/ns/persistence"/>
             </xs:choice>
         </xs:sequence>
     </xs:complexType>

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=1061722&r1=1061721&r2=1061722&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
Fri Jan 21 10:30:26 2011
@@ -34,6 +34,7 @@ import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeployableBundle;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
@@ -62,6 +63,7 @@ import org.apache.xbean.osgi.bundle.util
 import org.apache.xbean.osgi.bundle.util.DiscoveryRange;
 import org.apache.xbean.osgi.bundle.util.ResourceDiscoveryFilter;
 import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -123,6 +125,7 @@ public class PersistenceUnitBuilder impl
         Map<String, Persistence.PersistenceUnit> overrides = new HashMap<String,
Persistence.PersistenceUnit>();
         try {
             for (XmlObject raw : raws) {
+             
                 Persistence persistence = fromXmlObject(raw);
                 for (Persistence.PersistenceUnit unit : persistence.getPersistenceUnit())
{
                     overrides.put(unit.getName().trim(), unit);
@@ -335,7 +338,29 @@ public class PersistenceUnitBuilder impl
     }
 
     private Persistence fromXmlObject(XmlObject xmlObject) throws JAXBException {
-        XMLStreamReader reader = xmlObject.newXMLStreamReader();
+        
+        /* 
+         * To avoid illegal exception in JAXB. Convert 
+         * 
+         * <xml-fragment> ... </xml-fragment> 
+         * to
+         * <persistence xmlns="http://java.sun.com/xml/ns/persistence"> ... </persistence>
+         * 
+         * before unmarshalling it 
+         */
+        XmlObject newXmlObject=XmlObject.Factory.newInstance();
+        XmlCursor newXmlCursor=newXmlObject.newCursor();
+        newXmlCursor.toNextToken();
+        newXmlCursor.beginElement(PERSISTENCE_QNAME);
+        
+        XmlCursor oldXmlCursor=xmlObject.newCursor();
+        oldXmlCursor.copyXmlContents(newXmlCursor);
+        
+        oldXmlCursor.dispose();
+        newXmlCursor.dispose();
+        
+        
+        XMLStreamReader reader = newXmlObject.newXMLStreamReader();
         JAXBContext context = JAXBContextFactory.newInstance(Persistence.class);
         Unmarshaller unmarshaller = context.createUnmarshaller();
         return (Persistence) unmarshaller.unmarshal(reader);



Mime
View raw message