cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r702900 - in /cxf/branches/2.0.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 15:00:19 GMT
Author: dkulp
Date: Wed Oct  8 08:00:18 2008
New Revision: 702900

URL: http://svn.apache.org/viewvc?rev=702900&view=rev
Log:
Merged revisions 702873 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes

................
  r702873 | dkulp | 2008-10-08 09:39:42 -0400 (Wed, 08 Oct 2008) | 9 lines
  
  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.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
    cxf/branches/2.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct  8 08:00:18 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870
-/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873
+/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656
 /incubator/cxf/trunk:434594-651668

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

Modified: cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=702900&r1=702899&r2=702900&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Wed Oct  8 08:00:18 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.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java?rev=702900&r1=702899&r2=702900&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfigFeature.java
Wed Oct  8 08:00:18 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.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=702900&r1=702899&r2=702900&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Wed Oct  8 08:00:18 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.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java?rev=702900&r1=702899&r2=702900&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
Wed Oct  8 08:00:18 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.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties?rev=702900&r1=702899&r2=702900&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/Messages.properties
Wed Oct  8 08:00:18 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.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java?rev=702900&r1=702899&r2=702900&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
Wed Oct  8 08:00:18 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