cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r789096 [1/2] - in /cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/ rt/bindin...
Date Sun, 28 Jun 2009 13:18:36 GMT
Author: ningjiang
Date: Sun Jun 28 13:18:35 2009
New Revision: 789096

URL: http://svn.apache.org/viewvc?rev=789096&view=rev
Log:
CXF-2253 applied patch with thanks to CongLiu

Added:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFault.java   (with props)
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java   (with props)
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java   (with props)
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/Messages.properties   (with props)
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactory.java   (with props)
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java   (with props)
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java   (with props)
    cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/
    cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/
    cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/JMSSpecConstants.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSJNDIEndpoint.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSQueueEndpoint.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSTopicEndpoint.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIConstants.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/URISupport.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/UnsafeUriCharactersEncoder.java   (with props)
    cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb   (with props)
    cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd   (with props)
    cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb   (with props)
    cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd   (with props)
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java   (with props)
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterSpecImpl.java   (with props)
    cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl   (with props)
Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    cxf/trunk/rt/transports/jms/pom.xml
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
    cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/bus-extensions.xml
    cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension-jms.xml
    cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Sun Jun 28 13:18:35 2009
@@ -54,6 +54,7 @@
 import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor;
+import org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.binding.soap.model.SoapBodyInfo;
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
@@ -349,6 +350,11 @@
                 throw new RuntimeException("WSI-BP prohibits RPC and Document style "
                                            + "operations in same service.");
             }
+            
+            //jms
+            if (sbi.getTransportURI().equals("http://www.w3.org/2008/07/soap/bindings/JMS/")) {
+                sb.getInInterceptors().add(new SoapJMSInInterceptor());
+            }
         } else {
             throw new RuntimeException("Can not initialize SoapBinding, BindingInfo is not SoapBindingInfo");
         }

