camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [05/10] camel git commit: CAMEL-9472: Add multi value to component docs
Date Mon, 04 Jan 2016 14:35:53 GMT
CAMEL-9472: Add multi value to component docs


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

Branch: refs/heads/camel-2.16.x
Commit: 07492688be9011c05caa6d94efe473ad563642de
Parents: 609c213
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Jan 4 14:09:33 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Jan 4 15:24:54 2016 +0100

----------------------------------------------------------------------
 .../camel/component/quartz/QuartzComponent.java | 15 ++++--
 .../camel/component/quartz/QuartzEndpoint.java  | 54 ++++++++++++++++++++
 2 files changed, 66 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/07492688/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
index 5aad713..38759c1 100644
--- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
+++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
@@ -94,7 +94,7 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList
         String path = ObjectHelper.after(u.getPath(), "/");
         String host = u.getHost();
         String cron = getAndRemoveParameter(parameters, "cron", String.class);
-        Boolean fireNow = getAndRemoveParameter(parameters, "fireNow", Boolean.class, Boolean.FALSE);
+        boolean fireNow = getAndRemoveParameter(parameters, "fireNow", Boolean.class, Boolean.FALSE);
         Integer startDelayedSeconds = getAndRemoveParameter(parameters, "startDelayedSeconds",
Integer.class);
         if (startDelayedSeconds != null) {
             if (scheduler.isStarted()) {
@@ -162,8 +162,17 @@ public class QuartzComponent extends UriEndpointComponent implements
StartupList
         answer.setGroupName(group);
         answer.setTimerName(name);
         answer.setCron(cron);
-
-        setProperties(answer.getJobDetail(), jobParameters);
+        answer.setFireNow(fireNow);
+        if (startDelayedSeconds != null) {
+            answer.setStartDelayedSeconds(startDelayedSeconds);
+        }
+        if (triggerParameters != null && !triggerParameters.isEmpty()) {
+            answer.setTriggerParameters(triggerParameters);
+        }
+        if (jobParameters != null && !jobParameters.isEmpty()) {
+            answer.setJobParameters(jobParameters);
+            setProperties(answer.getJobDetail(), jobParameters);
+        }
 
         // enrich job data map with trigger information
         if (cron != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/07492688/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
index fb569a1..cc0b7bd 100644
--- a/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
+++ b/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.quartz;
 
 import java.util.Date;
+import java.util.Map;
 
 import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
@@ -31,6 +32,7 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
 import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ServiceHelper;
 import org.quartz.JobDetail;
@@ -68,7 +70,15 @@ public class QuartzEndpoint extends DefaultEndpoint implements ShutdownableServi
     @UriParam
     private boolean pauseJob;
     @UriParam
+    private boolean fireNow;
+    @UriParam
+    private int startDelayedSeconds;
+    @UriParam
     private boolean usingFixedCamelContextName;
+    @UriParam(prefix = "trigger.", multiValue = true)
+    private Map<String, Object> triggerParameters;
+    @UriParam(prefix = "job.", multiValue = true)
+    private Map<String, Object> jobParameters;
 
     public QuartzEndpoint(final String endpointUri, final QuartzComponent component) {
         super(endpointUri, component);
@@ -284,6 +294,28 @@ public class QuartzEndpoint extends DefaultEndpoint implements ShutdownableServi
         this.pauseJob = pauseJob;
     }
 
+    public boolean isFireNow() {
+        return fireNow;
+    }
+
+    /**
+     * Whether to fire the scheduler asap when its started using the simple trigger (this
option does not support cron)
+     */
+    public void setFireNow(boolean fireNow) {
+        this.fireNow = fireNow;
+    }
+
+    public int getStartDelayedSeconds() {
+        return startDelayedSeconds;
+    }
+
+    /**
+     * Seconds to wait before starting the quartz scheduler.
+     */
+    public void setStartDelayedSeconds(int startDelayedSeconds) {
+        this.startDelayedSeconds = startDelayedSeconds;
+    }
+
     public boolean isUsingFixedCamelContextName() {
         return usingFixedCamelContextName;
     }
@@ -296,6 +328,28 @@ public class QuartzEndpoint extends DefaultEndpoint implements ShutdownableServi
         this.usingFixedCamelContextName = usingFixedCamelContextName;
     }
 
+    public Map<String, Object> getTriggerParameters() {
+        return triggerParameters;
+    }
+
+    /**
+     * To configure additional options on the trigger.
+     */
+    public void setTriggerParameters(Map<String, Object> triggerParameters) {
+        this.triggerParameters = triggerParameters;
+    }
+
+    public Map<String, Object> getJobParameters() {
+        return jobParameters;
+    }
+
+    /**
+     * To configure additional options on the job.
+     */
+    public void setJobParameters(Map<String, Object> jobParameters) {
+        this.jobParameters = jobParameters;
+    }
+
     // Implementation methods
     // -------------------------------------------------------------------------
 


Mime
View raw message