cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r509004 [1/3] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/common/util/factory/ common/common/src/main/java/org/apache/cx...
Date Sun, 18 Feb 2007 21:07:03 GMT
Author: dandiep
Date: Sun Feb 18 13:06:58 2007
New Revision: 509004

URL: http://svn.apache.org/viewvc?view=rev&rev=509004
Log:
o Unify the Provider and Service code for JAX-WS so we have one ServiceFactory
  for both. This simplifies usage of EndpointImpl a fair amount and also
  makes it possible for Providers to use lots of the other utilities we have 
  around like WS-Address or WS-RM.
o Remove unnecessary ProviderObserver/ProviderInvoker classes
o Remove the hard dependency in JAXB on SAAJ for the simple frontend and
  separate out Source handling into a separate databinding.
o Remove the DataReader/WriterFactory concept as it is overly redundant.
  Now the schema & attachments can be set directly on the DataReader and 
  DataWriters.
o Add a flag to the BindingFactorys to optionally disable databinding
  so that users may provide their own databinding interceptors. In the Provider
  case we use Provider(In/Out)DatabindingInterceptors.
o Add some more code first tests in the JAX-WS module for Providers
o Change the RestSourcePayloadProvider class to use the XML binding as it
  is not a SOAP endpoint.
o Add dependency on SAAJ to ws-addressing module as it seems to through
  SOAPFaultExceptions in some places. I think this is probably just a
  holdover from the old Celtix code?
o Add a DispatchTest to the JAX-WS module

Added:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java   (with props)
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java
      - copied, changed from r507579, incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataFactoryBase.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataReader.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataWriter.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ProviderInDatabindingInterceptor.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ProviderOutDatabindingInterceptor.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/DOMSourcePayloadProvider.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml   (with props)
Removed:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataReaderFactory.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriterFactory.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataFactoryBase.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/MessageDataReader.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataReader.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataWriter.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPMessageDataReader.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLMessageDataReader.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
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/SOAPBodyDataReaderTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/SOAPMessageDataReaderTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLMessageDataReaderTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderChainObserver.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderInvoker.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ProviderServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/ProviderServiceFactoryBeanTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/SourcePayloadProvider.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataReader.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriter.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/factory/package.html
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties
    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/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
    incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/XMLBindingFactoryTest.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.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/ClientFaultConverter.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedInInterceptor.java
    incubator/cxf/trunk/rt/databinding/jaxb/pom.xml
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentMarshaller.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataReader.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataWriter.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataReader.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataWriter.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBDataBindingTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataReaderTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataWriterTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/pom.xml
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointPublisherImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/binding/soap/JaxWsSoapBindingInfoFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/AbstractJaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/DummyImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/ws/addr/pom.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProviderHttpBinding.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataBinding.java Sun Feb 18 13:06:58 2007
@@ -19,21 +19,20 @@
 
 package org.apache.cxf.databinding;
 
-import java.util.Map;
-
-import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 
 public interface DataBinding {
     
-    DataReaderFactory getDataReaderFactory();
+    <T> DataReader<T> createReader(Class<T> cls);
     
-    DataWriterFactory getDataWriterFactory();
+    <T> DataWriter<T> createWriter(Class<T> cls);
+    
+    Class<?>[] getSupportedReaderFormats();
+    
+    Class<?>[] getSupportedWriterFormats();
     
-    Map<String, SchemaInfo> getSchemas(ServiceInfo serviceInfo);
-
     /**
-     * Initialize the service info (i.e. type & element names) with 
+     * Initialize the service info (i.e. type & element names, Schemas) with 
      * information from the databinding.
      * @param serviceInfo
      */

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataReader.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataReader.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataReader.java Sun Feb 18 13:06:58 2007
@@ -19,12 +19,19 @@
 
 package org.apache.cxf.databinding;
 
+import java.util.Collection;
+
 import javax.xml.namespace.QName;
+import javax.xml.validation.Schema;
 
+import org.apache.cxf.message.Attachment;
 import org.apache.cxf.service.model.MessagePartInfo;
 
 public interface DataReader<T> {
     Object read(T input);
     Object read(MessagePartInfo part, T input);
     Object read(QName name, T input, Class type);
+    void setSchema(Schema s);
+    void setAttachments(Collection<Attachment> attachments);
+    void setProperty(String prop, Object value);
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriter.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriter.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWriter.java Sun Feb 18 13:06:58 2007
@@ -19,9 +19,16 @@
 
 package org.apache.cxf.databinding;
 
+import java.util.Collection;
+
+import javax.xml.validation.Schema;
+
+import org.apache.cxf.message.Attachment;
 import org.apache.cxf.service.model.MessagePartInfo;
 
 public interface DataWriter<T> {
     void write(Object obj, T output);
     void write(Object obj, MessagePartInfo part, T output);
+    void setSchema(Schema s);
+    void setAttachments(Collection<Attachment> attachments);
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Sun Feb 18 13:06:58 2007
@@ -31,6 +31,7 @@
     boolean isElementQualified;
     boolean isAttributeQualified;
     XmlSchema schema;
+    String systemId;
     
     public SchemaInfo(ServiceInfo serviceInfo, String namespaceUri) {
         this.serviceInfo = serviceInfo;
@@ -81,5 +82,13 @@
 
     public void setSchema(XmlSchema schema) {
         this.schema = schema;
+    }
+
+    public String getSystemId() {
+        return systemId;
+    }
+
+    public void setSystemId(String systemId) {
+        this.systemId = systemId;
     }
 }

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/factory/package.html
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/factory/package.html?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/factory/package.html (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/factory/package.html Sun Feb 18 13:06:58 2007
@@ -19,13 +19,6 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<!--
-
-  @(#)package.html	1.60 04/11/24
-
-  This is a simple Factory related package.
-
--->
 </head>
 <body bgcolor="white">
 

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Sun Feb 18 13:06:58 2007
@@ -253,7 +253,7 @@
                 writer.setPrefix(prefix, uri);
             }
         } else {
-            writer.writeStartElement(reader.getLocalName());
+            writer.writeStartElement(local);
         }
 
         // Write out the namespaces
@@ -440,7 +440,9 @@
         } else if (n instanceof ProcessingInstruction) {
             ProcessingInstruction pi = (ProcessingInstruction)n;
             writer.writeProcessingInstruction(pi.getTarget(), pi.getData());
-        }
+        } else if (n instanceof Document) {
+            writeDocument((Document)n, writer, repairing);
+        } 
     }
 
     public static Document read(XMLStreamReader reader) throws XMLStreamException {

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamWriter.java Sun Feb 18 13:06:58 2007
@@ -53,6 +53,16 @@
         this.document = document;
     }
 