Added: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFault.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFault.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFault.java (added)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFault.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,90 @@
+/**
+ * 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.soap.jms.interceptor;
+
+import javax.xml.namespace.QName;
+
+/**
+ * 
+ */
+public class JMSFault extends Exception {
+
+    private JMSFaultType jmsFaultType;
+    private boolean sender;
+    private Object detail;
+
+    public JMSFault(String message) {
+        super(message);
+    }
+
+    public JMSFault(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * * @return Returns the jmsFaultType.
+     */
+    public JMSFaultType getJmsFaultType() {
+        return jmsFaultType;
+    }
+
+    /**
+     * @param jmsFaultType The jmsFaultType to set.
+     */
+    public void setJmsFaultType(JMSFaultType jmsFaultType) {
+        this.jmsFaultType = jmsFaultType;
+    }
+
+    /**
+     * * @return Returns the sender.
+     */
+    public boolean isSender() {
+        return sender;
+    }
+
+    /**
+     * @param sender The sender to set.
+     */
+    public void setSender(boolean sender) {
+        this.sender = sender;
+    }
+
+    /**
+     * * @return Returns the detail.
+     */
+    public Object getDetail() {
+        return detail;
+    }
+
+    /**
+     * @param detail The detail to set.
+     */
+    public void setDetail(Object detail) {
+        this.detail = detail;
+    }
+
+    public QName getSubCode() {
+        return jmsFaultType.faultCode;
+    }
+
+    public String getReason() {
+        return getMessage();
+    }
+}

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFault.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFault.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java (added)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.soap.jms.interceptor;
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+/**
+ * 
+ */
+public final class JMSFaultFactory {
+
+    static final Logger LOG = LogUtils.getL7dLogger(JMSFaultFactory.class);
+
+    private JMSFaultFactory() {
+    }
+
+    public static JMSFault createUnrecognizedBindingVerionFault(String bindingVersion) {
+        JMSFaultType jmsFaultType = new JMSFaultType();
+        jmsFaultType.setFaultCode(SoapJMSConstants.getUnrecognizedBindingVersionQName());
+
+        String m = new org.apache.cxf.common.i18n.Message("UNRECOGNIZED_BINDINGVERSION", LOG,
+                                                          new Object[] {
+                                                              bindingVersion
+                                                          }).toString();
+        JMSFault jmsFault = new JMSFault(m);
+        jmsFault.setJmsFaultType(jmsFaultType);
+        jmsFault.setSender(true);
+        return jmsFault;
+    }
+}

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java (added)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,106 @@
+/**
+ * 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.soap.jms.interceptor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.namespace.QName;
+
+public class JMSFaultType {
+
+    @XmlElement(name = "FaultCode", required = true)
+    protected QName faultCode;
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the faultCode property.
+     * 
+     * @return possible object is {@link QName }
+     */
+    public QName getFaultCode() {
+        return faultCode;
+    }
+
+    /**
+     * Sets the value of the faultCode property.
+     * 
+     * @param value allowed object is {@link QName }
+     */
+    public void setFaultCode(QName value) {
+        this.faultCode = value;
+    }
+
+    public boolean isSetFaultCode() {
+        return this.faultCode != null;
+    }
+
+    /**
+     * Gets the value of the any property.
+     * <p>
+     * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification
+     * you make to the returned list will be present inside the JAXB object. This is why there is not a
+     * <CODE>set</CODE> method for the any property.
+     * <p>
+     * For example, to add a new item, do as follows:
+     * 
+     * <pre>
+     * getAny().add(newItem);
+     * </pre>
+     * <p>
+     * Objects of the following type(s) are allowed in the list {@link Object } {@link Element }
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    public boolean isSetAny() {
+        return (this.any != null) && (!this.any.isEmpty());
+    }
+
+    public void unsetAny() {
+        this.any = null;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * <p>
+     * the map is keyed by the name of the attribute and the value is the string value of the attribute. the
+     * map returned by this method is live, and you can add new attribute by updating the map directly.
+     * Because of this design, there's no setter.
+     * 
+     * @return always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/JMSFaultType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

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

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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

Added: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactory.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactory.java (added)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactory.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,102 @@
+/**
+ * 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.soap.jms.interceptor;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.binding.soap.SoapBinding;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.interceptor.Fault;
+
+/**
+ * 
+ */
+public class SoapFaultFactory  {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(SoapFaultFactory.class); 
+    
+    private SoapVersion version;
+    
+    public SoapFaultFactory(Binding binding) {
+        version = ((SoapBinding)binding).getSoapVersion();
+    }
+    
+    public Fault createFault(JMSFault jmsFault) {
+        Fault f = null;
+        if (version == Soap11.getInstance()) {
+            f = createSoap11Fault(jmsFault);
+            // so we can encode the SequenceFault as header   
+            f.initCause(jmsFault);
+        } else {
+            f = createSoap12Fault(jmsFault);
+        }
+        return f;
+    }
+    
+    Fault createSoap11Fault(JMSFault jmsFault) {
+        SoapFault fault = new SoapFault(jmsFault.getReason(),
+            jmsFault.isSender() ? version.getSender() : version.getReceiver());
+        fault.setSubCode(jmsFault.getSubCode());
+        return fault;
+    }
+    
+    Fault createSoap12Fault(JMSFault jmsFault) {
+        SoapFault fault = (SoapFault)createSoap11Fault(jmsFault);
+        Object detail = jmsFault.getDetail();
+        if (null == detail) {
+            return fault;
+        }
+
+        try {
+            setDetail(fault, detail);
+        } catch (Exception ex) {
+            LogUtils.log(LOG, Level.SEVERE, "MARSHAL_FAULT_DETAIL_EXC", ex); 
+            ex.printStackTrace();
+        }
+        return fault;
+    }
+    
+    void setDetail(SoapFault fault, Object detail) throws Exception {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        Document doc = factory.newDocumentBuilder().newDocument();
+        Element elem = null;
+        
+        elem =  (Element)doc.getFirstChild();
+        fault.setDetail(elem);
+    }
+    
+    public String toString(Fault f) {
+        SoapFault sf = (SoapFault)f;
+        return sf.toString();
+    }
+        
+
+}

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java (added)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,80 @@
+/**
+ * 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.soap.jms.interceptor;
+
+import javax.xml.namespace.QName;
+
+/**
+ * 
+ */
+public final class SoapJMSConstants {
+
+    public static final Object BINDINGVERSION = "SOAPJMS_bindingVersion";
+
+    public static final String SOAP_JMS_SPECIFICIATION_TRANSPORTID = "http://www.w3.org/2008/07/"
+                                                                     + "soap/bindings/JMS/";
+    public static final String SOAP_JMS_NAMESPACE = SOAP_JMS_SPECIFICIATION_TRANSPORTID;
+    
+    // fault codes
+    private static final String JMS_CONTENTTYPEMISMATCH_FAULT_CODE = "contentTypeMismatch";
+    private static final String JMS_MALFORMEDREQUESTURI_FAULT_CODE = "malformedRequestURI";
+    private static final String JMS_MISMATCHEDSOAPACTION_FAULT_CODE = "mismatchedSoapAction";
+    private static final String JMS_MISSINGCONTENTTYPE_FAULT_CODE = "missingContentType";
+    private static final String JMS_MISSINGREQUESTURI_FAULT_CODE = "missingRequestURI";
+    private static final String JMS_TARGETSERVICENOTALLOWEDINREQUESTURI_FAULT_CODE = 
+        "targetServiceNotAllowedInRequestURI";
+    private static final String JMS_UNRECOGNIZEDBINDINGVERSION_FAULT_CODE = "unrecognizedBindingVersion";
+    private static final String JMS_UNSUPPORTEDJMSMESSAGEFORMAT_FAULT_CODE = "unsupportedJMSMessageFormat";
+
+    private SoapJMSConstants() {
+    }
+    
+    public static QName getContentTypeMismatchQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_CONTENTTYPEMISMATCH_FAULT_CODE);
+    }
+
+    public static QName getMalformedRequestURIQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_MALFORMEDREQUESTURI_FAULT_CODE);
+    }
+
+    public static QName getMismatchedSoapActionQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_MISMATCHEDSOAPACTION_FAULT_CODE);
+    }
+
+    public static QName getMissingContentTypeQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_MISSINGCONTENTTYPE_FAULT_CODE);
+    }
+
+    public static QName getMissingRequestURIQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_MISSINGREQUESTURI_FAULT_CODE);
+    }
+
+    public static QName getTargetServiceNotAllowedInRequestURIQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_TARGETSERVICENOTALLOWEDINREQUESTURI_FAULT_CODE);
+    }
+
+    public static QName getUnrecognizedBindingVersionQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_UNRECOGNIZEDBINDINGVERSION_FAULT_CODE);
+    }
+
+    public static QName getUnsupportedJMSMessageFormatQName() {
+        return new QName(SOAP_JMS_NAMESPACE, JMS_UNSUPPORTEDJMSMESSAGEFORMAT_FAULT_CODE);
+    }
+}

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java (added)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java Sun Jun 28 13:18:35 2009
@@ -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.
+ */
+
+package org.apache.cxf.binding.soap.jms.interceptor;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.AttachmentInInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+
+/**
+ * 
+ */
+public class SoapJMSInInterceptor extends AbstractSoapInterceptor {
+
+    public SoapJMSInInterceptor() {
+        super(Phase.RECEIVE);
+        addAfter(AttachmentInInterceptor.class.getName());
+    }
+
+    public void handleMessage(SoapMessage message) throws Fault {
+        Map<String, List<String>> headers = CastUtils.cast((Map)message
+            .get(Message.PROTOCOL_HEADERS));
+        if (headers != null) {
+            checkBindingVersion(message, headers);
+        }
+    }
+
+    /**
+     * @param message 
+     * @param headers
+     */
+    private void checkBindingVersion(SoapMessage message, Map<String, List<String>> headers) {
+        List<String> bv = headers.get(SoapJMSConstants.BINDINGVERSION);
+        if (bv != null && bv.size() > 0) {
+            String bindingVersion = bv.get(0);
+            if (!"1.0".equals(bindingVersion)) {
+                JMSFault jmsFault = JMSFaultFactory
+                    .createUnrecognizedBindingVerionFault(bindingVersion);
+                Endpoint e = message.getExchange().get(Endpoint.class);
+                Binding b = null;
+                if (null != e) {
+                    b = e.getBinding();
+                }
+                if (null != b) {
+                    SoapFaultFactory sff = new SoapFaultFactory(b);
+                    Fault f = sff.createFault(jmsFault);
+                    throw f;
+                }
+            }
+        }
+    }
+}

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/jms/interceptor/SoapJMSInInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java (added)
+++ cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,92 @@
+/**
+ * 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.soap.jms.interceptor;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.binding.soap.Soap12;
+import org.apache.cxf.binding.soap.SoapBinding;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class SoapFaultFactoryTest extends Assert {
+
+    private IMocksControl control;
+    private JMSFault jmsFault;
+    
+    @Before
+    public void setUp() {
+        control = EasyMock.createNiceControl(); 
+    }
+    
+    JMSFault setupJMSFault(boolean isSender, QName code, Object detail) {
+        jmsFault = control.createMock(JMSFault.class);
+        EasyMock.expect(jmsFault.getReason()).andReturn("reason");
+        EasyMock.expect(jmsFault.isSender()).andReturn(isSender);
+        EasyMock.expect(jmsFault.getSubCode()).andReturn(code);
+        if (null != detail) {
+            EasyMock.expect(jmsFault.getDetail()).andReturn(detail);
+            JMSFaultType sft = new JMSFaultType();
+            sft.setFaultCode(SoapJMSConstants.getContentTypeMismatchQName());
+        }
+        return jmsFault;
+    }
+    
+    @Test 
+    public void createSoap11Fault() {
+        SoapBinding sb = control.createMock(SoapBinding.class);
+        EasyMock.expect(sb.getSoapVersion()).andReturn(Soap11.getInstance());        
+        setupJMSFault(true, SoapJMSConstants.getContentTypeMismatchQName(), null);
+        control.replay();
+        SoapFaultFactory factory = new SoapFaultFactory(sb);
+        SoapFault fault = (SoapFault)factory.createFault(jmsFault);
+        assertEquals("reason", fault.getReason());
+        assertEquals(Soap11.getInstance().getSender(), fault.getFaultCode());
+        assertEquals(SoapJMSConstants.getContentTypeMismatchQName(), fault.getSubCode());
+        assertNull(fault.getDetail());
+        assertSame(jmsFault, fault.getCause());
+        control.verify();        
+    }
+    
+    @Test 
+    public void createSoap12Fault() {
+        SoapBinding sb = control.createMock(SoapBinding.class);
+        EasyMock.expect(sb.getSoapVersion()).andReturn(Soap12.getInstance());        
+        setupJMSFault(true, SoapJMSConstants.getMismatchedSoapActionQName(), null);        
+        control.replay();
+        SoapFaultFactory factory = new SoapFaultFactory(sb);
+        SoapFault fault = (SoapFault)factory.createFault(jmsFault);
+        assertEquals("reason", fault.getReason());
+        assertEquals(Soap12.getInstance().getSender(), fault.getFaultCode());
+        assertEquals(SoapJMSConstants.getMismatchedSoapActionQName(), fault.getSubCode());
+        assertNull(fault.getDetail());
+        assertNull(fault.getCause());
+        control.verify();        
+    }
+}

Propchange: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/jms/interceptor/SoapFaultFactoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/transports/jms/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/pom.xml?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/pom.xml (original)
+++ cxf/trunk/rt/transports/jms/pom.xml Sun Jun 28 13:18:35 2009
@@ -22,7 +22,7 @@
     <artifactId>cxf-rt-transports-jms</artifactId>
     <packaging>jar</packaging>
     <version>2.3.0-SNAPSHOT</version>
-    <name>Apache CXF Runtime JMS Transport</name>
+    <name>Apache CXF Runtime JMS Transport for SOAP/JMS Specification</name>
     <url>http://cxf.apache.org</url>
 
     <parent>
@@ -114,6 +114,22 @@
                                         <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
                                     </deleteDirs>
                                 </xsdOption>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/schemas/wsdl/jms-uri.xsd</xsd>
+                                    <bindingFile>${basedir}/src/main/resources/schemas/wsdl/jms-uri.xjb</bindingFile>
+                                    <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
+                                    <deleteDirs>
+                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
+                                    </deleteDirs>
+                                </xsdOption>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/schemas/wsdl/jms-spec.xsd</xsd>
+                                    <bindingFile>${basedir}/src/main/resources/schemas/wsdl/jms-spec.xjb</bindingFile>
+                                    <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
+                                    <deleteDirs>
+                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
+                                    </deleteDirs>
+                                </xsdOption>
                             </xsdOptions>
                         </configuration>
                         <goals>

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java Sun Jun 28 13:18:35 2009
@@ -162,8 +162,8 @@
             public javax.jms.Message createMessage(Session session) throws JMSException {
                 String messageType = jmsConfig.getMessageType();
                 final javax.jms.Message jmsMessage;
-                jmsMessage = JMSUtils.buildJMSMessageFromCXFMessage(outMessage, request, messageType,
-                                                                    session, replyTo,
+                jmsMessage = JMSUtils.buildJMSMessageFromCXFMessage(jmsConfig, outMessage, request,
+                                                                    messageType, session, replyTo,
                                                                     correlationId);
                 LOG.log(Level.FINE, "client sending request: ", jmsMessage);
                 return jmsMessage;

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java Sun Jun 28 13:18:35 2009
@@ -81,12 +81,17 @@
     private int cacheLevel = DEFAULT_VALUE;
     private String cacheLevelName;
     
+    //For jms spec.
+    private String targetService;
+    private String requestURI;
+    
     private ConnectionFactory wrappedConnectionFactory;
     
     private JNDIConfiguration jndiConfig;
     
     public void ensureProperlyConfigured(org.apache.cxf.common.i18n.Message msg) {
-        if (targetDestination == null || getOrCreateWrappedConnectionFactory() == null) {
+        if (targetDestination == null ||  getOrCreateWrappedConnectionFactory() == null) {
+            System.out.println("targetDestination " + targetDestination);
             throw new ConfigurationException(msg);
         }
     }
@@ -437,4 +442,20 @@
         this.durableSubscriptionClientId = durableSubscriptionClientId;
     }
 
+    public void setTargetService(String targetService) {
+        this.targetService = targetService;
+    }
+
+    public String getTargetService() {
+        return targetService;
+    }
+
+    public void setRequestURI(String requestURI) {
+        this.requestURI = requestURI;
+    }
+
+    public String getRequestURI() {
+        return requestURI;
+    }
+
 }

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java Sun Jun 28 13:18:35 2009
@@ -27,8 +27,6 @@
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.Map;
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -47,7 +45,6 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.continuations.SuspendedInvocationException;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -218,11 +215,12 @@
             return;
         }
         try {
-            final JMSMessageHeadersType headers = (JMSMessageHeadersType)outMessage
+            final JMSMessageHeadersType messageProperties = (JMSMessageHeadersType)outMessage
                 .get(JMSConstants.JMS_SERVER_RESPONSE_HEADERS);
-            JMSMessageHeadersType inHeaders = (JMSMessageHeadersType)inMessage
+            JMSMessageHeadersType inMessageProperties = (JMSMessageHeadersType)inMessage
                 .get(JMSConstants.JMS_SERVER_REQUEST_HEADERS);
-            JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, inHeaders);
+            JMSUtils.initResponseMessageProperties(messageProperties, inMessageProperties);
+            JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, messageProperties);
 
             // setup the reply message
             final javax.jms.Message request = (javax.jms.Message)inMessage
@@ -256,12 +254,8 @@
 
                     reply.setJMSCorrelationID(determineCorrelationID(request));
 
-                    JMSUtils.setMessageProperties(headers, reply);
-                    // ensure that the contentType is set to the out jms message header
-                    JMSUtils.addContentTypeToProtocolHeader(outMessage);
-                    Map<String, List<String>> protHeaders = CastUtils.cast((Map<?, ?>)outMessage
-                        .get(Message.PROTOCOL_HEADERS));
-                    JMSUtils.addProtocolHeaders(reply, protHeaders);
+                    JMSUtils.prepareJMSProperties(messageProperties, outMessage, jmsConfig);
+                    JMSUtils.setJMSProperties(reply, messageProperties);
 
                     LOG.log(Level.FINE, "server sending reply: ", reply);
                     return reply;

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java Sun Jun 28 13:18:35 2009
@@ -85,22 +85,25 @@
      * settings in headers override the settings from jmsConfig
      * 
      * @param jmsConfig configuration information
-     * @param headers context headers
+     * @param messageProperties context headers
      * @return
      */
