You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/09/18 10:07:24 UTC

[1/2] git commit: CAMEL-6763: Added configurePollingConsumer method to DefaultEndpont for componets to use when configuring the created polling consumer.

Updated Branches:
  refs/heads/camel-2.12.x c4cb3f5c3 -> 111ba6a6b


CAMEL-6763: Added configurePollingConsumer method to DefaultEndpont for componets to use when configuring the created polling consumer.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/111ba6a6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/111ba6a6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/111ba6a6

Branch: refs/heads/camel-2.12.x
Commit: 111ba6a6b00f76df5afd0b03938cc9b9e756309b
Parents: f284e5e
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Sep 18 10:04:44 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Sep 18 10:05:36 2013 +0200

----------------------------------------------------------------------
 .../org/apache/camel/impl/DefaultEndpoint.java  |  4 +++
 .../apache/camel/impl/ProcessorEndpoint.java    |  2 +-
 .../camel/impl/ScheduledPollEndpoint.java       | 32 +++++++++++++++++---
 .../camel/component/http/HttpEndpoint.java      |  2 +-
 .../camel/component/http4/HttpEndpoint.java     |  2 +-
 .../apache/camel/component/jms/JmsEndpoint.java |  2 +-
 .../component/jt400/Jt400DataQueueEndpoint.java | 20 +-----------
 7 files changed, 37 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/111ba6a6/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
index 3e8146a..b88d148 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
@@ -370,6 +370,10 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint
         }
     }
 