+    public W3CDOMStreamWriter(Element e) {
+        this.document = e.getOwnerDocument();
+        
+        currentNode = e;
+
+        W3CNamespaceContext newContext = new W3CNamespaceContext();
+        newContext.setElement(currentNode);
+        this.context = newContext;
+    }
+
     public void setProperties(Map properties) {
         this.properties = properties;
     }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Sun Feb 18 13:06:58 2007
@@ -54,8 +54,6 @@
 import org.apache.cxf.interceptor.AttachmentOutInterceptor;
 import org.apache.cxf.interceptor.BareOutInterceptor;
 import org.apache.cxf.interceptor.DocLiteralInInterceptor;
-import org.apache.cxf.interceptor.LoggingInInterceptor;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
 import org.apache.cxf.interceptor.URIMappingInterceptor;
@@ -74,6 +72,8 @@
 
 public class SoapBindingFactory extends AbstractBindingFactory {
 
+    public static final String MESSAGE_PROCESSING_DISABLED = "disable.header.processing";
+    
     private boolean mtomEnabled = true;
     
     private Collection<String> activationNamespaces;    
@@ -119,24 +119,44 @@
         }
 
         sb.getInInterceptors().add(new AttachmentInInterceptor());
-        sb.getInInterceptors().add(new ReadHeadersInterceptor());
-        sb.getInInterceptors().add(new MustUnderstandInterceptor());
-        sb.getInInterceptors().add(new StaxInInterceptor());        
-        sb.getInInterceptors().add(new SoapHeaderInterceptor());
+        sb.getInInterceptors().add(new StaxInInterceptor()); 
         
-        sb.getInInterceptors().add(new LoggingInInterceptor());
-      
         sb.getOutInterceptors().add(new SoapActionInterceptor());
         sb.getOutInterceptors().add(new AttachmentOutInterceptor());
-        
         sb.getOutInterceptors().add(new StaxOutInterceptor());
-        sb.getOutInterceptors().add(new SoapPreProtocolOutInterceptor());
-        sb.getOutInterceptors().add(new SoapOutInterceptor());
-
-        sb.getOutInterceptors().add(new LoggingOutInterceptor());
-
+        
         sb.getOutFaultInterceptors().add(new StaxOutInterceptor());
-        sb.getOutFaultInterceptors().add(new SoapOutInterceptor());
+
+        if (!Boolean.TRUE.equals(binding.getProperty(DATABINDING_DISABLED))) {
+            if (SoapConstants.BINDING_STYLE_RPC.equalsIgnoreCase(bindingStyle)) {
+                sb.getInInterceptors().add(new RPCInInterceptor());
+                sb.getOutInterceptors().add(new RPCOutInterceptor());
+            } else if (SoapConstants.BINDING_STYLE_DOC.equalsIgnoreCase(bindingStyle)
+                            && SoapConstants.PARAMETER_STYLE_BARE.equalsIgnoreCase(parameterStyle)) {
+                //sb.getInInterceptors().add(new BareInInterceptor());
+                sb.getInInterceptors().add(new DocLiteralInInterceptor());
+                sb.getOutInterceptors().add(new BareOutInterceptor());
+            } else {
+                //sb.getInInterceptors().add(new WrappedInInterceptor());
+                sb.getInInterceptors().add(new DocLiteralInInterceptor());
+                sb.getOutInterceptors().add(new WrappedOutInterceptor());
+                sb.getOutInterceptors().add(new BareOutInterceptor());
+            }
+        }
+        
+        if (!Boolean.TRUE.equals(binding.getProperty(MESSAGE_PROCESSING_DISABLED))) {
+            sb.getInInterceptors().add(new SoapHeaderInterceptor());
+            sb.getInInterceptors().add(new ReadHeadersInterceptor());
+            sb.getInInterceptors().add(new MustUnderstandInterceptor());
+            sb.getOutInterceptors().add(new SoapPreProtocolOutInterceptor());
+            sb.getOutInterceptors().add(new SoapOutInterceptor());
+            sb.getOutFaultInterceptors().add(new SoapOutInterceptor());
+
+            // REVISIT: The phase interceptor chain seems to freak out if this added
+            // first. Not sure what the deal is at the moment, I suspect the
+            // ordering algorithm needs to be improved
+            sb.getInInterceptors().add(new URIMappingInterceptor());
+        }
         
         if (version.getVersion() == 1.1) {
             sb.getInFaultInterceptors().add(new Soap11FaultInInterceptor());
@@ -146,22 +166,6 @@
             sb.getOutFaultInterceptors().add(new Soap12FaultOutInterceptor());
         }        
 