-    public static JmsTemplate createJmsTemplate(JMSConfiguration jmsConfig, JMSMessageHeadersType headers) {
+    public static JmsTemplate createJmsTemplate(JMSConfiguration jmsConfig,
+                                                JMSMessageHeadersType messageProperties) {
         JmsTemplate jmsTemplate = jmsConfig.isUseJms11() ? new JmsTemplate() : new JmsTemplate102();
         jmsTemplate.setConnectionFactory(jmsConfig.getOrCreateWrappedConnectionFactory());
         jmsTemplate.setPubSubDomain(jmsConfig.isPubSubDomain());
         if (jmsConfig.getReceiveTimeout() != null) {
             jmsTemplate.setReceiveTimeout(jmsConfig.getReceiveTimeout());
         }
-        jmsTemplate.setTimeToLive(jmsConfig.getTimeToLive());
-        int priority = (headers != null && headers.isSetJMSPriority())
-            ? headers.getJMSPriority() : jmsConfig.getPriority();
+        long timeToLive = (messageProperties != null && messageProperties.isSetTimeToLive())
+            ? messageProperties.getTimeToLive() : jmsConfig.getTimeToLive();
+        jmsTemplate.setTimeToLive(timeToLive);
+        int priority = (messageProperties != null && messageProperties.isSetJMSPriority())
+            ? messageProperties.getJMSPriority() : jmsConfig.getPriority();
         jmsTemplate.setPriority(priority);
-        int deliveryMode = (headers != null && headers.isSetJMSDeliveryMode()) ? headers
-            .getJMSDeliveryMode() : jmsConfig.getDeliveryMode();
+        int deliveryMode = (messageProperties != null && messageProperties.isSetJMSDeliveryMode())
+            ? messageProperties.getJMSDeliveryMode() : jmsConfig.getDeliveryMode();
         jmsTemplate.setDeliveryMode(deliveryMode);
         jmsTemplate.setExplicitQosEnabled(jmsConfig.isExplicitQosEnabled());
         jmsTemplate.setSessionTransacted(jmsConfig.isSessionTransacted());

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSOldConfigHolder.java Sun Jun 28 13:18:35 2009
@@ -18,15 +18,25 @@
  */
 package org.apache.cxf.transport.jms;
 
+import java.io.IOException;
 import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
 import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.jms.DeliveryMode;
+import javax.naming.Context;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
+import org.apache.cxf.transport.jms.uri.JMSEndpoint;
+import org.apache.cxf.transport.jms.uri.JMSEndpointParser;
+import org.apache.cxf.transport.jms.uri.JMSURIConstants;
 import org.springframework.jms.support.destination.JndiDestinationResolver;
 import org.springframework.jndi.JndiTemplate;
 
@@ -43,6 +53,20 @@
 
     public JMSConfiguration createJMSConfigurationFromEndpointInfo(Bus bus,
                                                                    EndpointInfo endpointInfo,
+                                                                   boolean isConduit) 
+        throws IOException {
+        String transportId = endpointInfo.getTransportId();
+        if (transportId.equals(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID)) {
+            return createJMSConfigurationFromEndpointInfoForSpecification(bus, endpointInfo,
+                                                                          isConduit);
+        } else {
+            return createJMSConfigurationFromEndpointInfoForOldJMS(bus, endpointInfo, isConduit);
+        }
+
+    }
+    
+    public JMSConfiguration createJMSConfigurationFromEndpointInfoForOldJMS(Bus bus,
+                                                                   EndpointInfo endpointInfo,
                                                                    boolean isConduit) {
 
         // Retrieve configuration information that was extracted from the WSDL
@@ -211,4 +235,157 @@
         }
         return env;
     }
+
+    /**
+     * @param bus
+     * @param endpointInfo
+     * @param isConduit
+     * @return
+     */
+    private JMSConfiguration createJMSConfigurationFromEndpointInfoForSpecification(
+                                                                                    Bus bus,
+                                                                                    EndpointInfo endpointInfo,
+                                                                                    boolean isConduit) 
+        throws IOException {
+        JMSEndpoint endpoint = null;
+        try {
+            endpoint = JMSEndpointParser.createEndpoint(endpointInfo.getAddress());
+        } catch (Exception e) {
+            throw new IOException(e.getMessage());
+        }
+        // TODO Need to check if we need to retrieve configuration information that 
+        // was extracted from the WSDL
+        //address = endpointInfo.getTraversedExtensor(new AddressType(), AddressType.class); 
+        clientConfig = endpointInfo.getTraversedExtensor(new ClientConfig(), ClientConfig.class);
+        runtimePolicy = endpointInfo.getTraversedExtensor(new ClientBehaviorPolicyType(),
+                                                          ClientBehaviorPolicyType.class);
+        serverConfig = endpointInfo.getTraversedExtensor(new ServerConfig(), ServerConfig.class);
+        sessionPool = endpointInfo.getTraversedExtensor(new SessionPoolType(),
+                                                        SessionPoolType.class);
+        serverBehavior = endpointInfo.getTraversedExtensor(new ServerBehaviorPolicyType(),
+                                                           ServerBehaviorPolicyType.class);
+        String name = endpointInfo.getName().toString()
+                      + (isConduit ? ".jms-conduit" : ".jms-destination");
+
+        // Try to retrieve configuration information from the spring
+        // config. Search for a conduit or destination with name=endpoint name + ".jms-conduit"
+        // or ".jms-destination"
+
+        Configurer configurer = bus.getExtension(Configurer.class);
+        if (null != configurer) {
+            configurer.configureBean(name, this);
+        }
+
+        if (jmsConfig == null) {
+            jmsConfig = new JMSConfiguration();
+        }
+
+        if (endpoint.isSetDeliveryMode()) {
+            int deliveryMode = endpoint.getDeliveryMode()
+                .equals(JMSURIConstants.DELIVERYMODE_PERSISTENT)
+                ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
+            jmsConfig.setDeliveryMode(deliveryMode);
+        }
+        
+        if (endpoint.isSetPriority()) {
+            int priority = endpoint.getPriority();
+            jmsConfig.setPriority(priority);
+        }
+
+        if (jmsConfig.isUsingEndpointInfo()) {
+            JndiTemplate jt = new JndiTemplate();
+            jt.setEnvironment(JMSOldConfigHolder.getInitialContextEnv(endpoint));
+            boolean pubSubDomain = false;
+            pubSubDomain = endpoint.getJmsVariant().equals(JMSURIConstants.TOPIC);
+            JNDIConfiguration jndiConfig = new JNDIConfiguration();
+            jndiConfig.setJndiConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
+            jmsConfig.setJndiTemplate(jt);
+            // TODO need to check the userName and Password setting the specification
+            /*
+             * jndiConfig.setConnectionUserName(address.getConnectionUserName());
+             * jndiConfig.setConnectionPassword(address.getConnectionPassword());
+             */
+            jmsConfig.setJndiConfig(jndiConfig);
+            /*
+             * if (address.isSetReconnectOnException()) {
+             * jmsConfig.setReconnectOnException(address.isReconnectOnException()); }
+             */
+            jmsConfig.setDurableSubscriptionName(serverBehavior.getDurableSubscriberName());
+            jmsConfig.setExplicitQosEnabled(true);
+            if (jmsConfig.getMessageSelector() == null) {
+                jmsConfig.setMessageSelector(serverBehavior.getMessageSelector());
+            }
+            if (isConduit && runtimePolicy.isSetMessageType()) {
+                jmsConfig.setMessageType(runtimePolicy.getMessageType().value());
+            }
+            jmsConfig.setPubSubDomain(pubSubDomain);
+            jmsConfig.setPubSubNoLocal(true);
+            if (clientConfig.isSetClientReceiveTimeout()) {
+                jmsConfig.setReceiveTimeout(clientConfig.getClientReceiveTimeout());
+            }
+            if (clientConfig.isSetUseConduitIdSelector()) {
+                jmsConfig.setUseConduitIdSelector(clientConfig.isUseConduitIdSelector());
+            }
+            if (clientConfig.isSetConduitSelectorPrefix()) {
+                jmsConfig.setConduitSelectorPrefix(clientConfig.getConduitSelectorPrefix());
+            }
+            jmsConfig.setSubscriptionDurable(serverBehavior.isSetDurableSubscriberName());
+            jmsConfig.setDurableSubscriptionName(serverBehavior.getDurableSubscriberName());
+            jmsConfig.setDurableSubscriptionClientId(serverConfig.getDurableSubscriptionClientId());
+            if (sessionPool.isSetHighWaterMark()) {
+                jmsConfig.setMaxConcurrentTasks(sessionPool.getHighWaterMark());
+            }
+            if (endpoint.isSetTimeToLive()) {
+                long timeToLive = endpoint.getTimeToLive();
+                jmsConfig.setTimeToLive(timeToLive);
+            }
+            /*
+             * if (address.isSetUseJms11()) { jmsConfig.setUseJms11(address.isUseJms11()); }
+             */
+            if (serverBehavior.isSetTransactional()) {
+                jmsConfig.setSessionTransacted(serverBehavior.isTransactional());
+            }
+            boolean useJndi = endpoint.getJmsVariant().equals(JMSURIConstants.JNDI);
+            if (useJndi) {
+                // Setup Destination jndi destination resolver
+                final JndiDestinationResolver jndiDestinationResolver = new JndiDestinationResolver();
+                jndiDestinationResolver.setJndiTemplate(jt);
+                jmsConfig.setDestinationResolver(jndiDestinationResolver);
+                jmsConfig.setTargetDestination(endpoint.getDestinationName());
+                jmsConfig.setReplyDestination(endpoint.getReplyToName());
+            } else {
+                // Use the default dynamic destination resolver
+                jmsConfig.setTargetDestination(endpoint.getDestinationName());
+                jmsConfig.setReplyDestination(endpoint.getReplyToName());
+            }
+        }
+        
+        String requestURI = endpoint.getRequestURI();
+        jmsConfig.setRequestURI(requestURI);
+
+        String targetService = endpoint.getParameter(JMSSpecConstants.TARGETSERVICE_PARAMETER_NAME);
+        jmsConfig.setTargetService(targetService);
+        return jmsConfig;
+    }
+
+    private static Properties getInitialContextEnv(JMSEndpoint endpoint) {
+        Properties env = new Properties();
+        env.put(Context.INITIAL_CONTEXT_FACTORY, endpoint.getJndiInitialContextFactory());
+        env.put(Context.PROVIDER_URL, endpoint.getJndiURL());
+        Map addParas = endpoint.getJndiParameters();
+        Iterator keyIter = addParas.keySet().iterator();
+        while (keyIter.hasNext()) {
+            String key = (String)keyIter.next();
+            env.put(key, addParas.get(key));
+        }
+        if (LOG.isLoggable(Level.FINE)) {
+            Enumeration props = env.propertyNames();
+            while (props.hasMoreElements()) {
+                String name = (String)props.nextElement();
+                String value = env.getProperty(name);
+                LOG.log(Level.FINE, "Context property: " + name + " | " + value);
+            }
+        }
+        return env;
+    }
 }

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java Sun Jun 28 13:18:35 2009
@@ -40,6 +40,7 @@
     private static final Set<String> URI_PREFIXES = new HashSet<String>();
     static {
         URI_PREFIXES.add("jms://");
+        URI_PREFIXES.add("jms:");
     }
 
     private Bus bus;

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java Sun Jun 28 13:18:35 2009
@@ -38,9 +38,11 @@
 import javax.jms.Session;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.SOAPConstants;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.security.SecurityContext;
