cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject svn commit: r442525 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/message/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/core/src/main/java/org/apache/cxf/interce...
Date Tue, 12 Sep 2006 08:40:17 GMT
Author: tli
Date: Tue Sep 12 01:40:16 2006
New Revision: 442525

URL: http://svn.apache.org/viewvc?view=rev&rev=442525
Log:
Using MessageDataReader/Writer instead of XMLStreamDataReader/Writer to support Attachment
marshal/unmarshal, and internally the MessageDataReader/Writer will delegate the XML body
to XMLStreamDataReader/Writer

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedInInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataReaderFactory.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataWriterFactory.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataReaderFactoryTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataWriterFactoryTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Tue Sep 12 01:40:16
2006
@@ -41,6 +41,8 @@
     String CORRELATION_OUT = "org.apache.cxf.correlation.out";
     String CORRELATION_IN = "org.apache.cxf.correlation.in";
     
+    String MTOM_ENABLED = "org.apache.cxf.isMtomEnabled";
+    
     String getId();
     
     InterceptorChain getInterceptorChain();

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
Tue Sep 12 01:40:16 2006
@@ -24,7 +24,6 @@
 import java.util.List;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.endpoint.Endpoint;
@@ -77,7 +76,7 @@
         }
         findMethod(message);
         MessageInfo msg;
-        DataReader<XMLStreamReader> dr = getDataReader(message);
+        DataReader<Message> dr = getMessageDataReader(message);
 
         if (!isRequestor(message)) {
             msg = operation.getInput().getMessageInfo();
@@ -102,7 +101,7 @@
                 String expMessage = "Parameter " + name + " does not equal to the name in
the servicemodel!";
                 message.setContent(Exception.class, new RuntimeException(expMessage));
             }
-            Object param = dr.read(elName, xmlReader, getParameterTypeClass(message, idx));
+            Object param = dr.read(elName, message, getParameterTypeClass(message, idx));
             parameters.add(param);
         }
         message.setContent(List.class, parameters);

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
Tue Sep 12 01:40:16 2006
@@ -59,7 +59,7 @@
             assert operation.getName() != null;
 
             XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
-            DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message);
+            DataWriter<Message> dataWriter = getMessageDataWriter(message);
 
             addOperationNode(message, xmlWriter);
 
@@ -87,7 +87,7 @@
                     Object arg = args[idx];
                     MessagePartInfo part = (MessagePartInfo) els[idx];
                     QName elName = getPartName(part);
-                    dataWriter.write(arg, elName, xmlWriter);
+                    dataWriter.write(arg, elName, message);
                 }
             }
             // Finishing the writing.

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue
Sep 12 01:40:16 2006
@@ -252,6 +252,8 @@
     
     protected void setOutMessageProperties(Message message, BindingOperationInfo boi) {
         message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
+        // when configuration is ready, using config bean instead
+        message.put(Message.MTOM_ENABLED, Boolean.TRUE);
         message.put(BindingMessageInfo.class, boi.getInput());
         message.put(MessageInfo.class, boi.getOperationInfo().getInput());
     }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
Tue Sep 12 01:40:16 2006
@@ -68,7 +68,25 @@
         }
         return dataReader;        
     }
-    
+
+    protected DataReader<Message> getMessageDataReader(Message message) {
+        Service service = ServiceModelUtil.getService(message.getExchange());
+        DataReaderFactory factory = service.getDataReaderFactory();
+
+        DataReader<Message> dataReader = null;
+        for (Class<?> cls : factory.getSupportedFormats()) {
+            if (cls == Message.class) {
+                dataReader = factory.createReader(Message.class);
+                break;
+            }
+        }
+        if (dataReader == null) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAREADER", BUNDLE,

+                service.getName()));
+        }
+        return dataReader;
+    }
+
     protected DataReader<XMLStreamReader> getDataReader(Message message) {
         Service service = ServiceModelUtil.getService(message.getExchange());
         DataReaderFactory factory = service.getDataReaderFactory();

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
Tue Sep 12 01:40:16 2006
@@ -58,7 +58,28 @@
 
         return dataWriter;        
     }