-        if (SoapConstants.BINDING_STYLE_RPC.equalsIgnoreCase(bindingStyle)) {
-            sb.getInInterceptors().add(new RPCInInterceptor());
-            sb.getOutInterceptors().add(new RPCOutInterceptor());
-        } else if (SoapConstants.BINDING_STYLE_DOC.equalsIgnoreCase(bindingStyle)
-                        && SoapConstants.PARAMETER_STYLE_BARE.equalsIgnoreCase(parameterStyle)) {
-            //sb.getInInterceptors().add(new BareInInterceptor());
-            sb.getInInterceptors().add(new DocLiteralInInterceptor());
-            sb.getOutInterceptors().add(new BareOutInterceptor());
-        } else {
-            //sb.getInInterceptors().add(new WrappedInInterceptor());
-            sb.getInInterceptors().add(new DocLiteralInInterceptor());
-            sb.getOutInterceptors().add(new WrappedOutInterceptor());
-            sb.getOutInterceptors().add(new BareOutInterceptor());
-        }
-        
-        sb.getInInterceptors().add(new URIMappingInterceptor());
         return sb;
     }
 

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java Sun Feb 18 13:06:58 2007
@@ -30,4 +30,5 @@
 //    public static final String STYLE_BARE = "bare";
 //    public static final String STYLE_WRAPPED = "wrapped";
     public static final String ACTION = "action";
+    public static final String BINDING_ID = null;
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Messages.properties Sun Feb 18 13:06:58 2007
@@ -24,4 +24,5 @@
 MUST_UNDERSTAND=Can not understand QNames: {0}
 PARSER_EXC=Could not create DOM DocumentBuilder.
 NO_OPERATION=No such operation: {0}
-ATTACHMENT_IO=Attachment IO Exception: {0}
\ No newline at end of file
+ATTACHMENT_IO=Attachment IO Exception: {0}
+INVALID_VERSION="{0}" is not a valid SOAP version.
\ No newline at end of file

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=509004&r1=509003&r2=509004
==============================================================================
--- 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 Sun Feb 18 13:06:58 2007
@@ -24,6 +24,7 @@
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
@@ -84,7 +85,7 @@
             operation = message.getExchange().get(BindingOperationInfo.class);
         }
         MessageInfo msg;
-        DataReader<Message> dr = getMessageDataReader(message);
+        DataReader<XMLStreamReader> dr = getDataReader(message, XMLStreamReader.class);
 
         if (!isRequestor(message)) {
             msg = operation.getOperationInfo().getInput();
@@ -108,7 +109,7 @@
                 throw new SoapFault("Parameter " + xmlReader.getName() + " does not exist!",
                               ((SoapMessage)message).getVersion().getSender());
             }            
-            Object param = dr.read(part, message);
+            Object param = dr.read(part, xmlReader);
             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=509004&r1=509003&r2=509004
==============================================================================
--- 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 Sun Feb 18 13:06:58 2007
@@ -56,7 +56,7 @@
             assert operation.getName() != null;
 
             XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
-            DataWriter<Message> dataWriter = getMessageDataWriter(message);
+            DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message, XMLStreamWriter.class);
 
             addOperationNode(nsStack, message, xmlWriter);
 
@@ -91,7 +91,7 @@
                 }
                 for (int idx = 0; idx < countParts; idx++) {                    
                     MessagePartInfo part = llist.get(idx);
-                    dataWriter.write(objs.get(idx), part, message);                    
+                    dataWriter.write(objs.get(idx), part, xmlWriter);                    
                 }
             }
             // Finishing the writing.

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java Sun Feb 18 13:06:58 2007
@@ -31,6 +31,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
@@ -72,6 +73,10 @@
             if (xmlReader.nextTag() == XMLStreamConstants.START_ELEMENT) {
                 String ns = xmlReader.getNamespaceURI();
                 SoapVersion soapVersion = SoapVersionFactory.getInstance().getSoapVersion(ns);
+                if (soapVersion == null) {
+                    throw new SoapFault(new Message("INVALID_VERSION", LOG, ns), 
+                                        Soap11.getInstance().getSender());
+                }
                 message.setVersion(soapVersion);
                 
                 QName qn = xmlReader.getName();

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java Sun Feb 18 13:06:58 2007
@@ -33,6 +33,7 @@
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
 import org.apache.cxf.interceptor.BareInInterceptor;
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -50,6 +51,8 @@
         super();
         setPhase(Phase.UNMARSHAL);
         addAfter(BareInInterceptor.class.getName());
+        addAfter(RPCInInterceptor.class.getName());
+        addAfter(DocLiteralInInterceptor.class.getName());
     }
 
     public void handleMessage(Message m) throws Fault {
@@ -75,7 +78,7 @@
         }
         
         List<SoapHeaderInfo> headers = bmi.getExtensors(SoapHeaderInfo.class);
