tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r662639 - /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
Date Tue, 03 Jun 2008 04:34:21 GMT
Author: dblevins
Date: Mon Jun  2 21:34:21 2008
New Revision: 662639

URL: http://svn.apache.org/viewvc?rev=662639&view=rev
Log:
Unmarshal the new openejb-cmp-orm.xml if one exists

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java?rev=662639&r1=662638&r2=662639&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
Mon Jun  2 21:34:21 2008
@@ -30,6 +30,7 @@
 import org.apache.openejb.jee.Webservices;
 import org.apache.openejb.jee.jpa.unit.JaxbPersistenceFactory;
 import org.apache.openejb.jee.jpa.unit.Persistence;
+import org.apache.openejb.jee.jpa.EntityMappings;
 import org.apache.openejb.jee.oejb2.EnterpriseBean;
 import org.apache.openejb.jee.oejb2.GeronimoEjbJarType;
 import org.apache.openejb.jee.oejb2.JaxbOpenejbJar2;
@@ -73,6 +74,8 @@
             if (ejbModule.getOpenejbJar() == null) {
                 readOpenejbJar(ejbModule);
             }
+
+            readCmpOrm(ejbModule);
         }
 
         for (ClientModule clientModule : appModule.getClientModules()) {
@@ -289,6 +292,27 @@
         }
     }
 
+    private void readCmpOrm(EjbModule ejbModule) throws OpenEJBException {
+        Object data = ejbModule.getAltDDs().get("openejb-cmp-orm.xml");
+        if (data == null || data instanceof EntityMappings) {
+            return;
+        } else if (data instanceof URL) {
+            URL url = (URL) data;
+            try {
+                EntityMappings entitymappings = (EntityMappings) JaxbJavaee.unmarshal(EntityMappings.class,
url.openStream());
+                ejbModule.getAltDDs().put("openejb-cmp-orm.xml", entitymappings);
+            } catch (SAXException e) {
+                throw new OpenEJBException("Cannot parse the openejb-cmp-orm.xml file: "
+ url.toExternalForm(), e);
+            } catch (JAXBException e) {
+                throw new OpenEJBException("Cannot unmarshall the openejb-cmp-orm.xml file:
" + url.toExternalForm(), e);
+            } catch (IOException e) {
+                throw new OpenEJBException("Cannot read the openejb-cmp-orm.xml file: " +
url.toExternalForm(), e);
+            } catch (Exception e) {
+                throw new OpenEJBException("Encountered unknown error parsing the openejb-cmp-orm.xml
file: " + url.toExternalForm(), e);
+            }
+        }
+    }
+
     private void readConnector(ConnectorModule connectorModule, AppModule appModule) throws
OpenEJBException {
         if (connectorModule.getConnector() != null) return;
 
@@ -446,13 +470,13 @@
         try {
             connector = (Connector) JaxbJavaee.unmarshal(Connector.class, url.openStream());
         } catch (SAXException e) {
-            throw new OpenEJBException("Cannot parse the web.xml file: " + url.toExternalForm(),
e);
+            throw new OpenEJBException("Cannot parse the ra.xml file: " + url.toExternalForm(),
e);
         } catch (JAXBException e) {
-            throw new OpenEJBException("Cannot unmarshall the web.xml file: " + url.toExternalForm(),
e);
+            throw new OpenEJBException("Cannot unmarshall the ra.xml file: " + url.toExternalForm(),
e);
         } catch (IOException e) {
-            throw new OpenEJBException("Cannot read the web.xml file: " + url.toExternalForm(),
e);
+            throw new OpenEJBException("Cannot read the ra.xml file: " + url.toExternalForm(),
e);
         } catch (Exception e) {
-            throw new OpenEJBException("Encountered unknown error parsing the web.xml file:
" + url.toExternalForm(), e);
+            throw new OpenEJBException("Encountered unknown error parsing the ra.xml file:
" + url.toExternalForm(), e);
         }
         return connector;
     }



Mime
View raw message