-    
+
+    protected DataWriter<Message> getMessageDataWriter(Message message) {
+        
+        Service service = ServiceModelUtil.getService(message.getExchange());
+        DataWriterFactory factory = service.getDataWriterFactory();
+
+        DataWriter<Message> dataWriter = null;
+        for (Class<?> cls : factory.getSupportedFormats()) {
+            if (cls == Message.class) {
+                dataWriter = factory.createWriter(Message.class);
+                break;
+            }
+        }
+
+        if (dataWriter == null) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAWRITER", BUNDLE,
service
+                .getName()));
+        }
+
+        return dataWriter;
+    }
+
     protected DataWriter<XMLStreamWriter> getDataWriter(Message message) {
         Service service = ServiceModelUtil.getService(message.getExchange());
         DataWriterFactory factory = service.getDataWriterFactory();

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
Tue Sep 12 01:40:16 2006
@@ -25,7 +25,6 @@
 
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -55,7 +54,7 @@
 
         BindingOperationInfo operation = exchange.get(BindingOperationInfo.class);
 
-        DataReader<XMLStreamReader> dr = getDataReader(message);
+        DataReader<Message> dr = getMessageDataReader(message);
         List<Object> parameters = new ArrayList<Object>();
 
         List<MessagePartInfo> piList = null;
@@ -74,15 +73,15 @@
                         paraQName = mpi.getTypeQName();
                     }
                     if (streamParaQName.equals(paraQName)) {
-                        o = dr.read(paraQName, xmlReader);
+                        o = dr.read(paraQName, message);
                         break;
                     }
                 }
                 if (o == null) {
-                    o = dr.read(xmlReader);                    
+                    o = dr.read(message);                    
                 }
             } else {
-                o = dr.read(xmlReader);
+                o = dr.read(message);
             }
             if (o != null) {
                 parameters.add(o);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
Tue Sep 12 01:40:16 2006
@@ -21,7 +21,6 @@
 import java.util.List;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.message.Exchange;
@@ -47,7 +46,7 @@
             return;
         }
         
-        DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message);
+        DataWriter<Message> dataWriter = getMessageDataWriter(message);
 
         int countParts = 0;
         List<MessagePartInfo> parts = null;
@@ -68,8 +67,7 @@
                 message.setContent(Exception.class,
                     new RuntimeException("The number of arguments is not equal!"));
             }*/
-            
-            XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
+                        
             for (int idx = 0; idx < countParts; idx++) {
                 Object arg = args[idx];
                 MessagePartInfo part = (MessagePartInfo)els[idx];
@@ -78,7 +76,7 @@
                     continue;
                 }
                 QName elName = ServiceModelUtil.getPartName(part);
-                dataWriter.write(arg, elName, xmlWriter);
+                dataWriter.write(arg, elName, message);
             }
         }
     }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedInInterceptor.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedInInterceptor.java
Tue Sep 12 01:40:16 2006
@@ -80,13 +80,13 @@
             message.put(BindingMessageInfo.class, operation.getInput());
         }
         
-        DataReader<XMLStreamReader> dr = getDataReader(message);
+        DataReader<Message> dr = getMessageDataReader(message);
         List<Object> objects;
         
         // Determine if there is a wrapper class
         if (Boolean.TRUE.equals(operation.getOperationInfo().getProperty(SINGLE_WRAPPED_PART)))
{
             objects = new ArrayList<Object>();
-            Object wrappedObject = dr.read(xmlReader);
+            Object wrappedObject = dr.read(message);
             objects.add(wrappedObject);
         } else {
             // Unwrap each part individually if we don't have a wrapper
@@ -95,7 +95,7 @@
             
             try {
                 while (xmlReader.nextTag() == XMLStreamReader.START_ELEMENT && xmlReader.getDepth()
> depth) {
-                    objects.add(dr.read(xmlReader));
+                    objects.add(dr.read(message));
                 }
             } catch (XMLStreamException e) {
                 throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", BUNDLE),
e);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
Tue Sep 12 01:40:16 2006
@@ -44,26 +44,36 @@
         Exchange exchange = new ExchangeImpl();
         exchange.setInMessage(message);
         message.setExchange(exchange);
-        
-        exchange.put(Endpoint.class, endpoint);
-        exchange.put(Service.class, endpoint.getService());
-        exchange.put(Binding.class, endpoint.getBinding());
-        exchange.put(Bus.class, bus);
-        exchange.setDestination(m.getDestination());
+        setMessageProperties(message);
+        setExchangProperties(exchange, message);
         
         // setup chain
         PhaseInterceptorChain chain = new PhaseInterceptorChain(bus.getExtension(PhaseManager.class)
             .getInPhases());
         
         message.setInterceptorChain(chain);
+        
         chain.add(bus.getInInterceptors());
         chain.add(endpoint.getInInterceptors());
         chain.add(endpoint.getBinding().getInInterceptors());
         chain.add(endpoint.getService().getInInterceptors());
-        chain.setFaultInterceptor(endpoint.getFaultInterceptor());   
-        
+        chain.setFaultInterceptor(endpoint.getFaultInterceptor());           
 
         
         chain.doIntercept(message);        
     }