-        if (headers == null) {
+        if (headers == null || headers.size() == 0) {
             return;
         }
         

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Sun Feb 18 13:06:58 2007
@@ -34,7 +34,6 @@
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.databinding.DataWriter;
-import org.apache.cxf.databinding.DataWriterFactory;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -194,16 +193,9 @@
 
     protected DataWriter<XMLStreamWriter> getDataWriter(Message message) {
         Service service = ServiceModelUtil.getService(message.getExchange());
-        DataWriterFactory factory = service.getDataBinding().getDataWriterFactory();
-
-        DataWriter<XMLStreamWriter> dataWriter = null;
-        for (Class<?> cls : factory.getSupportedFormats()) {
-            if (cls == XMLStreamWriter.class) {
-                dataWriter = factory.createWriter(XMLStreamWriter.class);
-                break;
-            }
-        }
-
+        DataWriter<XMLStreamWriter> dataWriter = service.getDataBinding().createWriter(XMLStreamWriter.class);
+        dataWriter.setAttachments(message.getAttachments());
+        
         if (dataWriter == null) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAWRITER", BUNDLE, service
                 .getName()));

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java Sun Feb 18 13:06:58 2007
@@ -19,8 +19,6 @@
 package org.apache.cxf.binding.xml;
 
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
 
 import javax.annotation.Resource;
 
