cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r530117 [1/2] - in /incubator/cxf/trunk/rt: ./ bindings/ bindings/jbi/ bindings/jbi/src/ bindings/jbi/src/main/ bindings/jbi/src/main/java/ bindings/jbi/src/main/java/org/ bindings/jbi/src/main/java/org/apache/ bindings/jbi/src/main/java/or...
Date Wed, 18 Apr 2007 18:27:42 GMT
Author: gnodet
Date: Wed Apr 18 11:27:39 2007
New Revision: 530117

URL: http://svn.apache.org/viewvc?view=rev&rev=530117
Log:
CXF-262: add a JBI binding and a JBI transport

Added:
    incubator/cxf/trunk/rt/bindings/jbi/   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/pom.xml   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBinding.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingInfo.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIConstants.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperOutInterceptor.java   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/bus-extensions.xml   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/
    incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml   (with props)
    incubator/cxf/trunk/rt/bindings/jbi/src/test/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/java/
    incubator/cxf/trunk/rt/bindings/jbi/src/test/resources/
    incubator/cxf/trunk/rt/transports/jbi/   (with props)
    incubator/cxf/trunk/rt/transports/jbi/pom.xml   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/
    incubator/cxf/trunk/rt/transports/jbi/src/main/
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBITransportFactory.java   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/Messages.properties   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/resources/
    incubator/cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/
    incubator/cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/bus-extensions.xml   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/
    incubator/cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml   (with props)
    incubator/cxf/trunk/rt/transports/jbi/src/test/
    incubator/cxf/trunk/rt/transports/jbi/src/test/java/
    incubator/cxf/trunk/rt/transports/jbi/src/test/resources/
Modified:
    incubator/cxf/trunk/rt/bindings/pom.xml
    incubator/cxf/trunk/rt/pom.xml

Propchange: incubator/cxf/trunk/rt/bindings/jbi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr 18 11:27:39 2007
@@ -0,0 +1,3 @@
+.classpath
+.project
+.settings

