axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r902111 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2: datasource/jaxb/JAXBAttachmentUnmarshaller.java datasource/jaxb/JAXBDSContext.java jaxws/message/attachments/JAXBAttachmentUnmarshaller.java
Date Fri, 22 Jan 2010 15:14:32 GMT
Author: scheu
Date: Fri Jan 22 15:14:32 2010
New Revision: 902111

URL: http://svn.apache.org/viewvc?rev=902111&view=rev
Log:
AXIS2-4603
Contributor: Rich Scheuerle
The JAXB unmarshalling logic is changed to use the new Axiom "unwrapping" utility methods.
JAXB and the XMLStreamReader interfaces are defined by specifications.  Some vendors (IBM
for example)
require that the vendor JAXB unmarshalling framework has access to the same vendor JAXB XMLStreamReader.
The use of same vendor technology makes it easier to reproduce behavior across different stack
products and allows for tighter integration.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java?rev=902111&r1=902110&r2=902111&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java
Fri Jan 22 15:14:32 2010
@@ -19,8 +19,9 @@
 
 package org.apache.axis2.datasource.jaxb;
 
+import org.apache.axiom.om.OMAttachmentAccessor;
 import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMXMLStreamReader;
+import org.apache.axiom.util.stax.XMLStreamReaderUtils;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.commons.logging.Log;
@@ -168,9 +169,14 @@
             }
             return dh;
         }
-        if (xmlStreamReader instanceof OMXMLStreamReader) {
+        XMLStreamReader attachmentAccessor = 
+            XMLStreamReaderUtils.getOMAttachmentAccessorXMLStreamReader(xmlStreamReader);
+        
+        if (attachmentAccessor != null &&
+            attachmentAccessor instanceof OMAttachmentAccessor) {
+            
             DataHandler dh = 
-                ((OMXMLStreamReader) xmlStreamReader).getDataHandler(blobcid);
+                ((OMAttachmentAccessor) attachmentAccessor).getDataHandler(blobcid);
             if (dh != null) {
                 JAXBAttachmentUnmarshallerMonitor.addBlobCID(blobcid);
             }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java?rev=902111&r1=902110&r2=902111&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
Fri Jan 22 15:14:32 2010
@@ -21,6 +21,7 @@
 
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.util.stax.XMLStreamReaderUtils;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.message.OccurrenceArray;
@@ -290,12 +291,25 @@
 
     /**
      * Unmarshal the xml into a JAXB object
-     * @param reader
+     * @param inputReader
      * @return
      * @throws JAXBException
      */
-    public Object unmarshal(XMLStreamReader reader) throws JAXBException {
+    public Object unmarshal(XMLStreamReader inputReader) throws JAXBException {
 
+        if (DEBUG_ENABLED) {
+            String clsText = (inputReader !=null) ? inputReader.getClass().toString() : "null";
+            log.debug("unmarshal with inputReader=" + clsText);
+        } 
+        XMLStreamReader reader = XMLStreamReaderUtils.getOriginalXMLStreamReader(inputReader);
+        if (reader == null) {
+            reader = inputReader;
+        }
+        if (DEBUG_ENABLED) {
+            String clsText = (reader !=null) ? reader.getClass().toString() : "null";
+            log.debug("  originalReader=" + clsText);
+        } 
+        
         // There may be a preferred classloader that should be used
         ClassLoader cl = getClassLoader();
         

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java?rev=902111&r1=902110&r2=902111&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java
Fri Jan 22 15:14:32 2010
@@ -19,7 +19,8 @@
 
 package org.apache.axis2.jaxws.message.attachments;
 
-import org.apache.axiom.om.OMXMLStreamReader;
+import org.apache.axiom.om.OMAttachmentAccessor;
+import org.apache.axiom.util.stax.XMLStreamReaderUtils;
 import org.apache.axis2.datasource.jaxb.JAXBAttachmentUnmarshallerMonitor;
 import org.apache.axis2.jaxws.message.Message;
 
@@ -53,9 +54,13 @@
             return dh;
         }
         
-        if (xmlStreamReader instanceof OMXMLStreamReader) {
+        XMLStreamReader attachmentAccessor = 
+            XMLStreamReaderUtils.getOMAttachmentAccessorXMLStreamReader(xmlStreamReader);
+        
+        if (attachmentAccessor != null &&
+            attachmentAccessor instanceof OMAttachmentAccessor) {
             DataHandler dh = 
-                ((OMXMLStreamReader) xmlStreamReader).getDataHandler(cid);
+                ((OMAttachmentAccessor) attachmentAccessor).getDataHandler(cid);
             if (dh != null) {
                 JAXBAttachmentUnmarshallerMonitor.addBlobCID(cid);
             }



Mime
View raw message