+    protected void configurePollingConsumer(PollingConsumer consumer) throws Exception {
+        configureConsumer(consumer);
+    }
+
     @Override
     protected void doStart() throws Exception {
         // noop

http://git-wip-us.apache.org/repos/asf/camel/blob/111ba6a6/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java
index 231ecb6..0d05878 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ProcessorEndpoint.java
@@ -76,7 +76,7 @@ public class ProcessorEndpoint extends DefaultPollingEndpoint {
     @Override
     public PollingConsumer createPollingConsumer() throws Exception {
         PollingConsumer answer = new ProcessorPollingConsumer(this, getProcessor());
-        configureConsumer(answer);
+        configurePollingConsumer(answer);
         return answer;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/111ba6a6/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
index cc63ddc..57595b1 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollEndpoint.java
@@ -21,6 +21,9 @@ import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
+import org.apache.camel.PollingConsumer;
+import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.IntrospectionSupport;
 
 /**
@@ -74,7 +77,7 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
         Object backoffIdleThreshold  = options.remove("backoffIdleThreshold");
         Object backoffErrorThreshold  = options.remove("backoffErrorThreshold");
         boolean setConsumerProperties = false;
-        
+
         // the following is split into two if statements to satisfy the checkstyle max complexity constraint
         if (initialDelay != null || delay != null || timeUnit != null || useFixedDelay != null || pollStrategy != null) {
             setConsumerProperties = true;
@@ -85,9 +88,9 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
         if (scheduler != null || !schedulerProperties.isEmpty() || backoffMultiplier != null || backoffIdleThreshold != null || backoffErrorThreshold != null) {
             setConsumerProperties = true;
         }
-        
+
         if (setConsumerProperties) {
-        
+
             if (consumerProperties == null) {
                 consumerProperties = new HashMap<String, Object>();
             }
@@ -154,5 +157,26 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
             }
         }
     }
-    
+
+    @Override
+    protected void configurePollingConsumer(PollingConsumer consumer) throws Exception {
+        Map<String, Object> copy = new HashMap<String, Object>(getConsumerProperties());
+        Map<String, Object> throwaway = new HashMap<String, Object>();
+
+        // filter out unwanted options which is intended for the scheduled poll consumer
+        // as these options are not supported on the polling consumer
+        configureScheduledPollConsumerProperties(copy, throwaway);
+
+        // set reference properties first as they use # syntax that fools the regular properties setter
+        EndpointHelper.setReferenceProperties(getCamelContext(), consumer, copy);
+        EndpointHelper.setProperties(getCamelContext(), consumer, copy);
+
+        if (!isLenientProperties() && copy.size() > 0) {
+            throw new ResolveEndpointFailedException(this.getEndpointUri(), "There are " + copy.size()
+                    + " parameters that couldn't be set on the endpoint polling consumer."
+                    + " Check the uri if the parameters are spelt correctly and that they are properties of the endpoint."
+                    + " Unknown consumer parameters=[" + copy + "]");
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/111ba6a6/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
index 79d88d9..29cfd17 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
@@ -96,7 +96,7 @@ public class HttpEndpoint extends DefaultPollingEndpoint implements HeaderFilter
 
     public PollingConsumer createPollingConsumer() throws Exception {
         HttpPollingConsumer answer = new HttpPollingConsumer(this);
-        configureConsumer(answer);
+        configurePollingConsumer(answer);
         return answer;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/111ba6a6/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
index 20ef282..06bc133 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
@@ -103,7 +103,7 @@ public class HttpEndpoint extends DefaultPollingEndpoint implements HeaderFilter
 
     public PollingConsumer createPollingConsumer() throws Exception {
         HttpPollingConsumer answer = new HttpPollingConsumer(this);
-        configureConsumer(answer);
+        configurePollingConsumer(answer);
         return answer;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/111ba6a6/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
index 322ca6b..a8110af 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
@@ -263,7 +263,7 @@ public class JmsEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
     public PollingConsumer createPollingConsumer() throws Exception {
         JmsOperations template = createInOnlyTemplate();
         JmsPollingConsumer answer = new JmsPollingConsumer(this, template);
-        configureConsumer(answer);
+        configurePollingConsumer(answer);
         return answer;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/111ba6a6/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java
index b9b5797..51b4d89 100644
--- a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java
+++ b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java
@@ -147,25 +147,7 @@ public class Jt400DataQueueEndpoint extends DefaultPollingEndpoint {
     @Override
     public PollingConsumer createPollingConsumer() throws Exception {
         Jt400DataQueueConsumer answer = new Jt400DataQueueConsumer(this);
-
-        Map<String, Object> copy = new HashMap<String, Object>(getConsumerProperties());
-        Map<String, Object> throwaway = new HashMap<String, Object>();
-
-        // filter out unwanted options which is intended for the scheduled poll consumer
-        // as these options are not supported on Jt400DataQueueConsumer
-        configureScheduledPollConsumerProperties(copy, throwaway);
-
-        // set reference properties first as they use # syntax that fools the regular properties setter
-        EndpointHelper.setReferenceProperties(getCamelContext(), this, copy);
-        EndpointHelper.setProperties(getCamelContext(), this, copy);
-
-        if (!isLenientProperties() && copy.size() > 0) {
-            throw new ResolveEndpointFailedException(this.getEndpointUri(), "There are " + copy.size()
-                    + " parameters that couldn't be set on the endpoint consumer."
-                    + " Check the uri if the parameters are spelt correctly and that they are properties of the endpoint."
-                    + " Unknown consumer parameters=[" + copy + "]");
-        }
-
+        configurePollingConsumer(answer);
         return answer;
     }
 


[2/2] git commit: Polished

Posted by da...@apache.org.
Polished


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

Branch: refs/heads/camel-2.12.x
Commit: f284e5eeef5f9d0aae94c68ca80e5a56a58d1521
Parents: c4cb3f5
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Sep 18 09:57:18 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Sep 18 10:05:36 2013 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/atom/AtomPollingConsumer.java  | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f284e5ee/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java
index 0bf75c9..1631aca 100644
--- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java
+++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java
@@ -36,9 +36,7 @@ public class AtomPollingConsumer extends FeedPollingConsumer {
 
     @Override
     protected Object createFeed() throws IOException {
-
         Document<Feed> document = AtomUtils.parseDocument(endpoint.getFeedUri());
         return document.getRoot();
-
     }
 }