cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r789096 [2/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
Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointParser.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,242 @@
+/**
+ * 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.net.URI;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+/**
+ * 
+ */
+public final class JMSEndpointParser {
+    private static final Logger LOG = LogUtils.getL7dLogger(JMSEndpointParser.class);
+
+    private JMSEndpointParser() {
+    }
+
+    public static JMSEndpoint createEndpoint(String uri) throws Exception {
+        // encode URI string to the unsafe URI characters
+        URI u = new URI(UnsafeUriCharactersEncoder.encode(uri));
+        String path = u.getSchemeSpecificPart();
+
+        // lets trim off any query arguments
+        if (path.startsWith("//")) {
+            path = path.substring(2);
+        }
+        int idx = path.indexOf('?');
+        if (idx > 0) {
+            path = path.substring(0, idx);
+        }
+        Map parameters = URISupport.parseParameters(u);
+
+        validateURI(uri, path, parameters);
+
+        LOG.log(Level.FINE, "Creating endpoint uri=[" + uri + "], path=[" + path
+                            + "], parameters=[" + parameters + "]");
+        JMSEndpoint endpoint = createEndpoint(uri, path);
+        if (endpoint == null) {
+            return null;
+        }
+
+        if (parameters != null) {
+            configureProperties(endpoint, parameters);
+        }
+
+        return endpoint;
+    }
+
+    /**
+     * @param endpoint
+     * @param parameters
+     */
+    private static void configureProperties(JMSEndpoint endpoint, Map parameters) {
+        String deliveryMode = getAndRemoveParameter(parameters,
+                                                    JMSURIConstants.DELIVERYMODE_PARAMETER_NAME);
+        String timeToLive = getAndRemoveParameter(parameters,
+                                                  JMSURIConstants.TIMETOLIVE_PARAMETER_NAME);
+        String priority = getAndRemoveParameter(parameters, JMSURIConstants.PRIORITY_PARAMETER_NAME);
+        String replyToName = getAndRemoveParameter(parameters,
+                                                   JMSURIConstants.REPLYTONAME_PARAMETER_NAME);
+        String jndiConnectionFactoryName = getAndRemoveParameter(
+                                                                 parameters,
+                                                JMSURIConstants.JNDICONNECTIONFACTORYNAME_PARAMETER_NAME);
+        String jndiInitialContextFactory = getAndRemoveParameter(
+                                                                 parameters,
+                                                JMSURIConstants.JNDIINITIALCONTEXTFACTORY_PARAMETER_NAME);
+        String jndiUrl = getAndRemoveParameter(parameters, JMSURIConstants.JNDIURL_PARAMETER_NAME);
+
+        if (deliveryMode != null) {
+            endpoint.setDeliveryMode(DeliveryModeType.valueOf(deliveryMode));
+        }
+        if (timeToLive != null) {
+            endpoint.setTimeToLive(Long.valueOf(timeToLive));
+        }
+        if (priority != null) {
+            endpoint.setPriority(Integer.valueOf(priority));
+        }
+        if (replyToName != null) {
+            endpoint.setReplyToName(replyToName);
+        }
+        if (jndiConnectionFactoryName != null) {
+            endpoint.setJndiConnectionFactoryName(jndiConnectionFactoryName);
+        }
+        if (jndiInitialContextFactory != null) {
+            endpoint.setJndiInitialContextFactory(jndiInitialContextFactory);
+        }
+        if (jndiUrl != null) {
+            endpoint.setJndiURL(jndiUrl);
+        }
+
+        Iterator iter = parameters.keySet().iterator();
+        while (iter.hasNext()) {
+            String key = (String)iter.next();
+            String value = (String)parameters.get(key);
+            if (value == null || value.equals("")) {
+                continue;
+            }
+            if (key.startsWith(JMSURIConstants.JNDI_PARAMETER_NAME_PREFIX)) {
+                key = key.substring(5);
+                endpoint.putJndiParameter(key, value);
+            } else {
+                endpoint.putParameter(key, value);
+            }
+        }
+    }
+
+    /**
+     * @param parameters
+     * @param deliverymodeParameterName
+     * @return
+     */
+    private static String getAndRemoveParameter(Map parameters, String parameterName) {
+        String value = (String)parameters.get(parameterName);
+        parameters.remove(parameterName);
+        return value;
+    }
+
+    /**
+     * Strategy for validation of the uri when creating the endpoint.
+     * 
+     * @param uri the uri - the uri the end user provided untouched
+     * @param path the path - part after the scheme
+     * @param parameters the parameters, an empty map if no parameters given
+     * @throws ResolveEndpointFailedException should be thrown if the URI validation failed
+     */
+    protected static void validateURI(String uri, String path, Map parameters)
+        throws ResolveEndpointFailedException {
+        // check for uri containing & but no ? marker
+        if (uri.contains("&") && !uri.contains("?")) {
+            throw new ResolveEndpointFailedException(
+                                                     uri,
+                                                     "Invalid uri syntax: no ? marker however the uri "
+                                                         + "has & parameter separators. "
+                                                         + "Check the uri if its missing a ? marker.");
+
+        }
+
+        // check for uri containing double && markers
+        if (uri.contains("&&")) {
+            throw new ResolveEndpointFailedException(uri,
+                                                     "Invalid uri syntax: Double && marker found. "
+                                                         + "Check the uri and remove the "
+                                                         + "duplicate & marker.");
+        }
+    }
+
+    /**
+     * A factory method allowing derived components to create a new endpoint from the given URI, remaining
+     * path and optional parameters
+     * 
+     * @param uri the full URI of the endpoint
+     * @param remaining the remaining part of the URI without the query parameters or component prefix
+     * @param parameters the optional parameters passed in
+     * @return a newly created endpoint or null if the endpoint cannot be created based on the inputs
+     */
+    protected static JMSEndpoint createEndpoint(String uri, String remaining) throws Exception {
+        boolean isQueue = false;
+        boolean isTopic = false;
+        boolean isJndi = false;
+        if (remaining.startsWith(JMSURIConstants.QUEUE_PREFIX)) {
+            remaining = removeStartingCharacters(remaining.substring(JMSURIConstants.QUEUE_PREFIX
+                .length()), '/');
+            isQueue = true;
+        } else if (remaining.startsWith(JMSURIConstants.TOPIC_PREFIX)) {
+            remaining = removeStartingCharacters(remaining.substring(JMSURIConstants.TOPIC_PREFIX
+                .length()), '/');
+            isTopic = true;
+        } else if (remaining.startsWith(JMSURIConstants.JNDI_PREFIX)) {
+            remaining = removeStartingCharacters(remaining.substring(JMSURIConstants.JNDI_PREFIX
+                .length()), '/');
+            isJndi = true;
+        }
+
+        final String subject = convertPathToActualDestination(remaining);
+
+        // lets make sure we copy the configuration as each endpoint can
+        // customize its own version
+        // JMSConfiguration newConfiguration = getConfiguration().copy();
+        JMSEndpoint endpoint = null;
+        if (isQueue) {
+            endpoint = new JMSQueueEndpoint(uri, subject);
+        } else if (isTopic) {
+            endpoint = new JMSTopicEndpoint(uri, subject);
+        } else if (isJndi) {
+            endpoint = new JMSJNDIEndpoint(uri, subject);
+        }
+        return endpoint;
+    }
+
+    /**
+     * A strategy method allowing the URI destination to be translated into the actual JMS destination name
+     * (say by looking up in JNDI or something)
+     */
+    protected static String convertPathToActualDestination(String path) {
+        return path;
+    }
+
+    public static JMSURIConstants getConfiguration() {
+        return null;
+    }
+
+    // Some helper methods
+    // -------------------------------------------------------------------------
+    /**
+     * Removes any starting characters on the given text which match the given character
+     * 
+     * @param text the string
+     * @param ch the initial characters to remove
+     * @return either the original string or the new substring
+     */
+    public static String removeStartingCharacters(String text, char ch) {
+        int idx = 0;
+        while (text.charAt(idx) == ch) {
+            idx++;
+        }
+        if (idx > 0) {
+            return text.substring(idx);
+        }
+        return text;
+    }
+}

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

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

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSJNDIEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSJNDIEndpoint.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSJNDIEndpoint.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSJNDIEndpoint.java Sun Jun 28 13:18:35 2009
@@ -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.transport.jms.uri;
+
+
+/**
+ * 
+ */
+public class JMSJNDIEndpoint extends JMSEndpoint {
+
+    /**
+     * @param uri
+     * @param subject
+     */
+    public JMSJNDIEndpoint(String uri, String subject) {
+        super(uri, JMSURIConstants.JNDI, subject);
+    }
+
+}

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

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

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSQueueEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSQueueEndpoint.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSQueueEndpoint.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSQueueEndpoint.java Sun Jun 28 13:18:35 2009
@@ -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.transport.jms.uri;
+
+
+
+/**
+ * An endpoint for a JMS Queue which is also browsable
+ *
+ * @version $Revision$
+ */
+public class JMSQueueEndpoint extends JMSEndpoint {
+    /**
+     * @param uri
+     * @param subject
+     */
+    public JMSQueueEndpoint(String uri, String subject) {
+        super(uri, JMSURIConstants.QUEUE, subject);
+    }
+}

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

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

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSTopicEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSTopicEndpoint.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSTopicEndpoint.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSTopicEndpoint.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,35 @@
+/**
+ * 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;
+
+
+/**
+ * 
+ */
+public class JMSTopicEndpoint extends JMSEndpoint {
+    /**
+     * @param uri
+     * @param subject
+     */
+    public JMSTopicEndpoint(String uri, String subject) {
+        super(uri, JMSURIConstants.TOPIC, subject);
+    }
+
+}

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

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

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIConstants.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIConstants.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIConstants.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,64 @@
+/**
+ * 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 javax.jms.Message;
+
+/**
+ * 
+ */
+public final class JMSURIConstants {
+    
+    // common constants
+    public static final String QUEUE = "queue";
+    public static final String TOPIC = "topic";
+    public static final String JNDI = "jndi";
+
+    public static final String QUEUE_PREFIX = "queue:";
+    public static final String TOPIC_PREFIX = "topic:";
+    public static final String JNDI_PREFIX = "jndi:";
+
+    public static final DeliveryModeType DELIVERYMODE_PERSISTENT = DeliveryModeType.PERSISTENT;
+    public static final DeliveryModeType DELIVERYMODE_NON_PERSISTENT = DeliveryModeType.NON_PERSISTENT;
+
+    // shared parameters
+    public static final String DELIVERYMODE_PARAMETER_NAME = "deliveryMode";
+    public static final String TIMETOLIVE_PARAMETER_NAME = "timeToLive";
+    public static final String PRIORITY_PARAMETER_NAME = "priority";
+    public static final String REPLYTONAME_PARAMETER_NAME = "replyToName";
+
+    // default parameters
+    public static final DeliveryModeType DELIVERYMODE_DEFAULT = DELIVERYMODE_PERSISTENT;
+    public static final long TIMETOLIVE_DEFAULT = Message.DEFAULT_TIME_TO_LIVE;
+    public static final int PRIORITY_DEFAULT = Message.DEFAULT_PRIORITY;
+
+    // jndi parameters ? need to be sure.
+    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 JNDI_PARAMETER_NAME_PREFIX = "jndi-";
+
+    // queue and topic parameters
+    public static final String TOPICREPLYTONAME_PARAMETER_NAME = "topicReplyToName";
+    
+
+    private JMSURIConstants() {
+    }
+}

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

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

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,43 @@
+/**
+ * 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;
+
+/**
+ * A runtime exception thrown if an {@link Endpoint} cannot be resolved via URI
+ * 
+ */
+public class ResolveEndpointFailedException extends RuntimeException {
+    private final String uri;
+
+    public ResolveEndpointFailedException(String uri, Throwable cause) {
+        super("Failed to resolve endpoint: " + uri + " due to: " + cause, cause);
+        this.uri = uri;
+    }
+
+    public ResolveEndpointFailedException(String uri, String message) {
+        super("Failed to resolve endpoint: " + uri + " due to: " + message);
+        this.uri = uri;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+    
+}

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

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

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/URISupport.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/URISupport.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/URISupport.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/URISupport.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,294 @@
+/**
+ * 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.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * URI utilities.
+ *
+ * @version $Revision$
+ */
+public final class URISupport {
+    
+    private URISupport() {
+        // Helper class
+    }
+
+    /**
+     * Holder to get parts of the URI.
+     */
+    public static class CompositeData {
+        private String host;
+
+        private String scheme;
+        private String path;
+        private URI components[];
+        private Map parameters;
+        private String fragment;
+
+        public URI[] getComponents() {
+            return components;
+        }
+
+        public String getFragment() {
+            return fragment;
+        }
+
+        public Map getParameters() {
+            return parameters;
+        }
+
+        public String getScheme() {
+            return scheme;
+        }
+
+        public String getPath() {
+            return path;
+        }
+
+        public String getHost() {
+            return host;
+        }
+
+        public URI toURI() throws URISyntaxException {
+            StringBuffer sb = new StringBuffer();
+            if (scheme != null) {
+                sb.append(scheme);
+                sb.append(':');
+            }
+
+            if (host != null && host.length() != 0) {
+                sb.append(host);
+            } else {
+                sb.append('(');
+                for (int i = 0; i < components.length; i++) {
+                    if (i != 0) {
+                        sb.append(',');
+                    }
+                    sb.append(components[i].toString());
+                }
+                sb.append(')');
+            }
+
+            if (path != null) {
+                sb.append('/');
+                sb.append(path);
+            }
+            if (!parameters.isEmpty()) {
+                sb.append("?");
+                sb.append(createQueryString(parameters));
+            }
+            if (fragment != null) {
+                sb.append("#");
+                sb.append(fragment);
+            }
+            return new URI(sb.toString());
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public static Map parseQuery(String uri) throws URISyntaxException {
+        try {
+            Map rc = new HashMap();
+            if (uri != null) {
+                String[] parameters = uri.split("&");
+                for (String parameter : parameters) {
+                    int p = parameter.indexOf("=");
+                    if (p >= 0) {
+                        String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8");
+                        String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8");
+                        rc.put(name, value);
+                    } else {
+                        rc.put(parameter, null);
+                    }
+                }
+            }
+            return rc;
+        } catch (UnsupportedEncodingException e) {
+            URISyntaxException se = new URISyntaxException(e.toString(), "Invalid encoding");
+            se.initCause(e);
+            throw se;
+        }
+    }
+
+    public static Map parseParameters(URI uri) throws URISyntaxException {
+        String query = uri.getQuery();
+        if (query == null) {
+            String schemeSpecificPart = uri.getSchemeSpecificPart();
+            int idx = schemeSpecificPart.lastIndexOf('?');
+            if (idx < 0) {
+                return Collections.EMPTY_MAP;
+            } else {
+                query = schemeSpecificPart.substring(idx + 1);
+            }
+        } else {
+            query = stripPrefix(query, "?");
+        }
+        return parseQuery(query);
+    }
+
+    /**
+     * Removes any URI query from the given uri
+     */
+    public static URI removeQuery(URI uri) throws URISyntaxException {
+        return createURIWithQuery(uri, null);
+    }
+
+    /**
+     * Creates a URI with the given query
+     */
+    public static URI createURIWithQuery(URI uri, String query) throws URISyntaxException {
+        return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(),
+                       query, uri.getFragment());
+    }
+
+    public static CompositeData parseComposite(URI uri) throws URISyntaxException {
+
+        CompositeData rc = new CompositeData();
+        rc.scheme = uri.getScheme();
+        String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim();
+
+        parseComposite(uri, rc, ssp);
+
+        rc.fragment = uri.getFragment();
+        return rc;
+    }
+
+    private static void parseComposite(URI uri, CompositeData rc, String ssp) throws URISyntaxException {
+        String params;
+
+        if (!checkParenthesis(ssp)) {
+            throw new URISyntaxException(uri.toString(), "Not a matching number of '(' and ')' parenthesis");
+        }
+
+        int p;
+        int intialParen = ssp.indexOf("(");
+        if (intialParen == 0) {
+            rc.host = ssp.substring(0, intialParen);
+            p = rc.host.indexOf("/");
+            if (p >= 0) {
+                rc.path = rc.host.substring(p);
+                rc.host = rc.host.substring(0, p);
+            }
+            p = ssp.lastIndexOf(")");
+            params = ssp.substring(p + 1).trim();
+        } else {
+            params = "";
+        }
+
+        p = params.indexOf("?");
+        if (p >= 0) {
+            if (p > 0) {
+                rc.path = stripPrefix(params.substring(0, p), "/");
+            }
+            rc.parameters = parseQuery(params.substring(p + 1));
+        } else {
+            if (params.length() > 0) {
+                rc.path = stripPrefix(params, "/");
+            }
+            rc.parameters = Collections.EMPTY_MAP;
+        }
+    }
+
+    public static String stripPrefix(String value, String prefix) {
+        if (value.startsWith(prefix)) {
+            return value.substring(prefix.length());
+        }
+        return value;
+    }
+
+    public static URI stripScheme(URI uri) throws URISyntaxException {
+        return new URI(stripPrefix(uri.getSchemeSpecificPart().trim(), "//"));
+    }
+
+    public static String createQueryString(Map options) throws URISyntaxException {
+        try {
+            if (options.size() > 0) {
+                StringBuffer rc = new StringBuffer();
+                boolean first = true;
+                for (Object o : options.keySet()) {
+                    if (first) {
+                        first = false;
+                    } else {
+                        rc.append("&");
+                    }
+
+                    String key = (String) o;
+                    String value = (String) options.get(key);
+                    rc.append(URLEncoder.encode(key, "UTF-8"));
+                    rc.append("=");
+                    rc.append(URLEncoder.encode(value, "UTF-8"));
+                }
+                return rc.toString();
+            } else {
+                return "";
+            }
+        } catch (UnsupportedEncodingException e) {
+            URISyntaxException se = new URISyntaxException(e.toString(), "Invalid encoding");
+            se.initCause(e);
+            throw se;
+        }
+    }
+
+    /**
+     * Creates a URI from the original URI and the remaining parameters
+     */
+    public static URI createRemainingURI(URI originalURI, Map params) throws URISyntaxException {
+        String s = createQueryString(params);
+        if (s.length() == 0) {
+            s = null;
+        }
+        return createURIWithQuery(originalURI, s);
+    }
+
+    public static URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException {
+        return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(), bindAddr
+            .getPath(), bindAddr.getQuery(), bindAddr.getFragment());
+    }
+
+    public static boolean checkParenthesis(String str) {
+        boolean result = true;
+        if (str != null) {
+            int open = 0;
+            int closed = 0;
+
+            int i = 0;
+            while ((i = str.indexOf('(', i)) >= 0) {
+                i++;
+                open++;
+            }
+            i = 0;
+            while ((i = str.indexOf(')', i)) >= 0) {
+                i++;
+                closed++;
+            }
+            result = open == closed;
+        }
+        return result;
+    }
+   
+}

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

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

Added: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/UnsafeUriCharactersEncoder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/UnsafeUriCharactersEncoder.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/UnsafeUriCharactersEncoder.java (added)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/UnsafeUriCharactersEncoder.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,100 @@
+/**
+ * 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.io.UnsupportedEncodingException;
+import java.util.BitSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+/**
+ * Encoder for unsafe URI characters.
+ */
+public final class UnsafeUriCharactersEncoder {
+    private static BitSet unsafeCharacters;
+    private static final Logger LOG = LogUtils.getL7dLogger(UnsafeUriCharactersEncoder.class);
+    private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
+                                              'D', 'E', 'F'};
+
+    static {
+        unsafeCharacters = new BitSet(256);
+        unsafeCharacters.set(' ');
+        unsafeCharacters.set('"');
+        unsafeCharacters.set('<');
+        unsafeCharacters.set('>');
+        unsafeCharacters.set('#');
+        unsafeCharacters.set('%');
+        unsafeCharacters.set('{');
+        unsafeCharacters.set('}');
+        unsafeCharacters.set('|');
+        unsafeCharacters.set('\\');
+        unsafeCharacters.set('^');
+        unsafeCharacters.set('~');
+        unsafeCharacters.set('[');
+        unsafeCharacters.set(']');
+        unsafeCharacters.set('`');
+    }
+
+    private UnsafeUriCharactersEncoder() {
+        // util class
+    }
+
+    public static String encode(String s) {
+        int n = s.length();
+        if (n == 0) {
+            return s;
+        }
+
+        try {
+            // First check whether we actually need to encode
+            byte[] bytes = s.getBytes("UTF8");
+            for (int i = 0;;) {
+                if (unsafeCharacters.get(bytes[i])) {
+                    break;
+                }
+                if (++i >= bytes.length) {
+                    return s;
+                }
+            }
+
+            // okay there are some unsafe characters so we do need to encode
+            StringBuffer sb = new StringBuffer();
+            for (byte b : bytes) {
+                if (unsafeCharacters.get(b)) {
+                    appendEscape(sb, b);
+                } else {
+                    sb.append((char)b);
+                }
+            }
+            return sb.toString();
+        } catch (UnsupportedEncodingException e) {
+            LOG.log(Level.SEVERE, "Can't encoding the uri: ", e);
+            return null;
+        }
+    }
+
+    private static void appendEscape(StringBuffer sb, byte b) {
+        sb.append('%');
+        sb.append(HEX_DIGITS[(b >> 4) & 0x0f]);
+        sb.append(HEX_DIGITS[(b >> 0) & 0x0f]);
+    }
+
+}

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

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

Modified: cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/bus-extensions.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/bus-extensions.xml?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/bus-extensions.xml (original)
+++ cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/bus-extensions.xml Sun Jun 28 13:18:35 2009
@@ -22,6 +22,7 @@
     <extension class="org.apache.cxf.transport.jms.JMSTransportFactory" deferred="true">
         <namespace>http://cxf.apache.org/transports/jms</namespace>
         <namespace>http://cxf.apache.org/transports/jms/configuration</namespace>
+        <namespace>http://www.w3.org/2008/07/soap/bindings/JMS/</namespace>
     </extension>
         
 </extensions>

Modified: cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension-jms.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension-jms.xml?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension-jms.xml (original)
+++ cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/cxf-extension-jms.xml Sun Jun 28 13:18:35 2009
@@ -31,6 +31,7 @@
             <list>
                 <value>http://cxf.apache.org/transports/jms</value>
                 <value>http://cxf.apache.org/transports/jms/configuration</value>
+                <value>http://www.w3.org/2008/07/soap/bindings/JMS/</value>
             </list>
         </property>
     </bean>

Added: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb (added)
+++ cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb Sun Jun 28 13:18:35 2009
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<jaxb:bindings version="1.0" 
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 
+  jaxb:extensionBindingPrefixes="xjc">
+    <jaxb:bindings schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.wsdl"/>
+        </jaxb:schemaBindings>
+        <jaxb:globalBindings generateIsSetMethod="true"/>
+    </jaxb:bindings>
+    <jaxb:bindings schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" node="/xs:schema/xs:complexType[@name='tExtensibilityElement']">
+        <jaxb:class implClass="org.apache.cxf.wsdl.TExtensibilityElementImpl"/>
+    </jaxb:bindings>
+    <jaxb:bindings schemaLocation="jms-spec.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.transport.jms.spec"/>
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+</jaxb:bindings>

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xjb
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd (added)
+++ cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd Sun Jun 28 13:18:35 2009
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+	<!--
+		Licensed to the Apache Software Foundation (ASF) under one or more
+		contributor license agreements. See the NOTICE file distributed with
+		this work for additional information regarding copyright ownership.
+		The ASF licenses this file to you under the Apache License, Version
+		2.0 (the "License"); you may not use this file except in compliance
+		with the License. You may obtain a copy of the License at
+
+		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+		applicable law or agreed to in writing, software distributed under the
+		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+		CONDITIONS OF ANY KIND, either express or implied. See the License for
+		the specific language governing permissions and limitations under the
+		License.
+	-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:soapjms="http://www.w3.org/2008/07/soap/bindings/JMS/"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+	targetNamespace="http://www.w3.org/2008/07/soap/bindings/JMS/"
+	elementFormDefault="qualified" jaxb:version="2.0">
+
+	<xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
+		schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" />
+
+	<xs:element name="deliveryMode" type="soapjms:deliveryModeType" />
+	
+	<!-- JMS specification for wsdl-->
+	<xs:complexType name="jndiConnectionFactoryNameType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="jndiConnectionFactoryName" type="xs:string" />
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+
+	<xs:complexType name="jndiInitialContextFactoryType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="jndiInitialContextFactory" type="xs:string" />
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+
+	<xs:complexType name="jndiURLType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="jndiURL" type="xs:anyURI" />
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+
+	<xs:complexType name="jndiContextParameterType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="jndiContextParameter">
+						<xs:complexType>
+							<xs:attribute name="name" type="xs:string" use="required" />
+							<xs:attribute name="value" use="required">
+								<xs:simpleType>
+									<xs:restriction base="xs:string">
+										<xs:minLength value="1" />
+									</xs:restriction>
+								</xs:simpleType>
+							</xs:attribute>
+						</xs:complexType>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+
+	<xs:complexType name="deliveryModeType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="deliveryMode">
+						<xs:simpleType>
+							<xs:restriction base="xs:string">
+								<xs:enumeration value="PERSISTENT" />
+								<xs:enumeration value="NON_PERSISTENT" />
+							</xs:restriction>
+						</xs:simpleType>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+
+	<xs:complexType name="timeToLiveType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="timeToLive" type="xs:long" />
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+
+	<xs:complexType name="priorityType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="priority">
+						<xs:simpleType>
+							<xs:restriction base="xs:int">
+								<xs:minInclusive value="0" />
+								<xs:maxInclusive value="9" />
+							</xs:restriction>
+						</xs:simpleType>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	
+	<xs:complexType name="replyToNameType">
+		<xs:complexContent>
+			<xs:extension base="wsdl:tExtensibilityElement">
+				<xs:sequence>
+					<xs:element name="replyToName" type="xs:string" />
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+</xs:schema>

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-spec.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb (added)
+++ cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb Sun Jun 28 13:18:35 2009
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<jaxb:bindings version="1.0" 
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 
+  jaxb:extensionBindingPrefixes="xjc">
+    <jaxb:bindings schemaLocation="jms-uri.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.transport.jms.uri"/>
+        </jaxb:schemaBindings>
+        <jaxb:globalBindings generateIsSetMethod="true"/>
+    </jaxb:bindings>
+</jaxb:bindings>

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xjb
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd (added)
+++ cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd Sun Jun 28 13:18:35 2009
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+	<!--
+		Licensed to the Apache Software Foundation (ASF) under one or more
+		contributor license agreements. See the NOTICE file distributed with
+		this work for additional information regarding copyright ownership.
+		The ASF licenses this file to you under the Apache License, Version
+		2.0 (the "License"); you may not use this file except in compliance
+		with the License. You may obtain a copy of the License at
+
+		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+		applicable law or agreed to in writing, software distributed under the
+		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+		CONDITIONS OF ANY KIND, either express or implied. See the License for
+		the specific language governing permissions and limitations under the
+		License.
+	-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:jms="http://cxf.apache.org/transports/jms/uri" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+	targetNamespace="http://cxf.apache.org/transports/jms/uri"
+	elementFormDefault="qualified" jaxb:version="2.0">
+
+	<xs:complexType name="ParameterType">
+		<xs:attribute name="name" type="xs:string" use="required" />
+		<xs:attribute name="value" use="required">
+			<xs:simpleType>
+				<xs:restriction base="xs:string">
+					<xs:minLength value="1" />
+				</xs:restriction>
+			</xs:simpleType>
+		</xs:attribute>
+	</xs:complexType>
+
+	<xs:simpleType name="deliveryModeType">
+		<xs:restriction base="xs:string">
+			<xs:enumeration value="PERSISTENT" />
+			<xs:enumeration value="NON_PERSISTENT" />
+		</xs:restriction>
+	</xs:simpleType>
+
+	<xs:simpleType name="priorityType">
+		<xs:restriction base="xs:int">
+			<xs:minInclusive value="0" />
+			<xs:maxInclusive value="9" />
+		</xs:restriction>
+	</xs:simpleType>
+
+
+	<xs:complexType name="JMSEndpointType">
+		<xs:annotation>
+			<xs:documentation>JMS header properties.</xs:documentation>
+		</xs:annotation>
+		<!-- 
+		<xs:sequence>
+			<xs:element name="parameters" type="jms:ParameterType"
+				minOccurs="0" maxOccurs="unbounded" />
+			<xs:element name="jndiParameters" type="jms:ParameterType"
+				minOccurs="0" maxOccurs="unbounded" />
+		</xs:sequence>
+		-->
+		<xs:attribute name="endpointUri" type="xs:string" />
+		<xs:attribute name="jmsVariant" type="xs:string" />
+		<xs:attribute name="destinationName" type="xs:string" />
+		<xs:attribute name="deliveryMode" type="jms:deliveryModeType" />
+		<xs:attribute name="timeToLive" type="xs:long" />
+		<xs:attribute name="priority" type="jms:priorityType" />
+		<xs:attribute name="replyToName" type="xs:string" />
+		<xs:attribute name="jndiConnectionFactoryName" type="xs:string" />
+		<xs:attribute name="jndiInitialContextFactory" type="xs:string" />
+		<xs:attribute name="jndiURL" type="xs:string" />
+	</xs:complexType>
+</xs:schema>

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms-uri.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd (original)
+++ cxf/trunk/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd Sun Jun 28 13:18:35 2009
@@ -78,11 +78,13 @@
     
     <xs:complexType name="JMSMessageHeadersType">
         <xs:annotation>
-            <xs:documentation>JMS header properties.</xs:documentation>
+            <xs:documentation>JMS properties.</xs:documentation>
         </xs:annotation>
         <xs:sequence>
             <xs:element name="property" type="jms:JMSPropertyType" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
+        
+        <!-- JMS Header properties -->
         <xs:attribute name="JMSCorrelationID" type="xs:string"/>
         <xs:attribute name="JMSDeliveryMode" type="xs:int"/>
         <xs:attribute name="JMSExpiration" type="xs:long"/>
@@ -92,8 +94,33 @@
         <xs:attribute name="JMSTimeStamp" type="xs:long"/>
         <xs:attribute name="JMSType" type="xs:string"/>
         <xs:attribute name="TimeToLive" type="xs:long"/>
+        
+        <!-- JMS Message properties for SOAP over JMS specification  -->
+        <xs:attribute name="SOAPJMSTargetService" type="xs:string"/>
+    	<xs:attribute name="SOAPJMSBindingVersion" type="xs:string"/>
+    	<xs:attribute name="SOAPJMSContentType" type="xs:string"/>
+    	<xs:attribute name="SOAPJMSSOAPAction" type="xs:anyURI"/>
+    	<xs:attribute name="SOAPJMSIsFault" type="xs:boolean"/>
+    	<xs:attribute name="SOAPJMSRequestURI" type="xs:string"/>
     </xs:complexType>
     
+    <!-- 
+    <xs:complexType name="SOAPOverJMSMessageType">
+    	<xs:annotation>
+    		<xs:documentation>SOAP Over JMS Message Properties</xs:documentation>
+    	</xs:annotation>
+    	<xs:sequence>
+    		<xs:element name="property" type="jms:JMSPropertyType" minOccurs="0" maxOccurs="unbounded"/>
+    	</xs:sequence>
+    	<xs:attribute name="SOAPJMSTargetService" type="xs:string"/>
+    	<xs:attribute name="SOAPJMSBindingVersion" type="xs:string"/>
+    	<xs:attribute name="SOAPJMSContentType" type="xs:string"/>
+    	<xs:attribute name="SOAPJMSSOAPAction" type="xs:anyURI"/>
+    	<xs:attribute name="SOAPJMSIsFault" type="xs:boolean"/>
+    	<xs:attribute name="SOAPJMSRequestURI" type="xs:string"/>
+    </xs:complexType>
+     -->
+    
     <xs:simpleType name="JMSClientReceiveTimeOut">
         <xs:restriction base="xs:long"/>
     </xs:simpleType>
@@ -280,4 +307,12 @@
         </xs:complexContent>
     </xs:complexType>
     
+    <xs:complexType name="JMSFaultType">
+    	<xs:sequence>
+      		<xs:element name="FaultCode" type="xs:QName"/>
+      		<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+    	</xs:sequence>
+    	<xs:anyAttribute namespace="##any" processContents="lax"/>
+  	</xs:complexType>
+    
 </xs:schema>

Modified: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java (original)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java Sun Jun 28 13:18:35 2009
@@ -108,7 +108,7 @@
         os.close();
     }
 