@@ -39,8 +37,6 @@
 
 public class XMLBindingFactory extends AbstractBindingFactory {
 
-    private Map cachedBinding = new HashMap<BindingInfo, Binding>();
-
     private Collection<String> activationNamespaces;
 
     @Resource(name = "activationNamespaces")
@@ -53,23 +49,21 @@
     }
 
     public Binding createBinding(BindingInfo binding) {
-
-        if (cachedBinding.get(binding) != null) {
-            return (Binding) cachedBinding.get(binding);
-        }
-
         XMLBinding xb = new XMLBinding();
         
         xb.getInInterceptors().add(new AttachmentInInterceptor());
         xb.getInInterceptors().add(new StaxInInterceptor());
-        xb.getInInterceptors().add(new XMLMessageInInterceptor());
-        xb.getInInterceptors().add(new URIMappingInterceptor());
-        xb.getInInterceptors().add(new DocLiteralInInterceptor());
-               
+        
         xb.getInFaultInterceptors().add(new XMLFaultInInterceptor());
         
         xb.getOutInterceptors().add(new StaxOutInterceptor());
-        xb.getOutInterceptors().add(new XMLMessageOutInterceptor());
+        
+        if (!Boolean.TRUE.equals(binding.getProperty(DATABINDING_DISABLED))) {
+            xb.getInInterceptors().add(new URIMappingInterceptor());
+            xb.getOutInterceptors().add(new XMLMessageOutInterceptor());
+            xb.getInInterceptors().add(new DocLiteralInInterceptor());
+            xb.getInInterceptors().add(new XMLMessageInInterceptor());
+        }
         
         xb.getOutFaultInterceptors().add(new StaxOutInterceptor());
         xb.getOutFaultInterceptors().add(new XMLFaultOutInterceptor());

Modified: incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/XMLBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/XMLBindingFactoryTest.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/XMLBindingFactoryTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/XMLBindingFactoryTest.java Sun Feb 18 13:06:58 2007
@@ -24,12 +24,13 @@
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.interceptor.AttachmentInInterceptor;
 import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.service.model.BindingInfo;
 
 public class XMLBindingFactoryTest extends TestCase {
     
     public void testContainsInAttachmentInterceptor() {
         XMLBindingFactory xbf = new XMLBindingFactory();
-        Binding b = xbf.createBinding(null);
+        Binding b = xbf.createBinding(new BindingInfo(null, null));
         
         boolean found = false;
         for (Interceptor interseptor : b.getInInterceptors()) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java Sun Feb 18 13:06:58 2007
@@ -41,6 +41,8 @@
 
 public abstract class AbstractBindingFactory implements BindingFactory, WSDLBindingFactory {
 
+    public static final String DATABINDING_DISABLED = "databinding.disabled";
+    
     @Resource
     Bus bus;
     

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties?view=auto&rev=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties Sun Feb 18 13:06:58 2007
@@ -0,0 +1,21 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+COULD_NOT_READ_XML_STREAM = Could not parse the XML stream.

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java?view=auto&rev=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java Sun Feb 18 13:06:58 2007
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.databinding.source;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+
+import org.w3c.dom.Node;
+
+import org.xml.sax.InputSource;
+
+import org.apache.cxf.attachment.CachedOutputStream;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.service.model.MessagePartInfo;
+
+public class NodeDataReader implements DataReader<Node> {
+    private static final Logger LOG = LogUtils.getL7dLogger(NodeDataReader.class);
+
+    public Object read(MessagePartInfo part, Node input) {
+        return read(input);
+    }
+
+    public Object read(QName name, Node input, Class type) {
+        if (SAXSource.class.isAssignableFrom(type)) {
+            try {
+                CachedOutputStream out = new CachedOutputStream();
+                DOMUtils.writeXml(input, out);
+                
+                return new SAXSource(new InputSource(out.getInputStream()));
+            } catch (IOException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            } catch (TransformerException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            }
+        } else if (StreamSource.class.isAssignableFrom(type)) {
+            try {
+                CachedOutputStream out = new CachedOutputStream();
+                DOMUtils.writeXml(input, out);
+                out.close();
+                
+                return new StreamSource(out.getInputStream());
+            } catch (IOException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            } catch (TransformerException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            } 
+        }  
+        return read(input);
+    }
+
+    public Object read(Node n) {
+        return new DOMSource(n);
+    }
+    
+    public void setSchema(Schema s) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setAttachments(Collection<Attachment> attachments) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void setProperty(String prop, Object value) {
+        // TODO Auto-generated method stub
+        
+    }
+    
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java?view=auto&rev=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java Sun Feb 18 13:06:58 2007
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.databinding.source;
+
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.staxutils.W3CDOMStreamWriter;
+
+public class NodeDataWriter implements DataWriter<Node> {
+    private static final Logger LOG = LogUtils.getL7dLogger(NodeDataWriter.class);
+
+    public void write(Object obj, MessagePartInfo part, Node output) {
+        write(obj, output);
+    }
+
+    public void write(Object obj, Node n) {
+        try {
+            Source s = (Source) obj;
+            if (s instanceof DOMSource
+                    && ((DOMSource) s).getNode() == null) {
+                return;
+            }
+            
+            XMLStreamWriter writer = new W3CDOMStreamWriter((Element)n);
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader(s);
+            StaxUtils.copy(reader, writer);
+            reader.close();
+        } catch (XMLStreamException e) {
+            throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+        }
+    }
+
+    public void setSchema(Schema s) {
+    }
+
+    public void setAttachments(Collection<Attachment> attachments) {
+        // TODO Auto-generated method stub
+        
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java?view=auto&rev=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java Sun Feb 18 13:06:58 2007
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.databinding.source;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Node;
+
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.service.model.ServiceInfo;
+
+/**
+ * A simple databinding implementation which reads and writes Source objects.
+ */
+public class SourceDataBinding implements DataBinding {
+
+    private XMLStreamDataReader xsrReader;
+    private XMLStreamDataWriter xswWriter;
+    private NodeDataWriter nodeWriter;
+    private NodeDataReader nodeReader;
+
+    public SourceDataBinding() {
+        super();
+        this.xsrReader = new XMLStreamDataReader();
+        this.xswWriter = new XMLStreamDataWriter();
+
+        this.nodeReader = new NodeDataReader();
+        this.nodeWriter = new NodeDataWriter();
+    }
+
+    public void initialize(ServiceInfo serviceInfo) {
+        // do nothing
+    }
+    
+
+    @SuppressWarnings("unchecked")
+    public <T> DataReader<T> createReader(Class<T> cls) {
+        if (cls == XMLStreamReader.class) {
+            return (DataReader<T>) xsrReader;
+        } else if (cls == Node.class) {
+            return (DataReader<T>) nodeReader;
+        } else {
+            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
+        }
+    }
+
+    public Class<?>[] getSupportedReaderFormats() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> DataWriter<T> createWriter(Class<T> cls) {
+        if (cls == XMLStreamWriter.class) {
+            return (DataWriter<T>) xswWriter;
+        } else if (cls == Node.class) {
+            return (DataWriter<T>) nodeWriter;
+        } else {
+            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
+        }
+    }
+
+    public Class<?>[] getSupportedWriterFormats() {
+        return new Class[] {XMLStreamWriter.class, Node.class};
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java?view=auto&rev=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java Sun Feb 18 13:06:58 2007
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.databinding.source;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+
+import org.w3c.dom.Document;
+
+import org.xml.sax.InputSource;
+
+import org.apache.cxf.attachment.CachedOutputStream;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+
+public class XMLStreamDataReader implements DataReader<XMLStreamReader> {
+    private static final Logger LOG = LogUtils.getL7dLogger(XMLStreamDataReader.class);
+
+    public Object read(MessagePartInfo part, XMLStreamReader input) {
+        return read(null, input, part.getTypeClass());
+    }
+
+    public Object read(QName name, XMLStreamReader input, Class type) {
+        if (SAXSource.class.isAssignableFrom(type)) {
+            try {
+                CachedOutputStream out = new CachedOutputStream();
+                XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
+                StaxUtils.copy(input, xsw);
+                xsw.close();
+                out.close();
+                
+                return new SAXSource(new InputSource(out.getInputStream()));
+            } catch (IOException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            } catch (XMLStreamException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            }
+        } else if (StreamSource.class.isAssignableFrom(type)) {
+            try {
+                CachedOutputStream out = new CachedOutputStream();
+                XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
+                StaxUtils.copy(input, xsw);
+                xsw.close();
+                out.close();
+                
+                return new StreamSource(out.getInputStream());
+            } catch (IOException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            } catch (XMLStreamException e) {
+                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+            }
+        } 
+        
+        return read(input);
+    }
+
+    public Object read(XMLStreamReader reader) {
+        // Use a DOMSource for now, we should really use a StaxSource/SAXSource though for 
+        // performance reasons
+        try {
+            Document document = StaxUtils.read(reader);
+            return new DOMSource(document);
+        } catch (XMLStreamException e) {
+            throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+        }
+    }
+    
+    public void setSchema(Schema s) {
+    }
+
+    public void setAttachments(Collection<Attachment> attachments) {
+    }
+
+    public void setProperty(String prop, Object value) {   
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java?view=auto&rev=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java Sun Feb 18 13:06:58 2007
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.databinding.source;
+
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+
+public class XMLStreamDataWriter implements DataWriter<XMLStreamWriter> {
+    private static final Logger LOG = LogUtils.getL7dLogger(XMLStreamDataWriter.class);
+
+    public void write(Object obj, MessagePartInfo part, XMLStreamWriter output) {
+        write(obj, output);
+    }
+
+    public void write(Object obj, XMLStreamWriter writer) {
+        try {
+            Source s = (Source) obj;
+            if (s instanceof DOMSource
+                && ((DOMSource) s).getNode() == null) {
+                return;
+            }
+            
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader(s);
+            StaxUtils.copy(reader, writer);
+            reader.close();
+        } catch (XMLStreamException e) {
+            throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+        }
+    }
+
+    public void setSchema(Schema s) {
+    }
+
+    public void setAttachments(Collection<Attachment> attachments) {
+        // TODO Auto-generated method stub
+        
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=509004&r1=509003&r2=509004
==============================================================================
--- 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 Sun Feb 18 13:06:58 2007
@@ -31,7 +31,6 @@
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.databinding.DataReader;
-import org.apache.cxf.databinding.DataReaderFactory;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -57,35 +56,12 @@
         return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
     }
 
-    protected DataReader getDataReader(Message message, Class<?> input) {
+    protected <T> DataReader<T> getDataReader(Message message, Class<T> input) {
         Service service = ServiceModelUtil.getService(message.getExchange());
-        DataReaderFactory factory = service.getDataBinding().getDataReaderFactory();
-        setSchemaInMessage(service, message);
-        DataReader dataReader = null;
-        for (Class<?> cls : factory.getSupportedFormats()) {
-            if (cls == input) {
-                dataReader = factory.createReader(input);
-                break;
-            }
-        }
-        if (dataReader == null) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAREADER", 
-                                                                   BUNDLE, service.getName()));
-        }
-        return dataReader;
-    }
+        DataReader<T> dataReader = service.getDataBinding().createReader(input);
+        dataReader.setAttachments(message.getAttachments());
+        setSchemaInMessage(service, message, dataReader);
 
-    protected DataReader<Message> getMessageDataReader(Message message) {
-        Service service = ServiceModelUtil.getService(message.getExchange());
-        DataReaderFactory factory = service.getDataBinding().getDataReaderFactory();
-        setSchemaInMessage(service, message);
-        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()));
@@ -94,47 +70,17 @@
     }
 
     protected DataReader<XMLStreamReader> getDataReader(Message message) {
-        Service service = ServiceModelUtil.getService(message.getExchange());
-        DataReaderFactory factory = service.getDataBinding().getDataReaderFactory();
-        setSchemaInMessage(service, message);
-        DataReader<XMLStreamReader> dataReader = null;
-        for (Class<?> cls : factory.getSupportedFormats()) {
-            if (cls == XMLStreamReader.class) {
-                dataReader = factory.createReader(XMLStreamReader.class);
-                break;
-            }
-        }
-        if (dataReader == null) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAREADER", 
-                                                                   BUNDLE, service.getName()));
-        }
-        return dataReader;
+        return getDataReader(message, XMLStreamReader.class);
     }
 
     protected DataReader<Node> getNodeDataReader(Message message) {
-        Service service = ServiceModelUtil.getService(message.getExchange());
-        DataReaderFactory factory = service.getDataBinding().getDataReaderFactory();
-        setSchemaInMessage(service, message);
-        DataReader<Node> dataReader = null;
-        for (Class<?> cls : factory.getSupportedFormats()) {
-            if (cls == Node.class) {
-                dataReader = factory.createReader(Node.class);
-                break;
-            }
-        }
-        if (dataReader == null) {
-            throw new Fault(
-                            new org.apache.cxf.common.i18n.Message("NO_DATAREADER", BUNDLE, 
-                                                                   service.getName()));
-        }
-        return dataReader;
+        return getDataReader(message, Node.class);
     }
 
-    private void setSchemaInMessage(Service service, Message message) {
-        if (message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED) != null 
-                && Boolean.TRUE.equals(message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED))) {
+    private void setSchemaInMessage(Service service, Message message, DataReader<?> reader) {
+        if (Boolean.TRUE.equals(message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED))) {
             Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfo());
-            service.getDataBinding().getDataReaderFactory().setSchema(schema);
+            reader.setSchema(schema);
         }
     }
     
@@ -232,10 +178,10 @@
         return null;
     }
     
-    protected MessageInfo getMessageInfo(Message message, BindingOperationInfo operation, Exchange ex) {
+    protected MessageInfo getMessageInfo(Message message, BindingOperationInfo operation) {
         return getMessageInfo(message, operation, isRequestor(message));
     }
-    
+
     protected MessageInfo getMessageInfo(Message message, BindingOperationInfo operation, boolean requestor) {
         MessageInfo msgInfo;
         OperationInfo intfOp = operation.getOperationInfo();

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=509004&r1=509003&r2=509004
==============================================================================
--- 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 Sun Feb 18 13:06:58 2007
@@ -19,14 +19,14 @@
 
 package org.apache.cxf.interceptor;
 
-import java.util.ResourceBundle;
+import java.util.ArrayList;
+import java.util.Collection;
 
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.validation.Schema;
 
-import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.databinding.DataWriter;
-import org.apache.cxf.databinding.DataWriterFactory;
+import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.service.Service;
@@ -34,79 +34,32 @@
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 public abstract class AbstractOutDatabindingInterceptor extends AbstractPhaseInterceptor<Message> {
-    private static final ResourceBundle BUNDLE = BundleUtils
-        .getBundle(AbstractOutDatabindingInterceptor.class);
 
     protected boolean isRequestor(Message message) {
         return Boolean.TRUE.equals(message.containsKey(Message.REQUESTOR_ROLE));
     }
     
-    protected DataWriter getDataWriter(Message message, Class<?> output) {
+    protected <T> DataWriter<T> getDataWriter(Message message, Class<T> output) {
         Service service = ServiceModelUtil.getService(message.getExchange());
-        DataWriterFactory factory = service.getDataBinding().getDataWriterFactory();
-        setSchemaOutMessage(service, message);
-        DataWriter dataWriter = null;
-        for (Class<?> cls : factory.getSupportedFormats()) {
-            if (cls == output) {
-                dataWriter = factory.createWriter(output);
-                break;
-            }
-        }
-
-        if (dataWriter == null) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAWRITER", BUNDLE, service
-                .getName()));
-        }
-
-        return dataWriter;        
-    }
-
-    protected DataWriter<Message> getMessageDataWriter(Message message) {
+        DataWriter<T> writer = service.getDataBinding().createWriter(output);
         
-        Service service = ServiceModelUtil.getService(message.getExchange());
-        DataWriterFactory factory = service.getDataBinding().getDataWriterFactory();
-        setSchemaOutMessage(service, message);
-        DataWriter<Message> dataWriter = null;
-        for (Class<?> cls : factory.getSupportedFormats()) {
-            if (cls == Message.class) {
-                dataWriter = factory.createWriter(Message.class);
-                break;
+        if (Boolean.TRUE.equals(message.getContextualProperty(Message.MTOM_ENABLED))) {
+            Collection<Attachment> atts = message.getAttachments();
+            if (atts == null) {
+                atts = new ArrayList<Attachment>();
+                message.setAttachments(atts);
             }
+            writer.setAttachments(atts);
         }
-
-        if (dataWriter == null) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAWRITER", BUNDLE, service
-                .getName()));
-        }
-
-        return dataWriter;
+        
+        setSchemaOutMessage(service, message, writer);
+        return writer;
     }
 
-    protected DataWriter<XMLStreamWriter> getDataWriter(Message message) {
-        Service service = ServiceModelUtil.getService(message.getExchange());
-        DataWriterFactory factory = service.getDataBinding().getDataWriterFactory();
-        setSchemaOutMessage(service, message);
-        DataWriter<XMLStreamWriter> dataWriter = null;
-        for (Class<?> cls : factory.getSupportedFormats()) {
-            if (cls == XMLStreamWriter.class) {
-                dataWriter = factory.createWriter(XMLStreamWriter.class);
-                break;
-            }
-        }
-
-        if (dataWriter == null) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAWRITER", BUNDLE, service
-                .getName()));
-        }
-
-        return dataWriter;
-    }
-    
-    private void setSchemaOutMessage(Service service, Message message) {
-        if (message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED) != null 
-                && Boolean.TRUE.equals(message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED))) {
+    private void setSchemaOutMessage(Service service, Message message, DataWriter<?> writer) {
+        if (Boolean.TRUE.equals(message.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED))) {
             Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfo());
-            service.getDataBinding().getDataWriterFactory().setSchema(schema);
+            writer.setSchema(schema);
         }
     }
 

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=509004&r1=509003&r2=509004
==============================================================================
--- 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 Sun Feb 18 13:06:58 2007
@@ -71,7 +71,7 @@
         DepthXMLStreamReader xmlReader = getXMLStreamReader(message);
         Exchange exchange = message.getExchange();
 
