camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r749562 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/impl/ components/camel-guice/src/main/java/org/apache/camel/guice/ components/camel-jms/src/test/java/org/apache/camel/component...
Date Tue, 03 Mar 2009 08:17:57 GMT
Author: davsclaus
Date: Tue Mar  3 08:17:56 2009
New Revision: 749562

URL: http://svn.apache.org/viewvc?rev=749562&view=rev
Log:
CAMEL-1369: Removed @MessageDriven as its replaced with @Consume.

Removed:
    camel/trunk/camel-core/src/main/java/org/apache/camel/MessageDriven.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
    camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModule.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/MyBeanBindingConsumer.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java?rev=749562&r1=749561&r2=749562&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/CamelPostProcessorHelper.java
Tue Mar  3 08:17:56 2009
@@ -25,7 +25,6 @@
 import org.apache.camel.Consume;
 import org.apache.camel.Consumer;
 import org.apache.camel.Endpoint;
-import org.apache.camel.MessageDriven;
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
@@ -67,12 +66,6 @@
     }
 
     public void consumerInjection(Method method, Object bean) {
-        MessageDriven annotation = method.getAnnotation(MessageDriven.class);
-        if (annotation != null) {
-            LOG.info("Creating a consumer for: " + annotation);
-            subscribeMethod(method, bean, annotation.uri(), annotation.name());
-        }
-
         Consume consume = method.getAnnotation(Consume.class);
         if (consume != null) {
             LOG.info("Creating a consumer for: " + consume);
@@ -87,8 +80,10 @@
         if (endpoint != null) {
             try {
                 Processor processor = createConsumerProcessor(bean, method, endpoint);
-                LOG.info("Created processor: " + processor);
                 Consumer consumer = endpoint.createConsumer(processor);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Created processor: " + processor + " for consumer: " + consumer);
+                }
                 startService(consumer);
             } catch (Exception e) {
                 throw ObjectHelper.wrapRuntimeCamelException(e);
@@ -145,7 +140,8 @@
                         throw createProxyInstantiationRuntimeException(type, endpoint, e);
                     }
                 } else {
-                    throw new IllegalArgumentException("Invalid type: " + type.getName()
+ " which cannot be injected via @EndpointInject for " + endpoint);
+                    throw new IllegalArgumentException("Invalid type: " + type.getName()
+                            + " which cannot be injected via @EndpointInject/@Produce for:
" + endpoint);
                 }
             }
             return null;
@@ -157,8 +153,7 @@
     }
 
     /**
-     * Factory method to create a started {@link org.apache.camel.PollingConsumer} to be
injected
-     * into a POJO
+     * Factory method to create a started {@link org.apache.camel.PollingConsumer} to be
injected into a POJO
      */
     protected PollingConsumer createInjectionPollingConsumer(Endpoint endpoint) {
         try {
@@ -171,8 +166,7 @@
     }
 
     /**
-     * A Factory method to create a started {@link org.apache.camel.Producer} to be injected
into
-     * a POJO
+     * A Factory method to create a started {@link org.apache.camel.Producer} to be injected
into a POJO
      */
     protected Producer createInjectionProducer(Endpoint endpoint) {
         try {

Modified: camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModule.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModule.java?rev=749562&r1=749561&r2=749562&view=diff
==============================================================================
--- camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModule.java
(original)
+++ camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModule.java
Tue Mar  3 08:17:56 2009
@@ -20,7 +20,6 @@
 import com.google.inject.matcher.Matchers;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Consume;
-import org.apache.camel.MessageDriven;
 import org.apache.camel.Routes;
 import org.apache.camel.guice.impl.ConsumerInjection;
 import org.apache.camel.guice.impl.EndpointInjector;
@@ -58,8 +57,6 @@
         ConsumerInjection consumerInjection = new ConsumerInjection();
         requestInjection(consumerInjection);
 
-
-        bindConstructorInterceptor(Matchers.methodAnnotatedWith(MessageDriven.class), consumerInjection);
         bindConstructorInterceptor(Matchers.methodAnnotatedWith(Consume.class), consumerInjection);
     }
 

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java?rev=749562&r1=749561&r2=749562&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java
Tue Mar  3 08:17:56 2009
@@ -18,9 +18,9 @@
 
 import java.util.Map;
 
+import org.apache.camel.Consume;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Headers;
-import org.apache.camel.MessageDriven;
 import org.apache.camel.ProducerTemplate;
 
 /**
@@ -32,7 +32,7 @@
     @EndpointInject(uri = "mock:result")
     private ProducerTemplate producer;
 
-    @MessageDriven(uri = "activemq:Test.BindingQueue")
+    @Consume(uri = "activemq:Test.BindingQueue")
     public void myMethod(@Headers Map headers, String body) {
         this.headers = headers;
         this.body = body;

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?rev=749562&r1=749561&r2=749562&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
(original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
Tue Mar  3 08:17:56 2009
@@ -43,11 +43,11 @@
 
 /**
  * A bean post processor which implements the <a href="http://camel.apache.org/bean-integration.html">Bean
Integration</a>
- * features in Camel such as the <a href="http://camel.apache.org/bean-injection.html">Bean
Injection</a> of objects like
+ * features in Camel. Features such as the <a href="http://camel.apache.org/bean-injection.html">Bean
Injection</a> of objects like
  * {@link Endpoint} and
  * {@link org.apache.camel.ProducerTemplate} together with support for
  * <a href="http://camel.apache.org/pojo-consuming.html">POJO Consuming</a> via
the
- * {@link org.apache.camel.Consume} and {@link org.apache.camel.MessageDriven} annotations
along with
+ * {@link org.apache.camel.Consume} annotation along with
  * <a href="http://camel.apache.org/pojo-producing.html">POJO Producing</a> via
the
  * {@link org.apache.camel.Produce} annotation along with other annotations such as
  * {@link org.apache.camel.RecipientList} for creating <a href="http://camel.apache.org/recipientlist-annotation.html">a
Recipient List router via annotations</a>.
@@ -177,32 +177,6 @@
         }
     }
 
-
-    protected void consumerInjection(final Object bean) {
-        org.springframework.util.ReflectionUtils.doWithMethods(bean.getClass(), new org.springframework.util.ReflectionUtils.MethodCallback()
{
-            @SuppressWarnings("unchecked")
-            public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException
{
-                /*
-                 * TODO support callbacks? if
-                 * (method.getAnnotation(Callback.class) != null) { try {
-                 * Expression e = ExpressionFactory.createExpression(
-                 * method.getAnnotation(Callback.class).condition());
-                 * JexlContext jc = JexlHelper.createContext();
-                 * jc.getVars().put("this", obj); Object r = e.evaluate(jc); if
-                 * (!(r instanceof Boolean)) { throw new
-                 * RuntimeException("Expression did not returned a boolean value
-                 * but: " + r); } Boolean oldVal =
-                 * req.getCallbacks().get(method); Boolean newVal = (Boolean) r;
-                 * if ((oldVal == null || !oldVal) && newVal) {
-                 * req.getCallbacks().put(method, newVal); method.invoke(obj,
-                 * new Object[0]); // TODO: handle return value and sent it as
-                 * the answer } } catch (Exception e) { throw new
-                 * RuntimeException("Unable to invoke callback", e); } }
-                 */
-            }
-        });
-    }
-
     public CamelPostProcessorHelper getPostProcessor() {
         ObjectHelper.notNull(postProcessor, "postProcessor");
         return postProcessor;

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/MyBeanBindingConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/MyBeanBindingConsumer.java?rev=749562&r1=749561&r2=749562&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/MyBeanBindingConsumer.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/MyBeanBindingConsumer.java
Tue Mar  3 08:17:56 2009
@@ -16,8 +16,8 @@
  */
 package org.apache.camel.component.bean;
 
+import org.apache.camel.Consume;
 import org.apache.camel.Header;
-import org.apache.camel.MessageDriven;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.language.Bean;
 import org.apache.camel.language.Constant;
@@ -29,22 +29,22 @@
 
     private ProducerTemplate template;
 
-    @MessageDriven(uri = "direct:startBeanExpression")
+    @Consume(uri = "direct:startBeanExpression")
     public void doSomethingBeanExpression(String payload, @Bean("myCounter") int count) {
         template.sendBodyAndHeader("mock:result", "Bye " + payload, "count", count);
     }
 
-    @MessageDriven(uri = "direct:startConstantExpression")
+    @Consume(uri = "direct:startConstantExpression")
     public void doSomethingConstantExpression(String payload, @Constant("5") int count) {
         template.sendBodyAndHeader("mock:result", "Bye " + payload, "count", count);
     }
 
-    @MessageDriven(uri = "direct:startHeaderExpression")
+    @Consume(uri = "direct:startHeaderExpression")
     public void doSomethingHeaderExpression(String payload, @Header("number") int count)
{
         template.sendBodyAndHeader("mock:result", "Bye " + payload, "count", count);
     }
 
-    @MessageDriven(uri = "direct:startMany")
+    @Consume(uri = "direct:startMany")
     public void doSomethingManyExpression(String payload, @Constant("5") int count, @Header("number")
int number) {
         template.sendBodyAndHeader("mock:result", "Bye " + payload, "count", count * number);
     }

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java?rev=749562&r1=749561&r2=749562&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/RouterBean.java
Tue Mar  3 08:17:56 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.camel.component.bean;
 
-import org.apache.camel.MessageDriven;
+import org.apache.camel.Consume;
 import org.apache.camel.RecipientList;
 
 /**
@@ -27,7 +27,7 @@
  */
 public class RouterBean {
 
-    @MessageDriven(uri = "direct:start")
+    @Consume(uri = "direct:start")
     @RecipientList
     public String[] route(String body) {
         System.out.println("RouteBean called with body: " + body);

Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java?rev=749562&r1=749561&r2=749562&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java
(original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java
Tue Mar  3 08:17:56 2009
@@ -16,8 +16,8 @@
  */
 package org.apache.camel.spring.example;
 
+import org.apache.camel.Consume;
 import org.apache.camel.EndpointInject;
-import org.apache.camel.MessageDriven;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
@@ -33,7 +33,7 @@
     @EndpointInject(uri = "mock:result")
     private ProducerTemplate destination;
 
-    @MessageDriven(uri = "direct:start")
+    @Consume(uri = "direct:start")
     public void doSomething(String body) {
         ObjectHelper.notNull(destination, "destination");
 



Mime
View raw message