cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject git commit: CXF-5543 Minor fixes
Date Wed, 05 Mar 2014 16:12:54 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 540508c6e -> 3353757e3


CXF-5543 Minor fixes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/3353757e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/3353757e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/3353757e

Branch: refs/heads/master
Commit: 3353757e3f9566ec75e29a17c6b05afe52eccf86
Parents: 540508c
Author: Christian Schneider <chris@die-schneider.net>
Authored: Wed Mar 5 13:40:10 2014 +0100
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Wed Mar 5 17:12:37 2014 +0100

----------------------------------------------------------------------
 .../apache/cxf/transport/jms/JMSConduit.java    |  9 +-
 .../cxf/transport/jms/JMSConfigFactory.java     | 23 -----
 .../cxf/transport/jms/JMSConfiguration.java     |  6 +-
 .../cxf/transport/jms/JMSDestination.java       |  2 +-
 .../apache/cxf/transport/jms/JMSFactory.java    | 99 ++------------------
 .../transport/jms/uri/JMSEndpointWSDLUtil.java  |  2 +-
 .../jms/uri/ResolveEndpointFailedException.java | 44 ---------
 .../jms/wsdl11/JMSWSDLExtensionLoader.java      | 52 +++++-----
 8 files changed, 46 insertions(+), 191 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
