geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r504699 - in /geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment: EjbModuleBuilder.java XmlUtil.java
Date Wed, 07 Feb 2007 21:30:25 GMT
Author: dain
Date: Wed Feb  7 13:30:24 2007
New Revision: 504699

URL: http://svn.apache.org/viewvc?view=rev&rev=504699
Log:
Fixed processing of nested openejb plans

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/XmlUtil.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=504699&r1=504698&r2=504699
==============================================================================
--- 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
Wed Feb  7 13:30:24 2007
@@ -173,12 +173,12 @@
 
         if (unknownXmlObject != null) {
             XmlCursor xmlCursor = unknownXmlObject.newCursor();
-            xmlCursor.toFirstChild();
+            //
             QName qname = xmlCursor.getName();
             if (qname.getLocalPart().equals("openejb-jar")){
-                ejbModule.getAltDDs().put("openejb-jar.xml", unknownXmlObject.xmlText());
+                ejbModule.getAltDDs().put("openejb-jar.xml", xmlCursor.xmlText());
             } else if (qname.getLocalPart().equals("ejb-jar") && qname.getNamespaceURI().equals("http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0")){
-                ejbModule.getAltDDs().put("geronimo-openejb.xml", unknownXmlObject.xmlText());
+                ejbModule.getAltDDs().put("geronimo-openejb.xml", xmlCursor.xmlText());
             }
         }
 

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java?view=diff&rev=504699&r1=504698&r2=504699
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
Wed Feb  7 13:30:24 2007
@@ -18,8 +18,8 @@
 package org.apache.geronimo.openejb.deployment;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -41,23 +41,13 @@
 import org.apache.xmlbeans.XmlDocumentProperties;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLFilterImpl;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.ValidationEvent;
 import javax.xml.namespace.QName;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.sax.SAXSource;
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
 public final class XmlUtil {
@@ -65,57 +55,6 @@
     private static final QName CMP_VERSION = new QName(SchemaConversionUtils.J2EE_NAMESPACE,
"cmp-version");
 
     private XmlUtil() {
-    }
-
-    public static class EjbJarNamespaceFilter extends XMLFilterImpl {
-
-        public EjbJarNamespaceFilter(XMLReader xmlReader) {
-            super(xmlReader);
-        }
-
-        public void startElement(String uri, String localName, String qname, Attributes atts)
throws SAXException {
-            super.startElement("http://java.sun.com/xml/ns/javaee", localName, qname, atts);
-        }
-    }
-
-    @SuppressWarnings({"unchecked"})
-    public static <T> T unmarshal(Class<T> type, String xml) throws DeploymentException
{
-        if (xml == null){
-            return null;
-        }
-
-        if (type.equals(EjbJar.class)){
-            try {
-                SAXParserFactory factory = SAXParserFactory.newInstance();
-                factory.setNamespaceAware(true);
-                factory.setValidating(true);
-
-                SAXParser parser = factory.newSAXParser();
-
-                EjbJarNamespaceFilter xmlFilter = new EjbJarNamespaceFilter(parser.getXMLReader());
-
-                JAXBContext ctx = JAXBContext.newInstance(type);
-                Unmarshaller unmarshaller = ctx.createUnmarshaller();
-
-                xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
-                SAXSource source = new SAXSource(xmlFilter, new InputSource(new ByteArrayInputStream(xml.getBytes())));
-
-                return (T) unmarshaller.unmarshal(source);
-            } catch (Exception e) {
-                throw new DeploymentException(e);
-            }
-        }
-
-        try {
-            JAXBContext ctx = JAXBContext.newInstance(type);
-            Unmarshaller unmarshaller = ctx.createUnmarshaller();
-
-            Object object = unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));
-            unmarshaller.setEventHandler(new ValidationEventHandler());
-            return (T) object;
-        } catch (JAXBException e) {
-            throw new DeploymentException(e);
-        }
     }
 
     public static <T> String marshal(T object) throws DeploymentException {



Mime
View raw message