+import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
 import org.springframework.jms.support.JmsUtils;
 import org.springframework.jms.support.converter.MessageConversionException;
 import org.springframework.jms.support.converter.SimpleMessageConverter102;
@@ -132,26 +134,26 @@
     }
 
     public static void populateIncomingContext(javax.jms.Message message,
-                                               org.apache.cxf.message.Message inMessage, String headerType)
+                                               org.apache.cxf.message.Message inMessage, String messageType)
         throws UnsupportedEncodingException {
         try {
-            JMSMessageHeadersType headers = null;
-            headers = (JMSMessageHeadersType)inMessage.get(headerType);
-            if (headers == null) {
-                headers = new JMSMessageHeadersType();
-                inMessage.put(headerType, headers);
-            }
-            headers.setJMSCorrelationID(message.getJMSCorrelationID());
-            headers.setJMSDeliveryMode(new Integer(message.getJMSDeliveryMode()));
-            headers.setJMSExpiration(new Long(message.getJMSExpiration()));
-            headers.setJMSMessageID(message.getJMSMessageID());
-            headers.setJMSPriority(new Integer(message.getJMSPriority()));
-            headers.setJMSRedelivered(Boolean.valueOf(message.getJMSRedelivered()));
-            headers.setJMSTimeStamp(new Long(message.getJMSTimestamp()));
-            headers.setJMSType(message.getJMSType());
+            JMSMessageHeadersType messageProperties = null;
+            messageProperties = (JMSMessageHeadersType)inMessage.get(messageType);
+            if (messageProperties == null) {
+                messageProperties = new JMSMessageHeadersType();
+                inMessage.put(messageType, messageProperties);
+            }
+            messageProperties.setJMSCorrelationID(message.getJMSCorrelationID());
+            messageProperties.setJMSDeliveryMode(new Integer(message.getJMSDeliveryMode()));
+            messageProperties.setJMSExpiration(new Long(message.getJMSExpiration()));
+            messageProperties.setJMSMessageID(message.getJMSMessageID());
+            messageProperties.setJMSPriority(new Integer(message.getJMSPriority()));
+            messageProperties.setJMSRedelivered(Boolean.valueOf(message.getJMSRedelivered()));
+            messageProperties.setJMSTimeStamp(new Long(message.getJMSTimestamp()));
+            messageProperties.setJMSType(message.getJMSType());
 
             Map<String, List<String>> protHeaders = new HashMap<String, List<String>>();
-            List<JMSPropertyType> props = headers.getProperty();
+            List<JMSPropertyType> props = messageProperties.getProperty();
             Enumeration enm = message.getPropertyNames();
             while (enm.hasMoreElements()) {
                 String name = (String)enm.nextElement();
@@ -174,6 +176,54 @@
 
             SecurityContext securityContext = buildSecurityContext(message);
             inMessage.put(SecurityContext.class, securityContext);
+
+            populateIncomingMessageProperties(message, inMessage, messageProperties);
+        } catch (JMSException ex) {
+            throw JmsUtils.convertJmsAccessException(ex);
+        }
+    }
+
+    /**
+     * @param jmsMessage
+     * @param inMessage
+     * @param messagePropertiesType
+     */
+    private static void populateIncomingMessageProperties(Message jmsMessage,
+                                                          org.apache.cxf.message.Message inMessage,
+                                                          JMSMessageHeadersType messageProperties)
+        throws UnsupportedEncodingException {
+        try {
+            if (jmsMessage.propertyExists(JMSSpecConstants.TARGETSERVICE_FIELD)) {
+                messageProperties.setSOAPJMSTargetService(jmsMessage
+                    .getStringProperty(JMSSpecConstants.TARGETSERVICE_FIELD));
+            }
+            if (jmsMessage.propertyExists(JMSSpecConstants.BINDINGVERSION_FIELD)) {
+                messageProperties.setSOAPJMSBindingVersion(jmsMessage
+                    .getStringProperty(JMSSpecConstants.BINDINGVERSION_FIELD));
+            }
+            if (jmsMessage.propertyExists(JMSSpecConstants.CONTENTTYPE_FIELD)) {
+                messageProperties.setSOAPJMSContentType(jmsMessage
+                    .getStringProperty(JMSSpecConstants.CONTENTTYPE_FIELD));
+            }
+            if (jmsMessage.propertyExists(JMSSpecConstants.SOAPACTION_FIELD)) {
+                messageProperties.setSOAPJMSSOAPAction(jmsMessage
+                    .getStringProperty(JMSSpecConstants.SOAPACTION_FIELD));
+            }
+            if (jmsMessage.propertyExists(JMSSpecConstants.ISFAULT_FIELD)) {
+                messageProperties.setSOAPJMSIsFault(jmsMessage
+                    .getBooleanProperty(JMSSpecConstants.ISFAULT_FIELD));
+            }
+            if (jmsMessage.propertyExists(JMSSpecConstants.REQUESTURI_FIELD)) {
+                messageProperties.setSOAPJMSRequestURI(jmsMessage
+                    .getStringProperty(JMSSpecConstants.REQUESTURI_FIELD));
+            }
+
+            if (messageProperties.isSetSOAPJMSContentType()) {
+                String contentType = messageProperties.getSOAPJMSContentType();
+                inMessage.put(org.apache.cxf.message.Message.CONTENT_TYPE, contentType);
+                // set the message encoding
+                inMessage.put(org.apache.cxf.message.Message.ENCODING, getEncoding(contentType));
+            }
         } catch (JMSException ex) {
             throw JmsUtils.convertJmsAccessException(ex);
         }
@@ -299,34 +349,217 @@
         }
         ct.add(contentType);
     }