-        DataReader<Message> dr = getMessageDataReader(message);
+        DataReader<XMLStreamReader> dr = getDataReader(message);
         List<Object> parameters = new ArrayList<Object>();
 
         Endpoint ep = exchange.get(Endpoint.class);
@@ -108,7 +108,7 @@
             // necessary?  Should we put the BindingMessageInfo on
             // the message instead of the MessageInfo?
             // msgInfo = getMessageInfo(message, bop, exchange);
-            getMessageInfo(message, bop, exchange);
+            getMessageInfo(message, bop);
             if (client) {
                 msgInfo = bop.getOutput();
             } else {
@@ -135,7 +135,7 @@
                 throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND", BUNDLE, elName));
             }
 
-            o = dr.read(p, message);
+            o = dr.read(p, xmlReader);
 
             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=509004&r1=509003&r2=509004
==============================================================================
--- 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 Sun Feb 18 13:06:58 2007
@@ -20,6 +20,8 @@
 package org.apache.cxf.interceptor;
 import java.util.List;
 
+import javax.xml.stream.XMLStreamWriter;
+
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -43,8 +45,9 @@
             return;
         }
         
-        DataWriter<Message> dataWriter = getMessageDataWriter(message);
-
+        DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message, XMLStreamWriter.class);
+        XMLStreamWriter xmlWriter = message.getContent(XMLStreamWriter.class);
+        
         int countParts = 0;
         List<MessagePartInfo> parts = null;
 
