CAMEL-8826 Added timezone parameter to CronSchedulerRoutePolicy
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/adfbaf63 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/adfbaf63 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/adfbaf63 Branch: refs/heads/master Commit: adfbaf635a6179ecbfaeafd3a92df0a54c9ce9bb Parents: 10fd60a Author: Willem Jiang <[email protected]> Authored: Wed Jun 3 23:03:21 2015 +0800 Committer: Willem Jiang <[email protected]> Committed: Wed Jun 3 23:03:48 2015 +0800 ---------------------------------------------------------------------- .../quartz/CronScheduledRoutePolicy.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/adfbaf63/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/CronScheduledRoutePolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/CronScheduledRoutePolicy.java b/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/CronScheduledRoutePolicy.java index 32161d8..6c0ac42 100644 --- a/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/CronScheduledRoutePolicy.java +++ b/components/camel-quartz/src/main/java/org/apache/camel/routepolicy/quartz/CronScheduledRoutePolicy.java @@ -16,6 +16,7 @@ */ package org.apache.camel.routepolicy.quartz; +import java.util.TimeZone; import java.util.concurrent.TimeUnit; import org.apache.camel.Route; @@ -29,6 +30,8 @@ public class CronScheduledRoutePolicy extends ScheduledRoutePolicy implements Sc private String routeStopTime; private String routeSuspendTime; private String routeResumeTime; + private String timeZoneString; + private TimeZone timeZone; public void onInit(Route route) { try { @@ -87,7 +90,10 @@ public class CronScheduledRoutePolicy extends ScheduledRoutePolicy implements Sc } else if (action == Action.RESUME) { trigger = new CronTrigger(TRIGGER_RESUME + route.getId(), TRIGGER_GROUP + route.getId(), getRouteResumeTime()); } - + // Just reset the time zone once the timeZone parameter is set + if (timeZone != null) { + trigger.setTimeZone(timeZone); + } return trigger; } @@ -121,6 +127,15 @@ public class CronScheduledRoutePolicy extends ScheduledRoutePolicy implements Sc public String getRouteResumeTime() { return routeResumeTime; + } + + public String getTimeZone() { + return timeZoneString; + } + + public void setTimeZone(String timeZone) { + this.timeZoneString = timeZone; + this.timeZone = TimeZone.getTimeZone(timeZone); } }
