camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1066208 - in /camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms: JmsComponent.java JmsHelper.java JmsPollingConsumer.java
Date Tue, 01 Feb 2011 21:13:59 GMT
Author: cmueller
Date: Tue Feb  1 21:13:57 2011
New Revision: 1066208

URL: http://svn.apache.org/viewvc?rev=1066208&view=rev
Log:
CAMEL-3573: In some places we use ObjectHelper.loadClass() instead of ClassResolver.resolveClass()

Modified:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHelper.java
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java?rev=1066208&r1=1066207&r2=1066208&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
Tue Feb  1 21:13:57 2011
@@ -483,12 +483,12 @@ public class JmsComponent extends Defaul
         // lets try instantiate the default implementation
         // use the class loading this class from camel-jms to work in OSGi environments as
the camel-jms
         // should import the spring-jms jars.
-        if (JmsHelper.isSpring20x()) {
+        if (JmsHelper.isSpring20x(context)) {
             // not possible with spring 2.0.x
             return null;
         } else {
             // lets try instantiate the default implementation
-            Class<?> type = ObjectHelper.loadClass(DEFAULT_QUEUE_BROWSE_STRATEGY, JmsComponent.class.getClassLoader());
+            Class<?> type = context.getClassResolver().resolveClass(DEFAULT_QUEUE_BROWSE_STRATEGY,
JmsComponent.class.getClassLoader());
             if (type != null) {
                 return ObjectHelper.newInstance(type, QueueBrowseStrategy.class);
             } else {
@@ -496,5 +496,4 @@ public class JmsComponent extends Defaul
             }
         }
     }
-
 }

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHelper.java?rev=1066208&r1=1066207&r2=1066208&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHelper.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHelper.java
Tue Feb  1 21:13:57 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.jms;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.util.ObjectHelper;
 
 /**
@@ -34,9 +35,15 @@ public final class JmsHelper {
      *
      * @return <tt>true</tt> if 2.0.x or <tt>false</tt> if newer
such as 2.5.x
      */
-    public static boolean isSpring20x() {
+    public static boolean isSpring20x(CamelContext context) {
         // this class is only possible to instantiate in 2.5.x or newer
-        Class<?> type = ObjectHelper.loadClass(DEFAULT_QUEUE_BROWSE_STRATEGY, JmsComponent.class.getClassLoader());
+        Class<?> type = null;
+        if (context != null) {
+            type = context.getClassResolver().resolveClass(DEFAULT_QUEUE_BROWSE_STRATEGY,
JmsComponent.class.getClassLoader());
+        } else {
+            type = ObjectHelper.loadClass(DEFAULT_QUEUE_BROWSE_STRATEGY, JmsComponent.class.getClassLoader());
+        }
+        
         if (type != null) {
             try {
                 ObjectHelper.newInstance(type);
@@ -48,5 +55,4 @@ public final class JmsHelper {
             return true;
         }
     }
-
 }

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java?rev=1066208&r1=1066207&r2=1066208&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsPollingConsumer.java
Tue Feb  1 21:13:57 2011
@@ -35,7 +35,7 @@ public class JmsPollingConsumer extends 
         super(endpoint);
         this.jmsEndpoint = endpoint;
         this.template = template;
-        this.spring20x = JmsHelper.isSpring20x();
+        this.spring20x = JmsHelper.isSpring20x(endpoint != null ? endpoint.getCamelContext()
: null);
     }
 
     @Override



Mime
View raw message