-    protected JMSConduit setupJMSConduit(boolean send, boolean decoupled) {
+    protected JMSConduit setupJMSConduit(boolean send, boolean decoupled) throws IOException {
         if (decoupled) {
             // setup the reference type
         } else {

Modified: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java (original)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java Sun Jun 28 13:18:35 2009
@@ -77,7 +77,7 @@
                    + " seconds", destMessage != null);
     }
 
-    public JMSDestination setupJMSDestination(boolean send) {
+    public JMSDestination setupJMSDestination(boolean send) throws IOException {
         JMSConfiguration jmsConfig = new JMSOldConfigHolder()
             .createJMSConfigurationFromEndpointInfo(bus, endpointInfo, false);
         JMSDestination jmsDestination = new JMSDestination(bus, endpointInfo, jmsConfig);
@@ -336,7 +336,7 @@
     }
 
     @Test
-    public void testPropertyExclusion() throws Exception {
+    public void testProperty() throws Exception {
 
         final String customPropertyName = "THIS_PROPERTY_WILL_NOT_BE_AUTO_COPIED";
 
@@ -393,11 +393,10 @@
 
         JMSMessageHeadersType inHeader = (JMSMessageHeadersType)inMessage
             .get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
-
-        assertTrue("property has been excluded, only CONTENT_TYPE should be here", inHeader.getProperty()
-            .size() == 1);
-        assertTrue("property has been excluded, only " + JMSConstants.JMS_CONTENT_TYPE + "should be here",
-                   inHeader.getProperty().get(0).getName().equals(JMSConstants.JMS_CONTENT_TYPE));
+        assertNotNull("The inHeader should not be null", inHeader);
+        assertNotNull("The property should not be null " + inHeader.getProperty());
+        // TODO we need to check the SOAP JMS transport properties here
+        
         // wait for a while for the jms session recycling
         Thread.sleep(1000);
         conduit.close();

Added: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java (added)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,142 @@
+/**
+ * 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.Map;
+
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JMSEndpointTest extends Assert {
+
+    @Test
+    public void testBasicQueue() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:queue:Foo.Bar");
+        assertTrue(endpoint instanceof JMSQueueEndpoint);
+        assertEquals(endpoint.getDestinationName(), "Foo.Bar");
+        assertEquals(endpoint.getJmsVariant(), JMSURIConstants.QUEUE);
+    }
+
+    @Test
+    public void testQueueParameters() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:queue:Foo.Bar?foo=bar&foo2=bar2");
+        assertTrue(endpoint instanceof JMSQueueEndpoint);
+        assertEquals(endpoint.getDestinationName(), "Foo.Bar");
+        assertEquals(endpoint.getJmsVariant(), JMSURIConstants.QUEUE);
+        assertEquals(endpoint.getParameters().size(), 2);
+        assertEquals(endpoint.getParameter("foo"), "bar");
+        assertEquals(endpoint.getParameter("foo2"), "bar2");
+    }
+
+    @Test
+    public void testBasicTopic() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:topic:Foo.Bar");
+        assertTrue(endpoint instanceof JMSTopicEndpoint);
+        assertEquals(endpoint.getDestinationName(), "Foo.Bar");
+        assertEquals(endpoint.getJmsVariant(), JMSURIConstants.TOPIC);
+    }
+
+    @Test
+    public void testTopicParameters() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:topic:Foo.Bar?foo=bar&foo2=bar2");
+        assertTrue(endpoint instanceof JMSTopicEndpoint);
+        assertEquals(endpoint.getParameters().size(), 2);
+        assertEquals(endpoint.getParameter("foo"), "bar");
+        assertEquals(endpoint.getParameter("foo2"), "bar2");
+    }
+
+    @Test
+    public void testBasicJNDI() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:jndi:Foo.Bar");
+        assertTrue(endpoint instanceof JMSJNDIEndpoint);
+        assertEquals(endpoint.getDestinationName(), "Foo.Bar");
+        assertEquals(endpoint.getJmsVariant(), JMSURIConstants.JNDI);
+    }
+
+    @Test
+    public void testJNDIParameters() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:jndi:Foo.Bar?" + "jndiInitialContextFactory"
+                                               + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+                                               + "&jndiConnectionFactoryName=ConnectionFactory"
+                                               + "&jndiURL=tcp://localhost:61616");
+        assertTrue(endpoint instanceof JMSJNDIEndpoint);
+        assertEquals(endpoint.getParameters().size(), 0);
+        assertEquals(endpoint.getDestinationName(), "Foo.Bar");
+        assertEquals(endpoint.getJndiInitialContextFactory(),
+                     "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
+        assertEquals(endpoint.getJndiConnectionFactoryName(),
+                     "ConnectionFactory");
+        assertEquals(endpoint.getJndiURL(), "tcp://localhost:61616");
+    }
+    
+    @Test
+    public void testJNDIWithAdditionalParameters() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:jndi:Foo.Bar?" + "jndiInitialContextFactory"
+                                               + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+                                               + "&jndiConnectionFactoryName=ConnectionFactory"
+                                               + "&jndiURL=tcp://localhost:61616"
+                                               + "&jndi-com.sun.jndi.someParameter=someValue");
+        assertTrue(endpoint instanceof JMSJNDIEndpoint);
+        assertEquals(endpoint.getParameters().size(), 0);
+        assertEquals(endpoint.getJndiInitialContextFactory(),
+                     "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
+        assertEquals(endpoint.getJndiConnectionFactoryName(), "ConnectionFactory");
+        assertEquals(endpoint.getJndiURL(), "tcp://localhost:61616");
+        Map addParas = endpoint.getJndiParameters();
+        assertEquals(addParas.size(), 1);
+        assertEquals(addParas.get("com.sun.jndi.someParameter"), "someValue");
+    }
+
+    @Test
+    public void testSharedParameters() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:queue:Foo.Bar?" + "deliveryMode=NON_PERSISTENT"
+                                               + "&timeToLive=100" + "&priority=5" + "&replyToName=foo.bar2");
+        assertTrue(endpoint instanceof JMSQueueEndpoint);
+        assertEquals(endpoint.getParameters().size(), 0);
+        assertEquals(endpoint.getDeliveryMode(),
+                     JMSURIConstants.DELIVERYMODE_NON_PERSISTENT);
+        assertEquals(endpoint.getTimeToLive(), 100);
+        assertEquals(endpoint.getPriority(), 5);
+        assertEquals(endpoint.getReplyToName(), "foo.bar2");
+    }
+
+    @Test
+    public void testRequestUri() throws Exception {
+        JMSEndpoint endpoint = resolveEndpoint("jms:jndi:Foo.Bar?" + "jndiInitialContextFactory"
+                                               + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+                                               + "&foo=bar"
+                                               + "&foo2=bar2");
+        assertTrue(endpoint instanceof JMSJNDIEndpoint);
+        assertEquals(endpoint.getParameters().size(), 2);
+        String requestUri = endpoint.getRequestURI();
+        assertEquals(requestUri, "jms:jndi:Foo.Bar?foo=bar&foo2=bar2");
+    }
+    
+    private JMSEndpoint resolveEndpoint(String uri) {
+        JMSEndpoint endpoint = null;
+        try {
+            endpoint = JMSEndpointParser.createEndpoint(uri);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return endpoint;
+    }
+}

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

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

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterSpecImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterSpecImpl.java?rev=789096&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterSpecImpl.java (added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterSpecImpl.java Sun Jun 28 13:18:35 2009
@@ -0,0 +1,45 @@
+/**
+ * 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.systest.jms;
+
+import org.apache.cxf.jms_greeter.JMSGreeterPortType;
+
+@javax.jws.WebService(portName = "GreeterPort", 
+                      serviceName = "JMSGreeterService",
+                      targetNamespace = "http://cxf.apache.org/jms_greeter",
+                      endpointInterface = "org.apache.cxf.jms_greeter.JMSGreeterPortType",
+                      wsdlLocation = "testutils/jms_spec_test.wsdl")
+public class GreeterSpecImpl implements JMSGreeterPortType {
+
+    public String greetMe(String me) {
+        System.out.println("Executing operation greetMe");
+        System.out.println("Message received: " + me + "\n");
+        return "Hello " + me;
+    }
+
+    public String sayHi() {
+        System.out.println("Executing operation sayHi" + "\n");
+        return "Bonjour";
+    }
+    
+    public void greetMeOneWay(String me) {
+        System.out.println("Executing operation greetMeOneWay\n");
+        System.out.println("Hello there " + me);
+    }
+}

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterSpecImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterSpecImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java Sun Jun 28 13:18:35 2009
@@ -49,12 +49,17 @@
 import org.apache.cxf.hello_world_jms.HelloWorldServiceRuntimeCorrelationIDDynamicPrefix;
 import org.apache.cxf.hello_world_jms.HelloWorldServiceRuntimeCorrelationIDStaticPrefix;
 import org.apache.cxf.hello_world_jms.NoSuchCodeLitFault;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jms_greeter.JMSGreeterPortType;
+import org.apache.cxf.jms_greeter.JMSGreeterService;
 import org.apache.cxf.jms_mtom.JMSMTOMPortType;
 import org.apache.cxf.jms_mtom.JMSMTOMService;
+import org.apache.cxf.systest.jaxws.Hello;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.transport.jms.JMSConstants;
 import org.apache.cxf.transport.jms.JMSMessageHeadersType;
 import org.apache.cxf.transport.jms.JMSPropertyType;
+import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
 import org.apache.hello_world_doc_lit.Greeter;
 import org.apache.hello_world_doc_lit.PingMeFault;
 import org.apache.hello_world_doc_lit.SOAPService2;
@@ -766,4 +771,94 @@
         int size2 = handler1.value.getInputStream().available();
         assertTrue("The response file is not same with the sent file.", size == size2);
     }
+    
+    @Test
+    public void testSpecJMS() throws Exception {
+        QName serviceName = getServiceName(new QName("http://cxf.apache.org/jms_greeter",
+                                                     "JMSGreeterService"));
+        QName portName = getPortName(new QName("http://cxf.apache.org/jms_greeter", "GreeterPort"));
+        URL wsdl = getWSDLURL("/wsdl/jms_spec_test.wsdl");
+        assertNotNull(wsdl);
+
+        JMSGreeterService service = new JMSGreeterService(wsdl, serviceName);
+        assertNotNull(service);
+
+        String response1 = new String("Hello Milestone-");
+        String response2 = new String("Bonjour");
+        try {
+            JMSGreeterPortType greeter = service.getPort(portName, JMSGreeterPortType.class);
+            for (int idx = 0; idx < 5; idx++) {
+
+                greeter.greetMeOneWay("test String");
+
+                String greeting = greeter.greetMe("Milestone-" + idx);
+                assertNotNull("no response received from service", greeting);
+                String exResponse = response1 + idx;
+                assertEquals(exResponse, greeting);
+
+                String reply = greeter.sayHi();
+                assertNotNull("no response received from service", reply);
+                assertEquals(response2, reply);
+            }
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    @Test 
+    public void testSpecNoWsdlService() throws Exception {
+        String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
+            + "?jndiInitialContextFactory"
+            + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+            + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
+
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
+        factory.setServiceClass(Hello.class);
+        factory.setAddress(address);
+        Hello client = (Hello)factory.create();
+        String reply = client.sayHi(" HI");
+        assertEquals(reply, "get HI");
+    }
+    
+    @Test
+    public void testBindingVersionError() throws Exception {
+        QName serviceName = getServiceName(new QName("http://cxf.apache.org/jms_greeter",
+                                                     "JMSGreeterService"));
+        QName portName = getPortName(new QName("http://cxf.apache.org/jms_greeter", "GreeterPort"));
+        URL wsdl = getWSDLURL("/wsdl/jms_spec_test.wsdl");
+        assertNotNull(wsdl);
+
+        JMSGreeterService service = new JMSGreeterService(wsdl, serviceName);
+        assertNotNull(service);
+
+        try {
+            JMSGreeterPortType greeter = service.getPort(portName, JMSGreeterPortType.class);
+            InvocationHandler handler  = Proxy.getInvocationHandler(greeter);
+            BindingProvider  bp = null;
+            
+            if (handler instanceof BindingProvider) {
+                bp = (BindingProvider)handler;                
+                Map<String, Object> requestContext = bp.getRequestContext();
+                JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
+                requestHeader.setSOAPJMSBindingVersion("0.3");
+                requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
+            } 
+ 
+            String greeting = greeter.greetMe("Milestone-");
+            assertNull("should have response received from service", greeting);
+
+            if (bp != null) {
+                Map<String, Object> responseContext = bp.getResponseContext();
+                JMSMessageHeadersType responseHdr = 
+                     (JMSMessageHeadersType)responseContext.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
+                if (responseHdr == null) {
+                    fail("response Header should not be null");
+                }
+                assertTrue(responseHdr.isSOAPJMSIsFault());
+            }
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java?rev=789096&r1=789095&r2=789096&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java Sun Jun 28 13:18:35 2009
@@ -23,7 +23,11 @@
 import javax.xml.ws.soap.SOAPBinding;
 
 import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.systest.jaxws.Hello;
+import org.apache.cxf.systest.jaxws.HelloImpl;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
 
 public class Server extends AbstractBusTestServerBase {
 
@@ -61,6 +65,33 @@
         EndpointImpl ep = (EndpointImpl)Endpoint.publish("http://cxf.apache.org/transports/jms", mtom);
         Binding binding = ep.getBinding();        
         ((SOAPBinding)binding).setMTOMEnabled(true);  
+        
+        Object spec1 = new GreeterSpecImpl();
+        String address1 = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue2"
+                         + "?jndiInitialContextFactory"
+                         + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+                         + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
+        Endpoint.publish(address1, spec1);
+        
+        initNoWsdlServer();
+    }
+
+
+    /**
+     * 
+     */
+    private void initNoWsdlServer() {
+        String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
+            + "?jndiInitialContextFactory"
+            + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+            + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61500";
+        Hello implementor = new HelloImpl();
+        JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
+        svrFactory.setServiceClass(Hello.class);
+        svrFactory.setAddress(address);
+        svrFactory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
+        svrFactory.setServiceBean(implementor);
+        svrFactory.create();
     }
 
 

Added: cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl?rev=789096&view=auto
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl (added)
+++ cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl Sun Jun 28 13:18:35 2009
@@ -0,0 +1,137 @@
+<?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.
+-->
+<wsdl:definitions name="JMSGreeterService"
+    targetNamespace="http://cxf.apache.org/jms_greeter" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://cxf.apache.org/jms_greeter"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:x1="http://cxf.apache.org/jms_greeter/types">
+    <wsdl:types>
+        <schema targetNamespace="http://cxf.apache.org/jms_greeter/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    
+    
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeOneWayRequest">
+        <wsdl:part element="x1:greetMeOneWay" name="in"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="JMSGreeterPortType">
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+        </wsdl:operation>
+
+    </wsdl:portType>
+    
+    <wsdl:binding name="JMSGreeterPortBinding" type="tns:JMSGreeterPortType">
+        <soap:binding style="document" transport="http://www.w3.org/2008/07/soap/bindings/JMS/"/>
+       
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="test" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="test" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <soap:operation soapaction="test" style="document"/>
+            <wsdl:input name="greetMeOneWayRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+    </wsdl:binding>
+    
+    <wsdl:service name="JMSGreeterService">
+           <wsdl:port binding="tns:JMSGreeterPortBinding" name="GreeterPort">
+               <soap:address location="jms:jndi:dynamicQueues/test.cxf.jmstransport.queue2?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;jndiConnectionFactoryName=ConnectionFactory&amp;jndiURL=tcp://localhost:61500"/>
+           </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Propchange: cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/testutils/src/main/resources/wsdl/jms_spec_test.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message