@@ -67,7 +70,7 @@
                 Object[] els = parts.toArray();
 
                 for (int idx = 0; idx < countParts; idx++) {
-                    dataWriter.write(args[idx], (MessagePartInfo)els[idx], message);
+                    dataWriter.write(args[idx], (MessagePartInfo)els[idx], xmlWriter);
                 }
             }
         }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java Sun Feb 18 13:06:58 2007
@@ -92,7 +92,7 @@
         Service s = msg.getExchange().get(Service.class);
         DataBinding dataBinding = s.getDataBinding();
 
-        DataReader<Node> reader = dataBinding.getDataReaderFactory().createReader(Node.class);
+        DataReader<Node> reader = dataBinding.createReader(Node.class);
         Object e = reader.read(part, exDetail);
         if (!(e instanceof Exception)) {
             Class<?> exClass = faultWanted.getProperty(Class.class.getName(), Class.class);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java Sun Feb 18 13:06:58 2007
@@ -23,15 +23,14 @@
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ResourceBundle;
-import java.util.Set;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.databinding.DataReader;
@@ -44,7 +43,6 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.MessageInfo;
-//import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
@@ -54,13 +52,6 @@
     private static final Logger LOG = Logger.getLogger(DocLiteralInInterceptor.class.getName());
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(DocLiteralInInterceptor.class);
 
-    private static Set<String> filter = new HashSet<String>();
-
-    static {
-        filter.add("void");
-        filter.add("javax.activation.DataHandler");
-    }
-
     public DocLiteralInInterceptor() {
         super();
         setPhase(Phase.UNMARSHAL);
@@ -74,7 +65,7 @@
         }
 
         DepthXMLStreamReader xmlReader = getXMLStreamReader(message);
-        DataReader<Message> dr = getMessageDataReader(message);
+        DataReader<XMLStreamReader> dr = getDataReader(message);
         List<Object> parameters = new ArrayList<Object>();
 
         Exchange exchange = message.getExchange();
@@ -105,7 +96,7 @@
 
             // Determine if there is a wrapper class
             if (msgInfo.getMessageParts().get(0).getTypeClass() != null) {
-                Object wrappedObject = dr.read(msgInfo.getMessageParts().get(0), message);
+                Object wrappedObject = dr.read(msgInfo.getMessageParts().get(0), xmlReader);
                 parameters.add(wrappedObject);
 
             } else {
@@ -126,7 +117,7 @@
                 // loop through each child element
                 while (StaxUtils.toNextElement(xmlReader)) {
                     MessagePartInfo part = itr.next();
-                    parameters.add(dr.read(part, message));
+                    parameters.add(dr.read(part, xmlReader));
                 }
             }
 
@@ -135,7 +126,7 @@
             BindingMessageInfo msgInfo = null;
 
             if (bop != null) { //for xml binding or client side
-                getMessageInfo(message, bop, exchange);
+                getMessageInfo(message, bop);
                 if (client) {
                     msgInfo = bop.getOutput();
                 } else {
@@ -184,7 +175,7 @@
                     throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND", BUNDLE, elName));
                 }
 
-                o = dr.read(p, message);
+                o = dr.read(p, xmlReader);
 
                 if (o != null) {
                     parameters.add(o);

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=509004&r1=509003&r2=509004
==============================================================================
--- 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 Sun Feb 18 13:06:58 2007
@@ -29,6 +29,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.databinding.DataReader;
@@ -86,7 +87,7 @@
 
         }
 
-        DataReader<Message> dr = getMessageDataReader(message);
+        DataReader<XMLStreamReader> dr = getDataReader(message);
         List<Object> objects;
 
         MessageInfo msgInfo = setMessage(message, operation, requestor);
@@ -95,7 +96,7 @@
         if (operation.isUnwrappedCapable()
             && msgInfo.getMessageParts().get(0).getTypeClass() != null) {
             objects = new ArrayList<Object>();
-            Object wrappedObject = dr.read(msgInfo.getMessageParts().get(0), message);
+            Object wrappedObject = dr.read(msgInfo.getMessageParts().get(0), xmlReader);
             objects.add(wrappedObject);
 
         } else {
@@ -118,7 +119,7 @@
             // loop through each child element
             while (StaxUtils.toNextElement(xmlReader)) {
                 MessagePartInfo part = itr.next();
-                objects.add(dr.read(part, message));
+                objects.add(dr.read(part, xmlReader));
             }
         }
 

Modified: incubator/cxf/trunk/rt/databinding/jaxb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/pom.xml?view=diff&rev=509004&r1=509003&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/pom.xml (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/pom.xml Sun Feb 18 13:06:58 2007
@@ -105,16 +105,6 @@
             <artifactId>activation</artifactId>
         </dependency>
 
-
-        <dependency>
-            <groupId>com.sun.xml.messaging.saaj</groupId>
-            <artifactId>saaj-impl</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>javax.xml.soap</groupId>
-            <artifactId>saaj-api</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-testutils</artifactId>

Copied: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java (from r507579, incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataFactoryBase.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java?view=diff&rev=509004&p1=incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataFactoryBase.java&r1=507579&p2=incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java&r2=509004
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataFactoryBase.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java Sun Feb 18 13:06:58 2007
@@ -19,14 +19,28 @@
 
 package org.apache.cxf.jaxb;
 
+import java.util.Collection;
+
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.attachment.AttachmentMarshaller;
+import javax.xml.bind.attachment.AttachmentUnmarshaller;
 import javax.xml.validation.Schema;
 
-public abstract class JAXBDataFactoryBase {
+import org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller;
+import org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller;
+import org.apache.cxf.message.Attachment;
+
+/**
+ * 
+ */
+public abstract class JAXBDataBase {
     
     protected JAXBContext context; 
     protected Schema schema;
-
+    protected Collection<Attachment> attachments;
+    protected boolean attachmentProcessingEnabled;
+    protected boolean unwrapJAXBElement = true;
+    
     public void setSchema(Schema s) {
         this.schema = s;
     }
@@ -42,4 +56,25 @@
         return context;
     }
 
+    public Collection<Attachment> getAttachments() {
+        return attachments;
+    }
+
+    public void setAttachments(Collection<Attachment> attachments) {
+        this.attachments = attachments;
+    }
+
+    protected AttachmentUnmarshaller getAttachmentUnmarshaller() {
+        return new JAXBAttachmentUnmarshaller(attachments);
+    }
+
+    protected AttachmentMarshaller getAttachmentMarrshaller() {
+        return new JAXBAttachmentMarshaller(attachments);
+    }
+    
+    public void setProperty(String prop, Object value) {
+        if (prop.equals(JAXBDataBinding.UNWRAP_JAXB_ELEMENT)) {
+            unwrapJAXBElement = Boolean.TRUE.equals(value);
+        }
+    }
 }



Mime
View raw message