cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r702873 - in /cxf/branches/2.1.x-fixes: ./ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/
Date Wed, 08 Oct 2008 13:39:43 GMT
Author: dkulp
Date: Wed Oct  8 06:39:42 2008
New Revision: 702873

URL: http://svn.apache.org/viewvc?rev=702873&view=rev
Log:
Merged revisions 702656 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r702656 | cschneider | 2008-10-07 18:17:25 -0400 (Tue, 07 Oct 2008) | 1 line
  
  Added Configuration Exceptions when JMSConduit, JMSDestination or JMSConfigFeature are not
configured properly.
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
    cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct  8 06:39:42 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=702873&r1=702872&r2=702873&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Wed Oct  8 06:39:42 2008
@@ -33,9 +33,11 @@
 import javax.jms.Session;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.ConfigurationException;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractConduit;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.springframework.jms.core.JmsTemplate;
@@ -52,14 +54,15 @@
 public class JMSConduit extends AbstractConduit implements JMSExchangeSender, MessageListener
{
     static final Logger LOG = LogUtils.getL7dLogger(JMSConduit.class);
 
+    private EndpointInfo endpointInfo;
     private JMSConfiguration jmsConfig;
     private Map<String, Message> correlationMap;
-
     private DefaultMessageListenerContainer jmsListener;
 
-    public JMSConduit(EndpointReferenceType target, JMSConfiguration jmsConfig) {
+    public JMSConduit(EndpointInfo endpointInfo, EndpointReferenceType target, JMSConfiguration
jmsConfig) {
         super(target);
         this.jmsConfig = jmsConfig;
+        this.endpointInfo = endpointInfo;
         correlationMap = new ConcurrentHashMap<String, Message>();
     }
 
@@ -70,10 +73,9 @@
      */
     public void prepare(Message message) throws IOException {
         if (jmsConfig.getTargetDestination() == null || jmsConfig.getConnectionFactory()
== null) {
-            String name =  ".jms-conduit";
-            throw new RuntimeException("Insufficient configuration for Conduit. "
-                                       + "Did you configure a <jms:conduit name=\"" +
name
-                                       + "\"> and set the jndiConnectionFactoryName ?");
+            String name =  endpointInfo.getName().toString() + ".jms-conduit";
+            throw new ConfigurationException(
+                new org.apache.cxf.common.i18n.Message("INSUFFICIENT_CONFIGURATION_CONDUIT",
LOG, name));
         }
         boolean isTextPayload = JMSConstants.TEXT_MESSAGE_TYPE.equals(jmsConfig.getMessageType());
         JMSOutputStream out = new JMSOutputStream(this, message.getExchange(), isTextPayload);

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java?rev=702873&r1=702872&r2=702873&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
Wed Oct  8 06:39:42 2008
@@ -18,7 +18,12 @@
  */
 package org.apache.cxf.transport.jms;
 
+import java.util.logging.Logger;
+
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.ConfigurationException;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
@@ -32,28 +37,34 @@
  * configuration that is generated from the old configuration style.
  */
 public class JMSConfigFeature extends AbstractFeature {
+    static final Logger LOG = LogUtils.getL7dLogger(JMSConfigFeature.class);
+
     JMSConfiguration jmsConfig;
 
     @Override
     public void initialize(Client client, Bus bus) {
+        checkJmsConfig();
         Conduit conduit = client.getConduit();
-        if (conduit instanceof JMSConduit && jmsConfig != null) {
-            JMSConduit jmsConduit = (JMSConduit)conduit;
-            jmsConduit.setJmsConfig(jmsConfig);
+        if (!(conduit instanceof JMSConduit)) {
+            throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
         }
+        JMSConduit jmsConduit = (JMSConduit)conduit;
+        jmsConduit.setJmsConfig(jmsConfig);
         super.initialize(client, bus);
     }
 
     @Override
     public void initialize(Server server, Bus bus) {
+        checkJmsConfig();
         Destination destination = server.getDestination();
-        if (destination instanceof JMSDestination && jmsConfig != null) {
-            JMSDestination jmsConduit = (JMSDestination)destination;
-            jmsConduit.setJmsConfig(jmsConfig);
+        if (!(destination instanceof JMSDestination)) {
+            throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
         }
+        JMSDestination jmsDestination = (JMSDestination)destination;
+        jmsDestination.setJmsConfig(jmsConfig);
         super.initialize(server, bus);
     }
-    
+
     public JMSConfiguration getJmsConfig() {
         return jmsConfig;
     }
@@ -63,4 +74,9 @@
         this.jmsConfig = jmsConfig;
     }
 
+    private void checkJmsConfig() {
+        if (jmsConfig == null) {
+            throw new ConfigurationException(new Message("JMSCONFIG_REQUIRED", LOG));
+        }
+    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=702873&r1=702872&r2=702873&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Wed Oct  8 06:39:42 2008
@@ -42,6 +42,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.ConfigurationException;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -91,12 +92,10 @@
         getLogger().log(Level.INFO, "JMSDestination activate().... ");
         String name = endpointInfo.getName().toString() + ".jms-destination";
         if (jmsConfig.getTargetDestination() == null || jmsConfig.getConnectionFactory()
== null) {
-            throw new RuntimeException("Insufficient configuration for Destination. "
-                                       + "Did you configure a <jms:destination name=\""
+ name
-                                       + "\"> and set the jndiConnectionFactoryName ?");
+            throw new ConfigurationException(
+                new org.apache.cxf.common.i18n.Message("INSUFFICIENT_CONFIGURATION_DESTINATION",
LOG, name));
         }
         jmsListener = JMSFactory.createJmsListener(jmsConfig, this, jmsConfig.getTargetDestination());
-        jmsConfig.getTargetDestination();
     }
 
     public void deactivate() {

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java?rev=702873&r1=702872&r2=702873&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
Wed Oct  8 06:39:42 2008
@@ -63,7 +63,7 @@
     public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws
IOException {
         JMSOldConfigHolder old = new JMSOldConfigHolder();
         JMSConfiguration jmsConf = old.createJMSConfigurationFromEndpointInfo(bus, endpointInfo,
true);
-        return new JMSConduit(target, jmsConf);
+        return new JMSConduit(endpointInfo, target, jmsConf);
     }
 
     /**

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties?rev=702873&r1=702872&r2=702873&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
Wed Oct  8 06:39:42 2008
@@ -19,3 +19,7 @@
 #
 #
 DISPATCH_FAILURE_MSG = Dispatch of incoming JMS request failed
+INSUFFICIENT_CONFIGURATION_CONDUIT = Insufficient configuration for Conduit. Did you configure
a <jms:conduit name=\"{0}\"> and set the jndiConnectionFactoryName ?
+INSUFFICIENT_CONFIGURATION_DESTINATION = Insufficient configuration for Destination. Did
you configure a <jms:destination name=\"{0}\"> and set the jndiConnectionFactoryName
?
+JMSCONFIGFEATURE_ONLY_JMS = You can only use JMSConfigFeature with the jms transport
+JMSCONFIG_REQUIRED = You have to set the property jmsConfig
\ No newline at end of file

Modified: cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java?rev=702873&r1=702872&r2=702873&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
Wed Oct  8 06:39:42 2008
@@ -114,7 +114,7 @@
         
         JMSConfiguration jmsConfig = new JMSOldConfigHolder()
             .createJMSConfigurationFromEndpointInfo(bus, endpointInfo, true);
-        JMSConduit jmsConduit = new JMSConduit(target, jmsConfig);
+        JMSConduit jmsConduit = new JMSConduit(endpointInfo, target, jmsConfig);
         if (send) {
             // setMessageObserver
             observer = new MessageObserver() {



Mime
View raw message