index e0eeeaf..011c859 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
@@ -53,9 +53,10 @@ import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 /**
  * JMSConduit is instantiated by the JMSTransportFactory which is selected by a client if
the transport
- * protocol starts with jms://. JMSConduit converts CXF Messages to JMS Messages and sends
the request by 
- * using a JMS destination. If the Exchange is not oneway it then recevies the response and
converts it to 
- * a CXF Message. This is then provided in the Exchange and also sent to the incomingObserver.
+ * protocol starts with "jms:". JMSConduit converts CXF Messages to JMS Messages and sends
the request
+ * over a queue or a topic.
+ * If the Exchange is not one way it then receives the response and converts it to 
+ * a CXF Message. This is then provided in the Exchange and also sent to the IncomingObserver.
  */
 public class JMSConduit extends AbstractConduit implements JMSExchangeSender, MessageListener
{
 
@@ -102,7 +103,7 @@ public class JMSConduit extends AbstractConduit implements JMSExchangeSender,
Me
     private synchronized void getJMSListener(Destination replyTo) {
         if (jmsListener == null) {
             jmsListener = JMSFactory
-                .createSimpleJmsListener(jmsConfig, connection, this, replyTo, conduitId);
+                .createListenerContainer(jmsConfig, connection, this, replyTo, conduitId);
             addBusListener();
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFactory.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFactory.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFactory.java
index 05e4f89..c549fa4 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFactory.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFactory.java
@@ -31,9 +31,7 @@ import javax.naming.Context;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
-import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.jms.uri.JMSEndpoint;
 import org.apache.cxf.transport.jms.util.JMSDestinationResolver;
 import org.apache.cxf.transport.jms.util.JndiHelper;
@@ -138,27 +136,6 @@ public final class JMSConfigFactory {
         }
     }
 
-    public static <T> T getWSDLExtensor(EndpointInfo ei, Class<T> cls) {
-        ServiceInfo si = ei.getService();
-        BindingInfo bi = ei.getBinding();
-        
-        Object o = ei.getExtensor(cls);
-        if (o == null && si != null) {
-            o = si.getExtensor(cls);
-        }
-        if (o == null && bi != null) {
-            o = bi.getExtensor(cls);
-        }
-        
-        if (o == null) {
-            return null;
-        }
-        if (cls.isInstance(o)) {
-            return cls.cast(o);
-        }
-        return null;
-    }
-    
     public static Properties getInitialContextEnv(JMSEndpoint endpoint) {
         Properties env = new Properties();
         if (endpoint.getJndiInitialContextFactory() != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
index d1199dc..15e27b6 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
@@ -85,10 +85,8 @@ public class JMSConfiguration {
     private String requestURI;
 
     public void ensureProperlyConfigured() {
-        if (connectionFactory == null) {
-            connectionFactory = JMSFactory.getConnectionFactoryFromJndi(this);
-        }
-        if (connectionFactory == null) {
+        ConnectionFactory cf = getConnectionFactory();
+        if (cf == null) {
             throw new IllegalArgumentException("connectionFactory may not be null");
         }
         if (targetDestination == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
index b976b50..f73c64a 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
@@ -159,7 +159,7 @@ public class JMSDestination extends AbstractMultiplexDestination
         } catch (UnsupportedEncodingException ex) {
             getLogger().log(Level.WARNING, "can't get the right encoding information. " +
ex);
         } catch (JMSException e) {
-            JMSUtil.convertJmsException(e);
+            throw JMSUtil.convertJmsException(e);
         } finally {
             if (origBus != bus) {
                 BusFactory.setThreadDefaultBus(origBus);

http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
index b0c6b61..2d9f407 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
@@ -47,8 +47,7 @@ public final class JMSFactory {
     }
 
     /**
-     * Retrieve connection factory from jndi, wrap it in a UserCredentialsConnectionFactoryAdapter,
-     * set username and password and return the ConnectionFactory
+     * Retrieve connection factory from JNDI
      * 
      * @param jmsConfig
      * @param jndiConfig
@@ -68,11 +67,11 @@ public final class JMSFactory {
     }
     
     /**
-     * Create JmsTemplate from configuration information. Most settings are taken from jmsConfig.
The QoS
-     * settings in headers override the settings from jmsConfig
+     * Create JmsSender from configuration information. Most settings are taken from jmsConfig.
The QoS
+     * settings in messageProperties override the settings from jmsConfig
      * 
      * @param jmsConfig configuration information
-     * @param messageProperties context headers
+     * @param messageProperties context headers override config settings
      * @return
      */
     public static JMSSender createJmsSender(JMSConfiguration jmsConfig,
@@ -91,89 +90,6 @@ public final class JMSFactory {
         return sender;
     }
 
-    /**
-     * Create and start listener using configuration information from jmsConfig. Uses
-     * resolveOrCreateDestination to determine the destination for the listener.
-     * 
-     * @param ei the EndpointInfo for the listener
-     * @param jmsConfig configuration information
-     * @param listenerHandler object to be called when a message arrives
-     * @param destination to listen on
-     * @return
-     */
-    /*
-    protected static JMSListenerContainer createJmsListener(EndpointInfo ei,
-                                                                    JMSConfiguration jmsConfig,
-                                                                    MessageListener listenerHandler,
-                                                                    Destination destination)
{
-        
-        DefaultMessageListenerContainer jmsListener = null;
-        
-        //Check to see if transport is being used in JCA RA with XA
-        Method method = ei.getProperty(MDB_TRANSACTED_METHOD,
-                                       java.lang.reflect.Method.class);
-        MessageEndpointFactory factory = ei.getProperty(MESSAGE_ENDPOINT_FACTORY, 
-                                      MessageEndpointFactory.class);
-        if (method != null 
-            && jmsConfig.getConnectionFactory() instanceof XAConnectionFactory) {
-            jmsListener = new JCATransactionalMessageListenerContainer(factory, method);

-        } else {
-            jmsListener = new DefaultMessageListenerContainer();
-        }
-        
-        jmsListener.setConcurrentConsumers(jmsConfig.getConcurrentConsumers());
-        jmsListener.setMaxConcurrentConsumers(jmsConfig.getMaxConcurrentConsumers());
-        
-        jmsListener.setPubSubNoLocal(jmsConfig.isPubSubNoLocal());
-        
-        jmsListener.setConnectionFactory(jmsConfig.getConnectionFactory());
-        jmsListener.setSubscriptionDurable(jmsConfig.isSubscriptionDurable());
-        jmsListener.setClientId(jmsConfig.getDurableSubscriptionClientId());
-        jmsListener.setDurableSubscriptionName(jmsConfig.getDurableSubscriptionName());
-        jmsListener.setSessionTransacted(jmsConfig.isSessionTransacted());
-        jmsListener.setTransactionManager(jmsConfig.getTransactionManager());
-        jmsListener.setMessageListener(listenerHandler);
-        if (listenerHandler instanceof JMSDestination) {
-            //timeout on server side?
-            if (jmsConfig.getServerReceiveTimeout() != null) {
-                jmsListener.setReceiveTimeout(jmsConfig.getServerReceiveTimeout());
-            }
-            jmsListener.setPubSubDomain(jmsConfig.isPubSubDomain());
-        } else {
-            if (jmsConfig.getReceiveTimeout() != null) {
-                jmsListener.setReceiveTimeout(jmsConfig.getReceiveTimeout());
-            }
-            jmsListener.setPubSubDomain(jmsConfig.isReplyPubSubDomain());
-        }
-        if (jmsConfig.getRecoveryInterval() != JMSConfiguration.DEFAULT_VALUE) {
-            jmsListener.setRecoveryInterval(jmsConfig.getRecoveryInterval());
-        }
-        if (jmsConfig.getCacheLevelName() != null && (jmsConfig.getCacheLevelName().trim().length()
> 0)) {
-            jmsListener.setCacheLevelName(jmsConfig.getCacheLevelName());
-        } else if (jmsConfig.getCacheLevel() != JMSConfiguration.DEFAULT_VALUE) {
-            jmsListener.setCacheLevel(jmsConfig.getCacheLevel());
-        }
-        if (jmsListener.getCacheLevel() >= DefaultMessageListenerContainer.CACHE_CONSUMER
-            && jmsConfig.getMaxSuspendedContinuations() > 0) {
-            LOG.info("maxSuspendedContinuations value will be ignored - "
-                     + ", please set cacheLevel to the value less than "
-                     + " org.springframework.jms.listener.DefaultMessageListenerContainer.CACHE_CONSUMER");
-        }
-        if (jmsConfig.isAcceptMessagesWhileStopping()) {
-            jmsListener.setAcceptMessagesWhileStopping(jmsConfig.isAcceptMessagesWhileStopping());
-        }
-        String messageSelector = getMessageSelector(jmsConfig, null);
-        jmsListener.setMessageSelector(messageSelector);
-        
-        jmsListener.setTaskExecutor(jmsConfig.getTaskExecutor());
-        
-        jmsListener.setDestination(destination);
-        jmsListener.initialize();
-        jmsListener.start();
-        return new SpringJMSListenerAdapter(jmsListener);
-    }
-    */
-
     private static String getMessageSelector(JMSConfiguration jmsConfig, String conduitId)
{
         String staticSelectorPrefix = jmsConfig.getConduitSelectorPrefix();
         String conduitIdSt = jmsConfig.isUseConduitIdSelector() && conduitId != null
? conduitId : "";
@@ -181,8 +97,9 @@ public final class JMSFactory {
         return correlationIdPrefix.isEmpty() ? null : "JMSCorrelationID LIKE '" + correlationIdPrefix
+ "%'";
     }
     
-    public static JMSListenerContainer createTargetDestinationListener(EndpointInfo ei, JMSConfiguration
jmsConfig,
-                                                               MessageListener listenerHandler)
{
+    public static JMSListenerContainer createTargetDestinationListener(EndpointInfo ei, 
+                                                                       JMSConfiguration jmsConfig,
+                                                                       MessageListener listenerHandler)
{
         Session session = null;
         try {
             Connection connection = createConnection(jmsConfig);
@@ -200,7 +117,7 @@ public final class JMSFactory {
         }
     }
 
-    public static JMSListenerContainer createSimpleJmsListener(JMSConfiguration jmsConfig,
+    public static JMSListenerContainer createListenerContainer(JMSConfiguration jmsConfig,
                                                                Connection connection,
                                                                MessageListener listenerHandler,

                                                                Destination destination,

http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointWSDLUtil.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointWSDLUtil.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointWSDLUtil.java
index c6c53ad..ba90a07 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointWSDLUtil.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpointWSDLUtil.java
@@ -43,6 +43,7 @@ public final class JMSEndpointWSDLUtil {
      * @param ei
      */
     static void retrieveWSDLInformation(JMSEndpoint endpoint, EndpointInfo ei) {
+        // TODO We could have more than one parameter
         JndiContextParameterType jndiContextParameterType = 
             getWSDLExtensor(ei, JndiContextParameterType.class);
         if (jndiContextParameterType != null) {
@@ -50,7 +51,6 @@ public final class JMSEndpointWSDLUtil {
                                       jndiContextParameterType.getValue().trim());
         }
         
-        
         JndiConnectionFactoryNameType jndiConnectionFactoryNameType 
             = getWSDLExtensor(ei, JndiConnectionFactoryNameType.class);
         if (jndiConnectionFactoryNameType != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java
deleted file mode 100644
index 9e7480e..0000000
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/ResolveEndpointFailedException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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 static final long serialVersionUID = -6624403816682681106L;
-    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;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/3353757e/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
index fe110bd..b46d9e6 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
@@ -23,6 +23,15 @@ import javax.xml.bind.JAXBException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.transport.jms.wsdl.DeliveryModeType;
+import org.apache.cxf.transport.jms.wsdl.JndiConnectionFactoryNameType;
+import org.apache.cxf.transport.jms.wsdl.JndiContextParameterType;
+import org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType;
+import org.apache.cxf.transport.jms.wsdl.JndiURLType;
+import org.apache.cxf.transport.jms.wsdl.PriorityType;
+import org.apache.cxf.transport.jms.wsdl.ReplyToNameType;
+import org.apache.cxf.transport.jms.wsdl.TimeToLiveType;
+import org.apache.cxf.transport.jms.wsdl.TopicReplyToNameType;
 import org.apache.cxf.wsdl.JAXBExtensionHelper;
 import org.apache.cxf.wsdl.WSDLExtensionLoader;
 import org.apache.cxf.wsdl.WSDLManager;
@@ -31,36 +40,33 @@ import org.apache.cxf.wsdl.WSDLManager;
  * 
  */
 @NoJSR250Annotations
-public final class JMSWSDLExtensionLoader implements WSDLExtensionLoader { 
-    
+public final class JMSWSDLExtensionLoader implements WSDLExtensionLoader {
+    private static final Class<?>[] EXTENSORS = new Class[] {
+        DeliveryModeType.class, 
+        JndiConnectionFactoryNameType.class, 
+        JndiContextParameterType.class,
+        JndiInitialContextFactoryType.class, 
+        JndiURLType.class, 
+        PriorityType.class, 
+        ReplyToNameType.class,
+        TimeToLiveType.class, 
+        TopicReplyToNameType.class
+    };
+
     public JMSWSDLExtensionLoader(Bus b) {
         WSDLManager manager = b.getExtension(WSDLManager.class);
-        Class<?>[] extensors = new Class[] {
-            org.apache.cxf.transport.jms.wsdl.JndiContextParameterType.class,
-            org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType.class,
-            org.apache.cxf.transport.jms.wsdl.JndiURLType.class,
-            org.apache.cxf.transport.jms.wsdl.DeliveryModeType.class,
-            org.apache.cxf.transport.jms.wsdl.PriorityType.class,
-            org.apache.cxf.transport.jms.wsdl.TimeToLiveType.class,
-            org.apache.cxf.transport.jms.wsdl.ReplyToNameType.class
-        };
-        
-        for (Class<?> extensor : extensors) {
-            createExtensor(manager, javax.wsdl.Binding.class, extensor);
-            createExtensor(manager, javax.wsdl.Port.class, extensor);
-            createExtensor(manager, javax.wsdl.Service.class, extensor);
+        for (Class<?> extensor : EXTENSORS) {
+            addExtensions(manager, javax.wsdl.Binding.class, extensor);
+            addExtensions(manager, javax.wsdl.Port.class, extensor);
+            addExtensions(manager, javax.wsdl.Service.class, extensor);
         }
     }
 
-    public void createExtensor(WSDLManager manager,
-                                Class<?> parentType,
-                                Class<?> elementType) {
+    public void addExtensions(WSDLManager manager, Class<?> parentType, Class<?>
elementType) {
         try {
-            JAXBExtensionHelper.addExtensions(manager.getExtensionRegistry(),
-                                              parentType, 
-                                              elementType);
+            JAXBExtensionHelper.addExtensions(manager.getExtensionRegistry(), parentType,
elementType);
         } catch (JAXBException e) {
-            //ignore, won't support XML
+            // ignore, won't support XML
         }
     }
 


Mime
View raw message