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 2019/08/22 06:15:33 UTC
[camel] 07/07: CAMEL-13870: Fast property configuration of Camel
endpoints. Work in progress.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1a47f95ae800c607a6c0eb787b34f6ad6b46f4d8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 08:15:11 2019 +0200
CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
.../camel/support/ScheduledPollEndpoint.java | 45 ++++++++++++----------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
index d465eb1..f9a846c 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java
@@ -112,28 +112,31 @@ public abstract class ScheduledPollEndpoint extends DefaultEndpoint {
setSchedulerProperties(schedulerProperties);
}
- if ("spring".equals(scheduler)) {
- // special for scheduler if its "spring" or "quartz"
- try {
- Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(SPRING_SCHEDULER, ScheduledPollConsumerScheduler.class);
- consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("Cannot load " + SPRING_SCHEDULER + " from classpath. Make sure camel-spring.jar is on the classpath.", e);
+ String schedulerName = (String) options.get("scheduler");
+ if (schedulerName != null) {
+ if ("spring".equals(schedulerName)) {
+ // special for scheduler if its "spring" or "quartz"
+ try {
+ Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(SPRING_SCHEDULER, ScheduledPollConsumerScheduler.class);
+ consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("Cannot load " + SPRING_SCHEDULER + " from classpath. Make sure camel-spring.jar is on the classpath.", e);
+ }
+ } else if ("quartz".equals(schedulerName)) {
+ // special for scheduler if its "spring" or "quartz"
+ try {
+ Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(QUARTZ_SCHEDULER, ScheduledPollConsumerScheduler.class);
+ consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("Cannot load " + QUARTZ_SCHEDULER + " from classpath. Make sure camel-quartz.jar is on the classpath.", e);
+ }
+ } else if (!"none".equals(schedulerName)) {
+ // must refer to a custom scheduler by the given name
+ if (EndpointHelper.isReferenceParameter(schedulerName)) {
+ schedulerName = schedulerName.substring(1);
+ }
+ consumerScheduler = CamelContextHelper.mandatoryLookup(getCamelContext(), schedulerName, ScheduledPollConsumerScheduler.class);
}
- } else if ("quartz".equals(scheduler)) {
- // special for scheduler if its "spring" or "quartz"
- try {
- Class<? extends ScheduledPollConsumerScheduler> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(QUARTZ_SCHEDULER, ScheduledPollConsumerScheduler.class);
- consumerScheduler = getCamelContext().getInjector().newInstance(clazz);
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("Cannot load " + QUARTZ_SCHEDULER + " from classpath. Make sure camel-quartz.jar is on the classpath.", e);
- }
- } else if (!"none".equals(scheduler)) {
- // must refer to a custom scheduler by the given name
- if (EndpointHelper.isReferenceParameter(scheduler)) {
- scheduler = scheduler.substring(1);
- }
- consumerScheduler = CamelContextHelper.mandatoryLookup(getCamelContext(), scheduler, ScheduledPollConsumerScheduler.class);
}
}