Added: incubator/cxf/trunk/rt/bindings/jbi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/pom.xml?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/pom.xml (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/pom.xml Wed Apr 18 11:27:39 2007
@@ -0,0 +1,93 @@
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cxf-rt-bindings-jbi</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache CXF Runtime JBI Binding</name>
+    <url>http://cwiki.apache.org/CXF</url>
+
+    <parent>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-parent</artifactId>
+        <version>2.0-incubator-RC-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-databinding-jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-javamail_1.4_spec</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-activation_1.1_spec</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
+         <dependency>
+             <groupId>org.apache.cxf</groupId>
+             <artifactId>cxf-tools-common</artifactId>
+             <version>${project.version}</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-jbi</artifactId>
+            <version>3.1-incubating</version>
+        </dependency>
+      
+    </dependencies>
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/bindings/jbi</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/bindings/jbi</developerConnection>
+    </scm>
+
+</project>

Propchange: incubator/cxf/trunk/rt/bindings/jbi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/jbi/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/bindings/jbi/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBinding.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBinding.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBinding.java Wed Apr 18 11:27:39 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;
+
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingInfo;
+
+public class JBIBinding extends AbstractBasicInterceptorProvider implements Binding {
+
+    private JBIBindingInfo bindingInfo;
+    
+    public JBIBinding(JBIBindingInfo bindingInfo) {
+        this.bindingInfo = bindingInfo;
+    }
+    
+    public Message createMessage() {
+        return createMessage(new MessageImpl());
+    }
+
+    public Message createMessage(Message m) {
+        if (!m.containsKey(Message.CONTENT_TYPE)) {
+            m.put(Message.CONTENT_TYPE, "text/xml");
+        }
+        return new JBIMessage(m);
+    }
+
+    public BindingInfo getBindingInfo() {
+        return bindingInfo;
+    }
+
+}

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

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

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

Added: 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=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingFactory.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,66 @@
+/**
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.cxf.binding.AbstractBindingFactory;
+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.StaxInInterceptor;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+
+public class JBIBindingFactory extends AbstractBindingFactory {
+
+    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;
+    }
+
+    public BindingInfo createBindingInfo(ServiceInfo service, String namespace, Object config) {
+        JBIBindingInfo info = new JBIBindingInfo(service, JBIConstants.NS_JBI_BINDING);        
+        info.setName(new QName(service.getName().getNamespaceURI(), 
+                               service.getName().getLocalPart() + "JBIBinding"));
+
+        for (OperationInfo op : service.getInterface().getOperations()) {                       
+            BindingOperationInfo bop = 
+                info.buildOperation(op.getName(), op.getInputName(), op.getOutputName());
+            info.addOperation(bop);
+        }
+        
+        return info;
+    }
+
+}

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

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

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

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingInfo.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingInfo.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIBindingInfo.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,30 @@
+/**
+ * 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 org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+
+public class JBIBindingInfo extends BindingInfo {
+
+    public JBIBindingInfo(ServiceInfo service, String bindingId) {
+        super(service, bindingId);
+    }
+
+}

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

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

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

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIConstants.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIConstants.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIConstants.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,34 @@
+/**
+ * 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 javax.xml.namespace.QName;
+
+
+public final class JBIConstants {
+
+    public static final String NS_JBI_BINDING = "http://cxf.apache.org/bindings/jbi";
+
+    public static final String NS_JBI_WRAPPER = "http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper";
+    
+    public static final QName JBI_WRAPPER_MESSAGE = new QName(NS_JBI_WRAPPER, "message");
+
+    public static final QName JBI_WRAPPER_PART = new QName(NS_JBI_WRAPPER, "part");
+
+}
\ No newline at end of file

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

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

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

Added: 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=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/JBIMessage.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,36 @@
+/**
+ * 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 javax.jbi.messaging.MessageExchange;
+
+import org.apache.cxf.message.AbstractWrappedMessage;
+import org.apache.cxf.message.Message;
+
+public class JBIMessage extends AbstractWrappedMessage {
+
+    protected JBIMessage(Message msg) {
+        super(msg);
+    }
+    
+    public MessageExchange getJbiExchange() {
+        return get(MessageExchange.class);
+    }
+
+}

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

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

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

Added: 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=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,66 @@
+/**
+ * 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.util.ResourceBundle;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.binding.jbi.JBIMessage;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.StaxUtils;
+
+public class JBIFaultOutInterceptor extends AbstractPhaseInterceptor<JBIMessage> {
+
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JBIFaultOutInterceptor.class);
+
+    public JBIFaultOutInterceptor() {
+        setPhase(Phase.MARSHAL);
+    }
+
+    public void handleMessage(JBIMessage message) throws Fault {
+        XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
+        Fault fault = (Fault) message.getContent(Exception.class);
+        try {
+            if (!fault.hasDetails()) {
+                writer.writeEmptyElement("fault");
+            } else {
+                Element detail = fault.getDetail();
+                NodeList details = detail.getChildNodes();
+                for (int i = 0; i < details.getLength(); i++) {
+                    if (details.item(i) instanceof Element) {
+                        StaxUtils.writeNode(details.item(i), writer, true);
+                        break;
+                    }
+                }
+            }
+        } catch (XMLStreamException xe) {
+            throw new Fault(new Message("XML_WRITE_EXC", BUNDLE), xe);
+        }
+    }
+
+}

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

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

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

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptor.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIOperationInInterceptor.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,72 @@
+/**
+ * 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.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.binding.jbi.JBIMessage;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.OperationInfo;
+
+public class JBIOperationInInterceptor extends AbstractPhaseInterceptor<JBIMessage> {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIOperationInInterceptor.class);
+
+    private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+    public JBIOperationInInterceptor() {
+        super();
+        setPhase(Phase.PRE_PROTOCOL);
+    }
+
+    public void handleMessage(JBIMessage message) throws Fault {
+        Exchange ex = message.getExchange();
+        Endpoint ep = ex.get(Endpoint.class);
+        BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
+        if (boi == null && message.getJbiExchange().getOperation() != null) {
+            BindingInfo service = ep.getEndpointInfo().getBinding();
+            boi = getBindingOperationInfo(service, message.getJbiExchange().getOperation());
+            if (boi == null) {
+                throw new Fault(new Message("UNKNOWN_OPERATION", BUNDLE, 
+                        message.getJbiExchange().getOperation().toString()));
+            }
+            ex.put(BindingOperationInfo.class, boi);
+            ex.put(OperationInfo.class, boi.getOperationInfo());
+            ex.setOneWay(boi.getOperationInfo().isOneWay());
+            message.put(MessageInfo.class, boi.getInput().getMessageInfo());
+        }
+    }
+
+    protected BindingOperationInfo getBindingOperationInfo(BindingInfo service, QName operation) {
+        return service.getOperation(operation);
+    }
+
+}

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

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

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

Added: 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=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperInInterceptor.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,122 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.cxf.binding.jbi.JBIBindingInfo;
+import org.apache.cxf.binding.jbi.JBIConstants;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+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.BindingOperationInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.DepthXMLStreamReader;
+import org.apache.cxf.staxutils.StaxUtils;
+
+public class JBIWrapperInInterceptor extends AbstractInDatabindingInterceptor {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIWrapperInInterceptor.class);
+
+    private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+    public JBIWrapperInInterceptor() {
+        setPhase(Phase.UNMARSHAL);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        if (isGET(message)) {
+            LOG.info("JbiMessageInInterceptor skipped in HTTP GET method");
+            return;
+        }
+        XMLStreamReader xsr = message.getContent(XMLStreamReader.class);
+
+        DepthXMLStreamReader reader = new DepthXMLStreamReader(xsr);
+
+        Endpoint ep = message.getExchange().get(Endpoint.class);
+        BindingInfo binding = ep.getEndpointInfo().getBinding();
+        if (!(binding instanceof JBIBindingInfo)) {
+            throw new IllegalStateException("BindingInfo should be a JbiBindingInfo");
+        }
+
+        if (!StaxUtils.toNextElement(reader)) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_ELEMENT", BUNDLE));
+        }
+
+        Exchange ex = message.getExchange();
+        QName startQName = reader.getName();
+
+        // handling xml normal inbound message
+        if (!startQName.equals(JBIConstants.JBI_WRAPPER_MESSAGE)) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message(
+                    "NO_JBI_MESSAGE_ELEMENT", BUNDLE));
+        }
+
+        try {
+            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) {
+                    throw new Fault(new org.apache.cxf.common.i18n.Message(
+                            "NO_ENOUGH_PARTS", BUNDLE));
+                }
+                startQName = reader.getName();
+                if (!startQName.equals(JBIConstants.JBI_WRAPPER_PART)) {
+                    throw new Fault(new org.apache.cxf.common.i18n.Message(
+                            "NO_JBI_PART_ELEMENT", BUNDLE));
+                }
+                if (part.isElement()) {
+                    reader.next();
+                    if (!StaxUtils.toNextElement(reader)) {
+                        throw new Fault(new org.apache.cxf.common.i18n.Message(
+                                "EXPECTED_ELEMENT_IN_PART", BUNDLE));
+                    }
+                }
+                parameters.add(dr.read(part, reader));
+                // skip end element
+                if (part.isElement()) {
+                    reader.next();
+                }
+                reader.next();
+            }
+            if (reader.getEventType() != XMLStreamConstants.END_DOCUMENT) {
+                throw new Fault(new org.apache.cxf.common.i18n.Message("TOO_MUCH_PARTS", BUNDLE));
+            }
+            message.setContent(List.class, parameters);
+        } catch (XMLStreamException e) {
+            throw new RuntimeException("Couldn't parse stream.", e);
+        }
+    }
+
+}

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

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

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

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperOutInterceptor.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperOutInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIWrapperOutInterceptor.java Wed Apr 18 11:27:39 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.binding.jbi.interceptor;
+
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.binding.jbi.JBIConstants;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+
+public class JBIWrapperOutInterceptor extends AbstractOutDatabindingInterceptor {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIWrapperOutInterceptor.class);
+
+    private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
+
+    public JBIWrapperOutInterceptor() {
+        setPhase(Phase.MARSHAL);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+        XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
+        DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message, XMLStreamWriter.class);
+
+        try {
+            xmlWriter.setPrefix("jbi", JBIConstants.NS_JBI_WRAPPER);
+            xmlWriter.writeStartElement(JBIConstants.NS_JBI_WRAPPER, 
+                                        JBIConstants.JBI_WRAPPER_MESSAGE.getLocalPart());
+            xmlWriter.writeNamespace("jbi", JBIConstants.NS_JBI_WRAPPER);
+            
+            List<MessagePartInfo> parts = null;
+            if (!isRequestor(message)) {
+                parts = bop.getOutput().getMessageParts();
+            } else {
+                parts = bop.getInput().getMessageParts();
+            }
+            List<?> objs = (List<?>) message.getContent(List.class);                
+            if (objs.size() < parts.size()) {
+                throw new Fault(new org.apache.cxf.common.i18n.Message(
+                        "The number of arguments is not equal!", BUNDLE));
+            }
+            for (int idx = 0; idx < parts.size(); idx++) {
+                MessagePartInfo part = parts.get(idx);
+                Object obj = objs.get(idx);
+                if (!part.isElement()) {
+                    if (part.getTypeClass() == String.class) {
+                        xmlWriter.writeStartElement(JBIConstants.NS_JBI_WRAPPER, 
+                                                    JBIConstants.JBI_WRAPPER_PART.getLocalPart());
+                        xmlWriter.writeCharacters(obj.toString());
+                        xmlWriter.writeEndElement();
+                    } else {
+                        part = new MessagePartInfo(part.getName(), part.getMessageInfo());
+                        part.setElement(false);
+                        part.setConcreteName(JBIConstants.JBI_WRAPPER_PART);
+                        dataWriter.write(obj, part, xmlWriter);
+                    }
+                } else {
+                    xmlWriter.writeStartElement(JBIConstants.NS_JBI_WRAPPER, 
+                                                JBIConstants.JBI_WRAPPER_PART.getLocalPart());
+                    dataWriter.write(obj, part, xmlWriter);                    
+                    xmlWriter.writeEndElement();
+                }
+            }
+            xmlWriter.writeEndElement();
+        
+        } catch (XMLStreamException e) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE), e);
+        }
+    }
+
+}

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

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

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

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/Messages.properties Wed Apr 18 11:27:39 2007
@@ -0,0 +1,46 @@
+#
+#    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.
+#
+NOT.IMPLEMENTED=not yet implemented
+INVOKE.SERVICE=invoking service\t
+CREATE.MESSAGE.EXCHANGE=create message exchange svc:\t
+EXCHANGE.ENDPOINT=exchange endpoint:\t
+NO.MESSAGE=no message yet
+UNABLE.RETRIEVE.MESSAGE=unable to retrieve message
+CONTEXT.MUST.BE=context must be of type JBIOutputStreamMessageContext
+RECEIVED.MESSAGE=received message:\t
+ACTIVE.JBI.SERVER.TRANSPORT=activating JBI server transport
+BUILDING.DOCUMENT=building document from bytes
+CREATE.NORMALIZED.MESSAGE=creating NormalizedMessage
+POST.DISPATCH=postDispatch sending out message to NWR
+ERROR.SEND.MESSAGE=error sending Out message
+DISPATCH.MESSAGE.ON.CALLBACK=dispatching message on callback:\t
+ERROR.PREPARE.MESSAGE=error preparing message
+RECEIVE.THREAD.START=JBIServerTransport message receiving thread started
+DISPATCH.TO.SU=dispatching to CXF service unit
+NO.SU.FOUND=no CXFServiceUnit found
+ERROR.DISPATCH.THREAD=error running dispatch thread
+JBI.SERVER.TRANSPORT.MESSAGE.PROCESS.THREAD.EXIT=JBIServerTransport message processing thread exitting
+CONFIG.DELIVERY.CHANNEL=configuring DeliveryChannel:\t
+CONFIG.SU.MANAGER=configuring ServiceUnitManager:\t
+JBI.TRANSPORT.FACTORY.NOT.INITIALIZED=JBITransportFactory is not properly initialised
+SU.MANAGER=CXFServiceUnitManager:\t
+DELIVERY.CHANNEL=DeliveryChannel:\t
+JBI.TRANSPORT.FACTORY.NOT.FULLY.INITIALIZED=JBITransport factory not fully initalised
+CREATE.SERVER.TRANSPORT=creating JBI server transport
+CREATE.CLIENT.TRANSPORT=creating JBI client transport

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

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

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

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/bus-extensions.xml?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/bus-extensions.xml (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/bus-extensions.xml Wed Apr 18 11:27:39 2007
@@ -0,0 +1,27 @@
+<?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.cf
+-->
+<extensions xmlns="http://cxf.apache.org/bus/extension">
+
+    <extension class="org.apache.cxf.binding.jbi.JBIBindingFactory" deferred="true">
+        <namespace>http://cxf.apache.org/bindings/jbi</namespace>
+        <namespace>http://java.sun.com/xml/ns/jbi/binding/service+engine</namespace>
+    </extension>
+    
+</extensions>

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/bus-extensions.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/bus-extensions.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml (added)
+++ incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml Wed Apr 18 11:27:39 2007
@@ -0,0 +1,32 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans">
+    
+    <bean class="org.apache.cxf.binding.jbi.JBIBindingFactory" lazy-init="true">
+      <property name="bus" ref="cxf"/>
+      <property name="activationNamespaces">
+            <set>
+              <value>http://cxf.apache.org/bindings/jbi</value>
+              <value>http://java.sun.com/xml/ns/jbi/binding/service+engine</value>
+            </set>
+        </property>
+    </bean>
+
+</beans>

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/bindings/jbi/src/main/resources/META-INF/cxf/cxf-extension-jbi.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/bindings/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/pom.xml?view=diff&rev=530117&r1=530116&r2=530117
==============================================================================
--- incubator/cxf/trunk/rt/bindings/pom.xml (original)
+++ incubator/cxf/trunk/rt/bindings/pom.xml Wed Apr 18 11:27:39 2007
@@ -36,6 +36,7 @@
         <module>http</module>
         <module>object</module>
         <module>coloc</module>
+        <module>jbi</module>
     </modules>
 
 

Modified: incubator/cxf/trunk/rt/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/pom.xml?view=diff&rev=530117&r1=530116&r2=530117
==============================================================================
--- incubator/cxf/trunk/rt/pom.xml (original)
+++ incubator/cxf/trunk/rt/pom.xml Wed Apr 18 11:27:39 2007
@@ -43,6 +43,7 @@
         <module>transports/http</module>
         <module>transports/http-jetty</module>
         <module>transports/jms</module>
+        <module>transports/jbi</module>
         <module>ws/policy</module>
         <module>ws/addr</module>
         <module>ws/rm</module>

Propchange: incubator/cxf/trunk/rt/transports/jbi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Apr 18 11:27:39 2007
@@ -0,0 +1,3 @@
+.classpath
+.project
+.settings

Added: incubator/cxf/trunk/rt/transports/jbi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jbi/pom.xml?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/pom.xml (added)
+++ incubator/cxf/trunk/rt/transports/jbi/pom.xml Wed Apr 18 11:27:39 2007
@@ -0,0 +1,77 @@
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf</groupId>
+    <artifactId>cxf-rt-transports-jbi</artifactId>
+    <packaging>jar</packaging>
+    <version>2.0-incubator-RC-SNAPSHOT</version>
+    <name>Apache CXF Runtime JBI transport</name>
+    <url>http://cwiki.apache.org/CXF</url>
+
+    <parent>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-parent</artifactId>
+        <version>2.0-incubator-RC-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-jbi</artifactId>
+            <version>3.1-incubating</version>
+          </dependency>
+      
+    </dependencies>
+
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/jbi</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/jbi</developerConnection>
+    </scm>
+
+</project>

Propchange: incubator/cxf/trunk/rt/transports/jbi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/jbi/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/transports/jbi/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java (added)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,58 @@
+/**
+ * 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.transport.jbi;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jbi.messaging.DeliveryChannel;
+
+
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.AbstractConduit;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
+
+public class JBIConduit extends AbstractConduit {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIConduit.class);
+
+    private DeliveryChannel channel;
+           
+    public JBIConduit(EndpointReferenceType target, DeliveryChannel dc) {           
+        super(target);
+        channel = dc;
+    }
+
+    protected Logger getLogger() {
+        return LOG;
+    }
+    
+    public void prepare(Message message) throws IOException {
+        getLogger().log(Level.FINE, "JBIConduit send message");
+                
+        message.setContent(OutputStream.class,
+                           new JBIConduitOutputStream(message, channel, target, this));
+    }    
+}

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduit.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java (added)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,174 @@
+/**
+ * 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.transport.jbi;
+
+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;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.io.AbstractCachedOutputStream;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
+public class JBIConduitOutputStream extends AbstractCachedOutputStream {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIConduitOutputStream.class);
+
+    private Message message;
+    private boolean isOneWay;
+    private DeliveryChannel channel;
+    private JBIConduit conduit;
+    private EndpointReferenceType target;
+
+    public JBIConduitOutputStream(Message m, DeliveryChannel channel, EndpointReferenceType target,
+                                  JBIConduit conduit) {
+        message = m;
+        this.channel = channel;
+        this.conduit = conduit;
+        this.target = target;
+        
+    }
+
+    @Override
+    protected void doFlush() throws IOException {
+
+    }
+
+    @Override
+    protected void doClose() throws IOException {
+        isOneWay = message.getExchange().isOneWay();
+        commitOutputMessage();
+        if (target != null) {
+            target.getClass();
+        }
+    }
+
+    private void commitOutputMessage() throws IOException {
+        try {
+            Method targetMethod = (Method) message.get(Method.class.getName());
+            Class<?> clz = targetMethod.getDeclaringClass();
+            BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+
+            LOG.info(new org.apache.cxf.common.i18n.Message("INVOKE.SERVICE", LOG).toString() + clz);
+
+            WebService ws = clz.getAnnotation(WebService.class);
+            assert ws != null;
+            QName interfaceName = new QName(ws.targetNamespace(), ws.name());
+            QName serviceName = null;
+            if (target != null) {
+                serviceName = EndpointReferenceUtils.getServiceName(target);
+            } else {
+                serviceName = message.getExchange().get(org.apache.cxf.service.Service.class).getName();
+            }
+          
+            MessageExchangeFactory factory = channel.createExchangeFactoryForService(serviceName);
+            LOG.info(new org.apache.cxf.common.i18n.Message("CREATE.MESSAGE.EXCHANGE", LOG).toString()
+                     + serviceName);
+            MessageExchange xchng = null;
+            if (isOneWay) {
+                xchng = factory.createInOnlyExchange();
+            } else if (bop.getOutput() == null) {
+                xchng = factory.createRobustInOnlyExchange();
+            } else {
+                xchng = factory.createInOutExchange();
+            }
+
+            NormalizedMessage inMsg = xchng.createMessage();
+            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));
+                xchng.setService(serviceName);
+                LOG.info("service for exchange " + serviceName);
+
+                xchng.setInterfaceName(interfaceName);
+
+                xchng.setOperation(bop.getName());
+                xchng.setMessage(inMsg, "in");
+                LOG.info("sending message");
+                if (!isOneWay) {
+
+                    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);
+                    conduit.getMessageObserver().onMessage(inMessage);
+                    
+                } else {
+                    channel.send(xchng);
+                }
+
+            } else {
+                LOG.info(new org.apache.cxf.common.i18n.Message("NO.MESSAGE", LOG).toString());
+            }
+
+            
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new IOException(e.toString());
+        }
+    }
+
+    private Source getMessageContent(Message message2) {
+        ByteArrayOutputStream bos = (ByteArrayOutputStream)getOut();
+        return new StreamSource(new ByteArrayInputStream(bos.toByteArray()));
+        
+    }
+
+    @Override
+    protected void onWrite() throws IOException {
+
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIConduitOutputStream.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java (added)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,130 @@
+/**
+ * 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.transport.jbi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+
+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.transport.AbstractConduit;
+import org.apache.cxf.transport.AbstractDestination;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
+public class JBIDestination extends AbstractDestination {
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIDestination.class);
+    
+    private final DeliveryChannel channel;
+    
+    public JBIDestination(EndpointInfo info,
+                          DeliveryChannel dc) {
+        super(getTargetReference(info, null), info);
+        this.channel = dc;
+    }
+    
+    protected Logger getLogger() {
+        return LOG;
+    }
+    
+    /**
+     * @param inMessage the incoming message
+     * @return the inbuilt backchannel
+     */
+    protected Conduit getInbuiltBackChannel(Message inMessage) {
+        return new BackChannelConduit(EndpointReferenceUtils.getAnonymousEndpointReference(),
+                                      inMessage);
+    }
+    
+    // this should deal with the cxf message 
+    protected class BackChannelConduit extends AbstractConduit {
+        
+        protected Message inMessage;
+        protected JBIDestination jbiDestination;
+                
+        BackChannelConduit(EndpointReferenceType ref, Message message) {
+            super(ref);
+            inMessage = message;
+        }
+        
+        /**
+         * Register a message observer for incoming messages.
+         * 
+         * @param observer the observer to notify on receipt of incoming
+         */
+        public void setMessageObserver(MessageObserver observer) {
+            // shouldn't be called for a back channel conduit
+        }
+
+        /**
+         * Send an outbound message, assumed to contain all the name-value
+         * mappings of the corresponding input message (if any). 
+         * 
+         * @param message the message to be sent.
+         */
+        public void prepare(Message message) throws IOException {
+            // setup the message to be send back
+            message.put(MessageExchange.class, inMessage.get(MessageExchange.class));
+            message.setContent(OutputStream.class,
+                               new JBIDestinationOutputStream(inMessage, channel));
+        }        
+
+        protected Logger getLogger() {
+            return LOG;
+        }
+    }
+
+    public void dispatch(MessageExchange exchange) throws IOException {
+        QName opName = exchange.getOperation(); 
+        getLogger().fine("dispatch method: " + opName);
+        
+        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);
+                                           
+            //dispatch to correct destination in case of multiple endpoint
+            inMessage.setDestination(this);
+            getMessageObserver().onMessage(inMessage);
+            
+        } catch (Exception ex) {
+            getLogger().log(Level.SEVERE, new org.apache.cxf.common.i18n.Message(
+                "ERROR.PREPARE.MESSAGE", getLogger()).toString(), ex);
+            throw new IOException(ex.getMessage());
+        }
+
+    }
+}

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestination.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java (added)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,113 @@
+/**
+ * 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.transport.jbi;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.Fault;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.io.AbstractCachedOutputStream;
+import org.apache.cxf.message.Message;
+
+public class JBIDestinationOutputStream extends AbstractCachedOutputStream {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIDestinationOutputStream.class);
+    private Message inMessage;
+    private DeliveryChannel channel;
+    
+    public JBIDestinationOutputStream(Message m, 
+                               DeliveryChannel dc) {
+        super();
+        inMessage = m;
+        channel = dc;
+    }
+    
+    @Override
+    protected void doFlush() throws IOException {
+        // so far do nothing
+    }
+
+    @Override
+    protected void doClose() throws IOException {
+        commitOutputMessage();
+    }
+
+    @Override
+    protected void onWrite() throws IOException {
+        // so far do nothing
+    }
+
+    private void commitOutputMessage() throws IOException {
+        try { 
+            if (inMessage.getExchange().isOneWay()) {
+                return;
+            } else {
+                
+                ByteArrayOutputStream baos = (ByteArrayOutputStream)getOut();
+                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+                LOG.finest(new org.apache.cxf.common.i18n.Message(
+                    "BUILDING.DOCUMENT", LOG).toString());
+                DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+                docBuilderFactory.setNamespaceAware(true);
+                DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
+                Document doc = builder.parse(bais);
+            
+                MessageExchange xchng = inMessage.get(MessageExchange.class);
+                LOG.fine(new org.apache.cxf.common.i18n.Message(
+                    "CREATE.NORMALIZED.MESSAGE", LOG).toString());
+                if (inMessage.getExchange().getOutFaultMessage() != null) {
+                    org.apache.cxf.interceptor.Fault f = (org.apache.cxf.interceptor.Fault) 
+                            inMessage.getContent(Exception.class);
+                    if (f.hasDetails()) {
+                        Fault fault = xchng.createFault();
+                        fault.setContent(new DOMSource(doc));
+                        xchng.setFault(fault);
+                    } else {
+                        xchng.setError(f);
+                    }
+                } else {
+                    NormalizedMessage msg = xchng.createMessage();
+                    msg.setContent(new DOMSource(doc));
+                    xchng.setMessage(msg, "out");
+                }
+                LOG.fine(new org.apache.cxf.common.i18n.Message(
+                    "POST.DISPATCH", LOG).toString());
+                channel.send(xchng);
+            }
+        } catch (Exception ex) { 
+            LOG.log(Level.SEVERE, new org.apache.cxf.common.i18n.Message(
+                "ERROR.SEND.MESSAGE", LOG).toString(), ex);
+        }
+    }
+    
+}

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIDestinationOutputStream.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java?view=auto&rev=530117
==============================================================================
--- incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java (added)
+++ incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java Wed Apr 18 11:27:39 2007
@@ -0,0 +1,62 @@
+/**
+ * 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.transport.jbi;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.Logger;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+
+public final class JBIMessageHelper { 
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(JBIMessageHelper.class);
+    
+    private static final TransformerFactory TRANSFORMER_FACTORY 
+        = TransformerFactory.newInstance();
+
+    private JBIMessageHelper() { 
+        // complete 
+    }
+    
+    
+    public static InputStream convertMessageToInputStream(Source src) 
+        throws IOException, TransformerConfigurationException, TransformerException { 
+
+        final Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
+        
+        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        StreamResult result = new StreamResult(baos);
+        transformer.transform(src, result);
+        LOG.finest(new Message("RECEIVED.MESSAGE", LOG) + new String(baos.toByteArray()));
+        
+        return new ByteArrayInputStream(baos.toByteArray());
+    } 
+}

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/cxf/trunk/rt/transports/jbi/src/main/java/org/apache/cxf/transport/jbi/JBIMessageHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message