+    
+    protected void setMessageProperties(Message m) {
+        // when configuration is ready, using config bean instead
+        m.put(Message.MTOM_ENABLED, Boolean.TRUE);
+    }
+    
+    protected void setExchangProperties(Exchange exchange, Message m) {
+        exchange.put(Endpoint.class, endpoint);
+        exchange.put(Service.class, endpoint.getService());
+        exchange.put(Binding.class, endpoint.getBinding());
+        exchange.put(Bus.class, bus);
+        exchange.setDestination(m.getDestination());
+    }
+    
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataReaderFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataReaderFactory.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataReaderFactory.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataReaderFactory.java
Tue Sep 12 01:40:16 2006
@@ -29,14 +29,17 @@
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.databinding.DataReaderFactory;
 import org.apache.cxf.jaxb.io.EventDataReader;
+import org.apache.cxf.jaxb.io.MessageDataReader;
 import org.apache.cxf.jaxb.io.NodeDataReader;
 import org.apache.cxf.jaxb.io.SOAPBodyDataReader;
 import org.apache.cxf.jaxb.io.SOAPMessageDataReader;
 import org.apache.cxf.jaxb.io.XMLStreamDataReader;
+import org.apache.cxf.message.Message;
 
 
 public final class JAXBDataReaderFactory extends JAXBDataFactoryBase implements DataReaderFactory
{
     private static final Class<?> SUPPORTED_FORMATS[] = new Class<?>[] {Node.class,
+                                                                        Message.class,
                                                                         XMLEventReader.class,
                                                                         XMLStreamReader.class,
                                                                         SOAPBody.class,
@@ -49,19 +52,22 @@
     
     @SuppressWarnings("unchecked")
     public <T> DataReader<T> createReader(Class<T> cls) {
+        DataReader<T> dr = null;
         if (cls == XMLStreamReader.class) {
-            return (DataReader<T>)new XMLStreamDataReader(this);
+            dr = (DataReader<T>)new XMLStreamDataReader(this);
         } else if (cls == XMLEventReader.class) {
-            return (DataReader<T>)new EventDataReader(this);            
+            dr = (DataReader<T>)new EventDataReader(this);
+        } else if (cls == Message.class) {
+            dr = (DataReader<T>)new MessageDataReader(this);            
         } else if (cls == Node.class) {
-            return (DataReader<T>)new NodeDataReader(this);
+            dr = (DataReader<T>)new NodeDataReader(this);
         } else if (cls == SOAPBody.class) {
-            return (DataReader<T>)new SOAPBodyDataReader(this);
+            dr = (DataReader<T>)new SOAPBodyDataReader(this);
         } else if (cls == SOAPMessage.class) {
-            return (DataReader<T>)new SOAPMessageDataReader(this);
+            dr = (DataReader<T>)new SOAPMessageDataReader(this);
         }
         // TODO Auto-generated method stub
-        return null;
+        return dr;
     }
 
     public Class<?>[] getSupportedFormats() {

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataWriterFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataWriterFactory.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataWriterFactory.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataWriterFactory.java
Tue Sep 12 01:40:16 2006
@@ -28,12 +28,15 @@
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.databinding.DataWriterFactory;
 import org.apache.cxf.jaxb.io.EventDataWriter;
+import org.apache.cxf.jaxb.io.MessageDataWriter;
 import org.apache.cxf.jaxb.io.NodeDataWriter;
 import org.apache.cxf.jaxb.io.SOAPBodyDataWriter;
 import org.apache.cxf.jaxb.io.XMLStreamDataWriter;
+import org.apache.cxf.message.Message;
 
 public final class JAXBDataWriterFactory extends JAXBDataFactoryBase implements DataWriterFactory
{
     private static final Class<?> SUPPORTED_FORMATS[] = new Class<?>[] {Node.class,
+                                                                        Message.class,
                                                                         XMLEventWriter.class,
                                                                         XMLStreamWriter.class,
                                                                         SOAPBody.class};
@@ -50,6 +53,8 @@
             return (DataWriter<T>)new XMLStreamDataWriter(this);
         } else if (cls == XMLEventWriter.class) {
             return (DataWriter<T>)new EventDataWriter(this);            
+        } else if (cls == Message.class) {
+            return (DataWriter<T>)new MessageDataWriter(this);
         } else if (cls == Node.class) {
             return (DataWriter<T>)new NodeDataWriter(this);
         } else if (cls == SOAPBody.class) {

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
Tue Sep 12 01:40:16 2006
@@ -45,7 +45,10 @@
     
     public void write(Object obj, QName elName, Message output) {
         //if the mtom is enabled, we need to create the attachment mashaller
-        JAXBAttachmentMarshaller am = new JAXBAttachmentMarshaller(output); 
+        JAXBAttachmentMarshaller am = null;
+        if (output.containsKey(Message.MTOM_ENABLED)) {
+            am = new JAXBAttachmentMarshaller(output);
+        }
         Object source = null;        
         XMLStreamWriter xsw = (XMLStreamWriter)output.getContent(XMLStreamWriter.class);
         if (xsw != null) {

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataReaderFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataReaderFactoryTest.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataReaderFactoryTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataReaderFactoryTest.java
Tue Sep 12 01:40:16 2006
@@ -37,6 +37,7 @@
 import org.apache.cxf.jaxb.io.SOAPBodyDataReader;
 import org.apache.cxf.jaxb.io.SOAPMessageDataReader;
 import org.apache.cxf.jaxb.io.XMLStreamDataReader;
+import org.apache.cxf.message.Message;
 
 public class JAXBDataReaderFactoryTest extends TestCase {
     JAXBDataReaderFactory factory;
@@ -48,9 +49,10 @@
     public void testSupportedFormats() {
         List<Class<?>> cls = Arrays.asList(factory.getSupportedFormats());
         assertNotNull(cls);
-        assertEquals(5, cls.size());
+        assertEquals(6, cls.size());
         assertTrue(cls.contains(XMLStreamReader.class));
         assertTrue(cls.contains(XMLEventReader.class));
+        assertTrue(cls.contains(Message.class));
         assertTrue(cls.contains(Node.class));
         assertTrue(cls.contains(SOAPBody.class));
         assertTrue(cls.contains(SOAPMessage.class));

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataWriterFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataWriterFactoryTest.java?view=diff&rev=442525&r1=442524&r2=442525
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataWriterFactoryTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataWriterFactoryTest.java
Tue Sep 12 01:40:16 2006
@@ -35,6 +35,7 @@
 import org.apache.cxf.jaxb.io.NodeDataWriter;
 import org.apache.cxf.jaxb.io.SOAPBodyDataWriter;
 import org.apache.cxf.jaxb.io.XMLStreamDataWriter;
+import org.apache.cxf.message.Message;
 
 public class JAXBDataWriterFactoryTest extends TestCase {
     JAXBDataWriterFactory factory;
@@ -46,9 +47,10 @@
     public void testSupportedFormats() {
         List<Class<?>> cls = Arrays.asList(factory.getSupportedFormats());
         assertNotNull(cls);
-        assertEquals(4, cls.size());
+        assertEquals(5, cls.size());
         assertTrue(cls.contains(XMLStreamWriter.class));
         assertTrue(cls.contains(XMLEventWriter.class));
+        assertTrue(cls.contains(Message.class));
         assertTrue(cls.contains(Node.class));
         assertTrue(cls.contains(SOAPBody.class));
     }



Mime
View raw message