+    
+    public static String getContentType(org.apache.cxf.message.Message message) {
+        String contentType = (String)message.get(org.apache.cxf.message.Message.CONTENT_TYPE);
+        String enc = (String)message.get(org.apache.cxf.message.Message.ENCODING);
+        // add the encoding information
+        if (null != contentType) {
+            if (enc != null && contentType.indexOf("charset=") == -1) {
+                contentType = contentType + "; charset=" + enc;
+            }
+        } else if (enc != null) {
+            contentType = "text/xml; charset=" + enc;
+        } else {
+            contentType = "text/xml";
+        }
 
-    public static Message buildJMSMessageFromCXFMessage(org.apache.cxf.message.Message outMessage,
-                                                        Object payload, String messageType, Session session,
-                                                        Destination replyTo, String correlationId)
-        throws JMSException {
+        // Retrieve or create protocol headers
+        Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message
+            .get(org.apache.cxf.message.Message.PROTOCOL_HEADERS));
+        if (null == headers) {
+            headers = new HashMap<String, List<String>>();
+            message.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, headers);
+        }
+        return contentType;
+    }
+
+    public static Message buildJMSMessageFromCXFMessage(JMSConfiguration jmsConfig,
+                                                        org.apache.cxf.message.Message outMessage,
+                                                        Object payload, String messageType,
+                                                        Session session, Destination replyTo,
+                                                        String correlationId) throws JMSException {
         Message jmsMessage = JMSUtils.createAndSetPayload(payload, session, messageType);
 
         if (replyTo != null) {
             jmsMessage.setJMSReplyTo(replyTo);
         }
 
-        JMSMessageHeadersType headers = (JMSMessageHeadersType)outMessage
+        JMSMessageHeadersType messageProperties = (JMSMessageHeadersType)outMessage
             .get(JMSConstants.JMS_CLIENT_REQUEST_HEADERS);
-
-        if (headers == null) {
-            headers = new JMSMessageHeadersType();
+        if (messageProperties == null) {
+            messageProperties = new JMSMessageHeadersType();
         }
+        JMSUtils.prepareJMSProperties(messageProperties, outMessage, jmsConfig);
+        JMSUtils.setJMSProperties(jmsMessage, messageProperties);
 
-        JMSUtils.setMessageProperties(headers, jmsMessage);
-        // ensure that the contentType is set to the out jms message header
-        JMSUtils.addContentTypeToProtocolHeader(outMessage);
-        Map<String, List<String>> protHeaders = CastUtils.cast((Map<?, ?>)outMessage
-            .get(org.apache.cxf.message.Message.PROTOCOL_HEADERS));
-        JMSUtils.addProtocolHeaders(jmsMessage, protHeaders);
         jmsMessage.setJMSCorrelationID(correlationId);
         return jmsMessage;
     }
 
+    /**
+     * @param messageProperties
+     * @param jmsMessage
+     */
+    static void setJMSProperties(Message jmsMessage, JMSMessageHeadersType messageProperties)
+        throws JMSException {
+
+        setJMSMessageHeaderProperties(jmsMessage, messageProperties);
+        setJMSMessageProperties(jmsMessage, messageProperties);
+    }
+
+    /**
+     * @param jmsMessage
+     * @param messageProperties
+     */
+    private static void setJMSMessageHeaderProperties(Message jmsMessage,
+                                                      JMSMessageHeadersType messageProperties)
+        throws JMSException {
+        if (messageProperties.isSetJMSDeliveryMode()) {
+            jmsMessage.setJMSDeliveryMode(messageProperties.getJMSDeliveryMode());
+        }
+        // if (messageProperties.isSetTimeToLive()) {
+        // jmsMessage.setJMSExpiration(expiration);
+        // }
+        if (messageProperties.isSetJMSPriority()) {
+            jmsMessage.setJMSPriority(messageProperties.getJMSPriority());
+        }
+    }
+
+    /**
+     * @param jmsMessage
+     * @param messageProperties
+     */
+    private static void setJMSMessageProperties(Message jmsMessage, JMSMessageHeadersType messageProperties)
+        throws JMSException {
+
+        if (messageProperties.isSetSOAPJMSTargetService()) {
+            jmsMessage.setStringProperty(JMSSpecConstants.TARGETSERVICE_FIELD, messageProperties
+                .getSOAPJMSTargetService());
+        }
+
+        jmsMessage.setStringProperty(JMSSpecConstants.BINDINGVERSION_FIELD, messageProperties
+            .getSOAPJMSBindingVersion());
+
+        if (messageProperties.isSetSOAPJMSContentType()) {
+            jmsMessage.setStringProperty(JMSSpecConstants.CONTENTTYPE_FIELD, messageProperties
+                .getSOAPJMSContentType());
+        }
+
+        if (messageProperties.isSetSOAPJMSSOAPAction()) {
+            jmsMessage.setStringProperty(JMSSpecConstants.SOAPACTION_FIELD, messageProperties
+                .getSOAPJMSSOAPAction());
+        }
+
+        if (messageProperties.isSetSOAPJMSIsFault()) {
+            jmsMessage.setBooleanProperty(JMSSpecConstants.ISFAULT_FIELD, messageProperties
+                .isSOAPJMSIsFault());
+        }
+
+        if (messageProperties.isSetSOAPJMSRequestURI()) {
+            jmsMessage.setStringProperty(JMSSpecConstants.REQUESTURI_FIELD, messageProperties
+                .getSOAPJMSRequestURI());
+        }
+
+        if (messageProperties != null && messageProperties.isSetProperty()) {
+            List<JMSPropertyType> props = messageProperties.getProperty();
+            for (int x = 0; x < props.size(); x++) {
+                jmsMessage.setStringProperty(props.get(x).getName(), props.get(x).getValue());
+            }
+        }
+    }
+
+    /**
+     * @param messageProperteis
+     * @param outMessage
+     * @param jmsConfig
+     */
+    static void prepareJMSProperties(JMSMessageHeadersType messageProperteis,
+                                     org.apache.cxf.message.Message outMessage,
+                                     JMSConfiguration jmsConfig) {
+        prepareJMSMessageHeaderProperties(messageProperteis, outMessage, jmsConfig);
+
+        prepareJMSMessageProperties(messageProperteis, outMessage, jmsConfig);
+
+    }
+
+    /**
+     * @param messageProperteis
+     * @param outMessage
+     * @param jmsConfig
+     */
+    private static void prepareJMSMessageHeaderProperties(
+                                                          JMSMessageHeadersType messageProperteis,
+                                                          org.apache.cxf.message.Message outMessage,
+                                                          JMSConfiguration jmsConfig) {
+        if (!messageProperteis.isSetJMSDeliveryMode()) {
+            messageProperteis.setJMSDeliveryMode(jmsConfig.getDeliveryMode());
+        }
+        if (!messageProperteis.isSetTimeToLive()) {
+            messageProperteis.setTimeToLive(jmsConfig.getTimeToLive());
+        }
+        if (!messageProperteis.isSetJMSPriority()) {
+            messageProperteis.setJMSPriority(jmsConfig.getPriority());
+        }
+    }
+
+    /**
+     * @param messageProperties
+     * @param outMessage
+     * @param jmsConfig
+     */
+    private static void prepareJMSMessageProperties(JMSMessageHeadersType messageProperties,
+                                                    org.apache.cxf.message.Message outMessage,
+                                                    JMSConfiguration jmsConfig) {
+        if (!messageProperties.isSetSOAPJMSTargetService()) {
+            messageProperties.setSOAPJMSTargetService(jmsConfig.getTargetService());
+        }
+        if (!messageProperties.isSetSOAPJMSBindingVersion()) {
+            messageProperties.setSOAPJMSBindingVersion("1.0");
+        }
+        messageProperties.setSOAPJMSContentType(getContentType(outMessage));
+        String soapAction = null;
+        // Retrieve or create protocol headers
+        Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)outMessage
+            .get(org.apache.cxf.message.Message.PROTOCOL_HEADERS));
+        if (headers != null) {
+            List<String> action = headers.get(SOAPConstants.SOAP_ACTION);
+            if (action != null && action.size() > 0) {
+                soapAction = action.get(0);
+            }
+        }
+        if (soapAction != null) {
+            messageProperties.setSOAPJMSSOAPAction(soapAction);
+        }
+        if (!messageProperties.isSetSOAPJMSIsFault()) {
+            if (outMessage.getContent(Exception.class) != null) {
+                messageProperties.setSOAPJMSIsFault(true);
+            } else {
+                messageProperties.setSOAPJMSIsFault(false);
+            }
+        }
+        if (!messageProperties.isSetSOAPJMSRequestURI()) {
+            messageProperties.setSOAPJMSRequestURI(jmsConfig.getRequestURI());
+        }
+    }
+
+    /**
+     * @param messageProperties
+     * @param inMessageProperties
+     */
+    public static void initResponseMessageProperties(JMSMessageHeadersType messageProperties,
+                                                     JMSMessageHeadersType inMessageProperties) {
+        messageProperties.setJMSDeliveryMode(inMessageProperties.getJMSDeliveryMode());
+        // messageProperties.setJMSExpiration(inMessageProperties.getJMSExpiration());
+        messageProperties.setJMSPriority(inMessageProperties.getJMSPriority());
+        //messageProperties.setJMSCorrelationID(inMessageProperties.getJMSMessageID());
+        // JMSDestination
+
+        messageProperties.setSOAPJMSRequestURI(inMessageProperties.getSOAPJMSRequestURI());
+        messageProperties.setSOAPJMSBindingVersion(inMessageProperties.getSOAPJMSBindingVersion());
+        // contenttype.
+    }
+
     public static String createCorrelationId(final String prefix, long i) {
         String index = Long.toHexString(i);
         StringBuffer id = new StringBuffer(prefix);

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/JMSSpecConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/JMSSpecConstants.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/JMSSpecConstants.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/JMSSpecConstants.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,71 @@
+/**
+ * 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.jms.spec;
+
+
+/**
+ * 
+ */
+public final class JMSSpecConstants {
+
+    public static final String SOAP_JMS_SPECIFICIATION_TRANSPORTID = "http://www.w3.org/2008/07/"
+                                                                     + "soap/bindings/JMS/";
+    public static final String SOAP_JMS_NAMESPACE = SOAP_JMS_SPECIFICIATION_TRANSPORTID;
+
+    public static final String SOAP_JMS_PREFIX = "SOAPJMS_";
+
+    // Connection to a destination properties
+    // just for jms uri
+    public static final String LOOKUPVARIANT_PARAMETER_NAME = "lookupVariant";
+    public static final String DESTINATIONNAME_PARAMETER_NAME = "destinationName";
+    // other connection destination properties
+    public static final String JNDICONNECTIONFACTORYNAME_PARAMETER_NAME = "jndiConnectionFactoryName";
+    public static final String JNDIINITIALCONTEXTFACTORY_PARAMETER_NAME = "jndiInitialContextFactory";
+    public static final String JNDIURL_PARAMETER_NAME = "jndiURL";
+    public static final String JNDICONTEXTPARAMETER_PARAMETER_NAME = "jndiContextParameter";
+
+    // JMS Message Header properties
+    public static final String DELIVERYMODE_PARAMETER_NAME = "deliveryMode";
+    // Expiration Time
+    public static final String TIMETOLIVE_PARAMETER_NAME = "timeToLive";
+    public static final String PRIORITY_PARAMETER_NAME = "priority";
+    // Destination
+    public static final String REPLYTONAME_PARAMETER_NAME = "replyToName";
+
+    // JMS Message properties' names.
+    public static final String REQUESTURI_PARAMETER_NAME = "requestURI";
+    public static final String BINDINGVERSION_PARAMETER_NAME = "bindingVersion";
+    public static final String SOAPACTION_PARAMETER_NAME = "soapAction";
+    public static final String TARGETSERVICE_PARAMETER_NAME = "targetService";
+    public static final String CONTENTTYPE_PARAMETER_NAME = "contentType";
+    public static final String ISFAULT_PARAMETER_NAME = "isFault";
+
+    // JMS Field name
+    public static final String REQUESTURI_FIELD = SOAP_JMS_PREFIX + REQUESTURI_PARAMETER_NAME;
+    public static final String BINDINGVERSION_FIELD = SOAP_JMS_PREFIX
+                                                      + BINDINGVERSION_PARAMETER_NAME;
+    public static final String SOAPACTION_FIELD = SOAP_JMS_PREFIX + SOAPACTION_PARAMETER_NAME;
+    public static final String TARGETSERVICE_FIELD = SOAP_JMS_PREFIX + TARGETSERVICE_PARAMETER_NAME;
+    public static final String CONTENTTYPE_FIELD = SOAP_JMS_PREFIX + CONTENTTYPE_PARAMETER_NAME;
+    public static final String ISFAULT_FIELD = SOAP_JMS_PREFIX + ISFAULT_PARAMETER_NAME;
+    
+    private JMSSpecConstants() {
+    }
+}

Propchange: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/JMSSpecConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spec/JMSSpecConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,90 @@
+/**
+ * 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.jms.uri;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * 
+ */
+public class JMSEndpoint extends JMSEndpointType {
+    Map jndiParameters = new HashMap();
+    Map parameters = new HashMap();
+
+    /**
+     * @param uri
+     * @param subject
+     */
+    public JMSEndpoint(String endpointUri, String jmsVariant, String destinationName) {
+        this.endpointUri = endpointUri;
+        this.jmsVariant = jmsVariant;
+        this.destinationName = destinationName;
+    }
+
+    public String getRequestURI() {
+        String requestUri = "jms:" + jmsVariant + ":" + destinationName;
+        boolean first = true;
+        Iterator iter = parameters.keySet().iterator();
+        while (iter.hasNext()) {
+            String key = (String)iter.next();
+            String value = (String)parameters.get(key);
+            if (first) {
+                requestUri += "?" + key + "=" + value;
+                first = false;
+            } else {
+                requestUri += "&" + key + "=" + value;
+            }
+        }
+        return requestUri;
+    }
+
+    /**
+     * @param key
+     * @param value
+     */
+    public void putJndiParameter(String key, String value) {
+        jndiParameters.put(key, value);
+    }
+
+    public void putParameter(String key, String value) {
+        parameters.put(key, value);
+    }
+
+    /**
+     * @param targetserviceParameterName
+     * @return
+     */
+    public String getParameter(String key) {
+        return (String)parameters.get(key);
+    }
+
+    public Map getJndiParameters() {
+        return jndiParameters;
+    }
+
+    /**
+     * @return
+     */
+    public Map getParameters() {
+        return parameters;
+    }
+}

Propchange: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message