You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by gn...@apache.org on 2007/04/24 23:56:35 UTC

svn commit: r532103 - in /incubator/cxf/trunk: rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/ rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/ rt/bindings/jbi/src/test/java/org/ rt/bindings/jbi/src/test/java/org/apache/ ...

Author: gnodet
Date: Tue Apr 24 14:56:33 2007
New Revision: 532103

URL: http://svn.apache.org/viewvc?view=rev&rev=532103
Log:
Refine JBI binding and transport
Add some tests
Add support for JBI in tooling

Added:
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java   (with props)
    incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xjb
    incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd   (with props)
Removed:
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java
Modified:
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBITransportFactory.java
    incubator/cxf/trunk/tools/common/pom.xml

Modified: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java Tue Apr 24 14:56:33 2007
@@ -26,7 +26,6 @@
 import org.apache.cxf.binding.jbi.interceptor.JBIOperationInInterceptor;
 import org.apache.cxf.binding.jbi.interceptor.JBIWrapperInInterceptor;
 import org.apache.cxf.binding.jbi.interceptor.JBIWrapperOutInterceptor;
-import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -38,12 +37,9 @@
     public Binding createBinding(BindingInfo binding) {
         JBIBinding jb = new JBIBinding((JBIBindingInfo) binding);
         jb.getInInterceptors().add(new JBIOperationInInterceptor());
-        jb.getInInterceptors().add(new StaxInInterceptor());
         jb.getInInterceptors().add(new JBIWrapperInInterceptor());
-        
         jb.getOutInterceptors().add(new StaxOutInterceptor());
         jb.getOutInterceptors().add(new JBIWrapperOutInterceptor());
-
         jb.getOutFaultInterceptors().add(new StaxOutInterceptor());
         jb.getOutFaultInterceptors().add(new JBIFaultOutInterceptor());
         return jb;

Modified: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java (original)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java Tue Apr 24 14:56:33 2007
@@ -25,7 +25,7 @@
 
 public class JBIMessage extends AbstractWrappedMessage {
 
-    protected JBIMessage(Message msg) {
+    public JBIMessage(Message msg) {
         super(msg);
     }
     

Modified: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java Tue Apr 24 14:56:33 2007
@@ -43,9 +43,9 @@
     }
 
     public void handleMessage(JBIMessage message) throws Fault {
-        XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
-        Fault fault = (Fault) message.getContent(Exception.class);
         try {
+            XMLStreamWriter writer = getWriter(message);
+            Fault fault = getFault(message);
             if (!fault.hasDetails()) {
                 writer.writeEmptyElement("fault");
             } else {
@@ -63,4 +63,24 @@
         }
     }
 
+    protected Fault getFault(JBIMessage message) {
+        Exception e = message.getContent(Exception.class);
+        Fault fault;
+        if (e == null) {
+            throw new IllegalStateException("No exception on this message!");
+        } else if (e instanceof Fault) {
+            fault = (Fault) e;
+        } else {
+            fault = new Fault(e);
+        }
+        return fault;
+    }
+    
+    protected XMLStreamWriter getWriter(JBIMessage message) {
+        XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
+        if (writer == null) {
+            throw new IllegalStateException("No XMLStreamWriter on this message");
+        }
+        return writer;
+    }
 }

Modified: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java Tue Apr 24 14:56:33 2007
@@ -39,6 +39,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
@@ -86,8 +87,10 @@
             BindingOperationInfo bop = ex.get(BindingOperationInfo.class);
             DataReader<XMLStreamReader> dr = getDataReader(message);
             List<Object> parameters = new ArrayList<Object>();
-            for (MessagePartInfo part : bop.getInput().getMessageParts()) {
-                if (reader.nextTag() != XMLStreamConstants.START_ELEMENT) {
+            reader.next();
+            BindingMessageInfo messageInfo = isRequestor(message) ? bop.getInput() : bop.getOutput();
+            for (MessagePartInfo part : messageInfo.getMessageParts()) {
+                if (!StaxUtils.skipToStartOfElement(reader)) {
                     throw new Fault(new org.apache.cxf.common.i18n.Message(
                             "NO_ENOUGH_PARTS", BUNDLE));
                 }
@@ -110,7 +113,14 @@
                 }
                 reader.next();
             }
-            if (reader.getEventType() != XMLStreamConstants.END_DOCUMENT) {
+            int ev = reader.getEventType();
+            while (ev != XMLStreamConstants.END_ELEMENT 
+                    && ev != XMLStreamConstants.START_ELEMENT
+                    && ev != XMLStreamConstants.END_DOCUMENT) {
+                ev = reader.next();
+            }
+            if (ev == XMLStreamConstants.START_ELEMENT) {
+                System.err.println(reader.getEventType());
                 throw new Fault(new org.apache.cxf.common.i18n.Message("TOO_MUCH_PARTS", BUNDLE));
             }
             message.setContent(List.class, parameters);

Added: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java?view=auto&rev=532103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java Tue Apr 24 14:56:33 2007
@@ -0,0 +1,53 @@
+/**
+ * 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.binding.jbi;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.jbi.interceptor.JBIFaultOutInterceptor;
+import org.apache.cxf.binding.jbi.interceptor.JBIOperationInInterceptor;
+import org.apache.cxf.binding.jbi.interceptor.JBIWrapperInInterceptor;
+import org.apache.cxf.binding.jbi.interceptor.JBIWrapperOutInterceptor;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.service.model.ServiceInfo;
+
+public class JBIBindingFactoryTest extends TestCase {
+
+    public void testCreateBinding() {
+        JBIBindingInfo info = new JBIBindingInfo(new ServiceInfo(), "id");
+        Binding binding = new JBIBindingFactory().createBinding(info);
+        assertEquals(2, binding.getInInterceptors().size());
+        //assertEquals(?, binding.getInFaultInterceptors().size());
+        assertEquals(2, binding.getOutInterceptors().size());
+        assertEquals(2, binding.getOutFaultInterceptors().size());
+        assertEquals(JBIOperationInInterceptor.class.getName(), 
+                        binding.getInInterceptors().get(0).getClass().getName());
+        assertEquals(JBIWrapperInInterceptor.class.getName(), 
+                        binding.getInInterceptors().get(1).getClass().getName());
+        assertEquals(StaxOutInterceptor.class.getName(), 
+                        binding.getOutInterceptors().get(0).getClass().getName());
+        assertEquals(JBIWrapperOutInterceptor.class.getName(), 
+                        binding.getOutInterceptors().get(1).getClass().getName());
+        assertEquals(StaxOutInterceptor.class.getName(), 
+                        binding.getOutFaultInterceptors().get(0).getClass().getName());
+        assertEquals(JBIFaultOutInterceptor.class.getName(), 
+                        binding.getOutFaultInterceptors().get(1).getClass().getName());
+    }
+}

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/JBIBindingFactoryTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java?view=auto&rev=532103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java Tue Apr 24 14:56:33 2007
@@ -0,0 +1,101 @@
+/**
+ * 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.binding.jbi.interceptor;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ResourceBundle;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Document;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.binding.jbi.JBIMessage;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
+
+public class JBIFaultOutInterceptorTest extends TestCase {
+    
+    public void testPhase() throws Exception {
+        PhaseInterceptor<JBIMessage> interceptor = new JBIFaultOutInterceptor();
+        assertEquals(Phase.MARSHAL, interceptor.getPhase());
+    }
+    
+    public void testNoWriter() throws Exception {
+        PhaseInterceptor<JBIMessage> interceptor = new JBIFaultOutInterceptor();
+        try {
+            JBIMessage msg = new JBIMessage(new MessageImpl());
+            interceptor.handleMessage(msg);
+            fail("Should have thrown an exception");
+        } catch (IllegalStateException e) {
+            // ok
+        }
+    }
+
+    public void testNoFault() throws Exception {
+        PhaseInterceptor<JBIMessage> interceptor = new JBIFaultOutInterceptor();
+        try {
+            JBIMessage msg = new JBIMessage(new MessageImpl());
+            msg.setContent(XMLStreamWriter.class, 
+                    XMLOutputFactory.newInstance().createXMLStreamWriter(new ByteArrayOutputStream()));
+            interceptor.handleMessage(msg);
+            fail("Should have thrown an exception");
+        } catch (IllegalStateException e) {
+            // ok
+        }
+    }
+
+    public void testEmptyFault() throws Exception {
+        PhaseInterceptor<JBIMessage> interceptor = new JBIFaultOutInterceptor();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(baos); 
+        JBIMessage msg = new JBIMessage(new MessageImpl());
+        msg.setContent(XMLStreamWriter.class, writer);
+        msg.setContent(Exception.class, new Exception("My fault"));
+        interceptor.handleMessage(msg);
+        writer.close();
+        Document doc = DOMUtils.readXml(new ByteArrayInputStream(baos.toByteArray()));
+        assertEquals("fault", doc.getDocumentElement().getNodeName());
+    }
+
+    public void testDetailedFault() throws Exception {
+        PhaseInterceptor<JBIMessage> interceptor = new JBIFaultOutInterceptor();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(baos); 
+        JBIMessage msg = new JBIMessage(new MessageImpl());
+        Fault f = new Fault(new Message("FAULT", (ResourceBundle) null));
+        f.getOrCreateDetail();
+        f.getDetail().appendChild(f.getDetail().getOwnerDocument().createElementNS("urn:test", "myDetails"));
+        msg.setContent(XMLStreamWriter.class, writer);
+        msg.setContent(Exception.class, f);
+        interceptor.handleMessage(msg);
+        writer.close();
+        Document doc = DOMUtils.readXml(new ByteArrayInputStream(baos.toByteArray()));
+        assertEquals("urn:test", doc.getDocumentElement().getNamespaceURI());
+        assertEquals("myDetails", doc.getDocumentElement().getNodeName());
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java?view=auto&rev=532103
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java Tue Apr 24 14:56:33 2007
@@ -0,0 +1,50 @@
+/**
+ * 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.binding.jbi.interceptor;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.binding.jbi.JBIMessage;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
+
+public class JBIOperationInInterceptorTest extends TestCase {
+
+    public void testPhase() throws Exception {
+        PhaseInterceptor<JBIMessage> interceptor = new JBIOperationInInterceptor();
+        assertEquals(Phase.PRE_PROTOCOL, interceptor.getPhase());
+    }
+    
+    /*
+    public void testOperation() throws Exception {
+        PhaseInterceptor<JBIMessage> interceptor = new JBIOperationInInterceptor();
+        JBIMessage msg = new JBIMessage(new MessageImpl());
+        MessageExchange me = EasyMock.createMock(MessageExchange.class);
+        EasyMock.expect(me.getOperation()).andReturn(new QName("urn:test", "SayHi"));
+        EasyMock.replay(me);
+        msg.put(MessageExchange.class, me);
+        Endpoint ep = null;
+        msg.getExchange().put(Endpoint.class, ep);
+        msg.setExchange(new ExchangeImpl());
+        
+        interceptor.handleMessage(msg);
+    }
+    */
+    
+}

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/test/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Tue Apr 24 14:56:33 2007
@@ -48,12 +48,12 @@
 import javax.wsdl.extensions.UnknownExtensibilityElement;
 import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.extensions.schema.SchemaImport;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap12.SOAP12Binding;
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 
-import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingFactory;
@@ -425,10 +425,20 @@
             
         if (factory == null) { // get the transport id from bindingInfo
             elements = port.getBinding().getExtensibilityElements();
-            for (ExtensibilityElement el : CastUtils.cast(elements, ExtensibilityElement.class)) {
-                if (el instanceof SOAPBindingImpl) {
-                    ns = (String)((SOAPBindingImpl)el).getTransportURI();
-                    break;
+            if (null != elements && elements.size() > 0) {
+                for (ExtensibilityElement el : CastUtils.cast(elements, ExtensibilityElement.class)) {
+                    if (el instanceof SOAPBinding) {
+                        ns = (String)((SOAPBinding)el).getTransportURI();
+                        break;
+                    } else if (el instanceof SOAP12Binding) {
+                        ns = (String)((SOAP12Binding)el).getTransportURI();
+                        break;
+                    // TODO: this is really ugly, but how to link between this binding and this transport ?
+                    } else if ("http://cxf.apache.org/bindings/jbi"
+                                    .equals(el.getElementType().getNamespaceURI())) {
+                        ns = "http://cxf.apache.org/transports/jbi";
+                        break;
+                    }
                 }
             }
             try {

Modified: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java (original)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java Tue Apr 24 14:56:33 2007
@@ -22,7 +22,6 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.lang.reflect.Method;
 import java.util.logging.Logger;
 
@@ -33,6 +32,7 @@
 import javax.jbi.messaging.NormalizedMessage;
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
@@ -41,6 +41,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
@@ -111,8 +112,6 @@
             LOG.info(new org.apache.cxf.common.i18n.Message("EXCHANGE.ENDPOINT", LOG).toString()
                      + xchng.getEndpoint());
 
-            InputStream ins = null;
-
             if (inMsg != null) {
                 LOG.info("setup message contents on " + inMsg);
                 inMsg.setContent(getMessageContent(message));
@@ -129,19 +128,10 @@
                     channel.sendSync(xchng);
                     NormalizedMessage outMsg = ((InOut)xchng).getOutMessage();
                     
-                    //revisit later
-                    /*Source content = outMsg.getContent();
-                    XMLStreamReader reader = StaxUtils.createXMLStreamReader(content);
-                    message.setContent(XMLStreamReader.class, reader);*/
-                    
-                    ins = JBIMessageHelper.convertMessageToInputStream(outMsg.getContent());
-                    if (ins == null) {
-                        throw new IOException(new org.apache.cxf.common.i18n.Message(
-                            "UNABLE.RETRIEVE.MESSAGE", LOG).toString());
-                    }
                     Message inMessage = new MessageImpl();
                     message.getExchange().setInMessage(inMessage);
-                    inMessage.setContent(InputStream.class, ins);
+                    XMLStreamReader reader = StaxUtils.createXMLStreamReader(outMsg.getContent());
+                    inMessage.setContent(XMLStreamReader.class, reader);
                     conduit.getMessageObserver().onMessage(inMessage);
                     
                 } else {

Modified: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java Tue Apr 24 14:56:33 2007
@@ -20,7 +20,6 @@
 package org.apache.cxf.transport.jbi;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -29,11 +28,13 @@
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.transport.AbstractConduit;
 import org.apache.cxf.transport.AbstractDestination;
 import org.apache.cxf.transport.Conduit;
@@ -94,9 +95,13 @@
          */
         public void prepare(Message message) throws IOException {
             // setup the message to be send back
+            DeliveryChannel dc = channel;
+            if (dc == null) {
+                dc = JBITransportFactory.getDeliveryChannel();
+            }
             message.put(MessageExchange.class, inMessage.get(MessageExchange.class));
             message.setContent(OutputStream.class,
-                               new JBIDestinationOutputStream(inMessage, channel));
+                               new JBIDestinationOutputStream(inMessage, dc));
         }        
 
         protected Logger getLogger() {
@@ -110,11 +115,12 @@
         
         NormalizedMessage nm = exchange.getMessage("in");
         try {
-            final InputStream in = JBIMessageHelper.convertMessageToInputStream(nm.getContent());
             //get the message to be interceptor
             MessageImpl inMessage = new MessageImpl();
             inMessage.put(MessageExchange.class, exchange);
-            inMessage.setContent(InputStream.class, in);
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader(nm.getContent());
+            inMessage.setContent(XMLStreamReader.class, reader);
+            inMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
                                            
             //dispatch to correct destination in case of multiple endpoint
             inMessage.setDestination(this);

Modified: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBITransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBITransportFactory.java?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBITransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBITransportFactory.java Tue Apr 24 14:56:33 2007
@@ -51,7 +51,7 @@
 
     private static final Logger LOG = LogUtils.getL7dLogger(JBITransportFactory.class);
 
-    private DeliveryChannel deliveryChannel;
+    private static final ThreadLocal<DeliveryChannel> DELIVERY_CHANNEL = new ThreadLocal<DeliveryChannel>();
     private Bus bus;
     private final Map<String, JBIDestination> destinationMap =  new HashMap<String, JBIDestination>();
     
@@ -97,14 +97,14 @@
     }
 
     
-    public DeliveryChannel getDeliveryChannel() {
-        return deliveryChannel;
+    public static DeliveryChannel getDeliveryChannel() {
+        return DELIVERY_CHANNEL.get();
     }
 
-    public void setDeliveryChannel(DeliveryChannel newDeliverychannel) {
+    public static void setDeliveryChannel(DeliveryChannel newDeliverychannel) {
         LOG.info(new org.apache.cxf.common.i18n.Message(
             "CONFIG.DELIVERY.CHANNEL", LOG).toString() + newDeliverychannel);
-        deliveryChannel = newDeliverychannel;
+        DELIVERY_CHANNEL.set(newDeliverychannel);
     }
 
     public Conduit getConduit(EndpointInfo targetInfo) throws IOException {
@@ -112,7 +112,7 @@
     }
 
     public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException {
-        Conduit conduit = new JBIConduit(target, deliveryChannel);
+        Conduit conduit = new JBIConduit(target, getDeliveryChannel());
         Configurer configurer = bus.getExtension(Configurer.class);
         if (null != configurer) {
             configurer.configureBean(conduit);
@@ -121,7 +121,7 @@
     }
 
     public Destination getDestination(EndpointInfo ei) throws IOException {
-        JBIDestination destination = new JBIDestination(ei, deliveryChannel);
+        JBIDestination destination = new JBIDestination(ei, getDeliveryChannel());
         Configurer configurer = bus.getExtension(Configurer.class);
         if (null != configurer) {
             configurer.configureBean(destination);
@@ -146,4 +146,5 @@
     public JBIDestination getDestination(String epName) {
         return destinationMap.get(epName);
     }
+    
 }

Modified: incubator/cxf/trunk/tools/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/pom.xml?view=diff&rev=532103&r1=532102&r2=532103
==============================================================================
--- incubator/cxf/trunk/tools/common/pom.xml (original)
+++ incubator/cxf/trunk/tools/common/pom.xml Tue Apr 24 14:56:33 2007
@@ -116,22 +116,30 @@
 			<configuration>
 			    <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
 			    <xsdOptions>
-				<xsdOption>
-				    <xsd>${basedir}/src/main/resources/schemas/wsdl/xml-binding.xsd</xsd>
-				    <bindingFile>${basedir}/src/main/resources/schemas/wsdl/xml-binding.xjb</bindingFile>
-				    <deleteDirs>
-					<deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
-				    </deleteDirs>
-				</xsdOption>
-				
-				<xsdOption>
-				    <xsd>${basedir}/src/main/resources/schemas/wsdl/jms.xsd</xsd>
-				    <bindingFile>${basedir}/src/main/resources/schemas/wsdl/jms.xjb</bindingFile>
-				    <deleteDirs>
-					<deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
-				    </deleteDirs>
-				</xsdOption>
-				
+      				<xsdOption>
+      				    <xsd>${basedir}/src/main/resources/schemas/wsdl/xml-binding.xsd</xsd>
+      				    <bindingFile>${basedir}/src/main/resources/schemas/wsdl/xml-binding.xjb</bindingFile>
+      				    <deleteDirs>
+            					<deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
+      				    </deleteDirs>
+      				</xsdOption>
+      				
+  			      <xsdOption>
+    			        <xsd>${basedir}/src/main/resources/schemas/wsdl/jms.xsd</xsd>
+    			        <bindingFile>${basedir}/src/main/resources/schemas/wsdl/jms.xjb</bindingFile>
+    			        <deleteDirs>
+      			          <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
+    			        </deleteDirs>
+  			      </xsdOption>
+  			      
+  			      <xsdOption>
+    			        <xsd>${basedir}/src/main/resources/schemas/wsdl/jbi.xsd</xsd>
+    			        <bindingFile>${basedir}/src/main/resources/schemas/wsdl/jbi.xjb</bindingFile>
+    			        <deleteDirs>
+      			          <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
+    			        </deleteDirs>
+  			      </xsdOption>
+			      
 			    </xsdOptions>
 			</configuration>
 			<goals>

Added: incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xjb
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xjb?view=auto&rev=532103
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xjb (added)
+++ incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xjb Tue Apr 24 14:56:33 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
+<jaxb:bindings version="1.0" 
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 
+  jaxb:extensionBindingPrefixes="xjc">
+    <jaxb:bindings schemaLocation="../../../../../../../common/schemas/src/main/resources/schemas/wsdl/wsdl.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.wsdl"/>
+        </jaxb:schemaBindings>
+        <jaxb:globalBindings generateIsSetMethod="true"/>
+    </jaxb:bindings>
+    <jaxb:bindings schemaLocation="../../../../../../../common/schemas/src/main/resources/schemas/wsdl/wsdl.xsd" node="/xs:schema/xs:complexType[@name='tExtensibilityElement']">
+        <jaxb:class implClass="org.apache.cxf.wsdl.TExtensibilityElementImpl"/>
+    </jaxb:bindings>
+</jaxb:bindings>

Added: incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd?view=auto&rev=532103
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd (added)
+++ incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd Tue Apr 24 14:56:33 2007
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:jbi="http://cxf.apache.org/bindings/jbi"
+  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+  targetNamespace="http://cxf.apache.org/bindings/jbi"
+  elementFormDefault="qualified"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0">
+  
+  <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
+    schemaLocation="../../../../../../../common/schemas/src/main/resources/schemas/wsdl/wsdl.xsd" />
+  
+  <xs:complexType name="JBIFormatBinding">
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibilityElement">
+        <xs:sequence />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  
+  <xs:element name="binding" type="jbi:JBIFormatBinding"/>
+  
+</xs:schema>

Propchange: incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/tools/common/src/main/resources/schemas/wsdl/jbi.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml