camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [6/6] camel git commit: CAMEL-7999: More components include documentation
Date Sun, 04 Jan 2015 10:25:01 GMT
CAMEL-7999: More components include documentation


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

Branch: refs/heads/master
Commit: f8d29076595a43974aff282e59d07b1c82445c76
Parents: cc119b4
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Jan 4 11:24:17 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Jan 4 11:24:17 2015 +0100

----------------------------------------------------------------------
 .../spring/batch/SpringBatchComponent.java      | 15 +++++++-------
 .../spring/batch/SpringBatchEndpoint.java       | 21 ++++++++++++++++----
 2 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f8d29076/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
index bac2fb9..7e4a23c 100644
--- a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
+++ b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
@@ -19,25 +19,24 @@ package org.apache.camel.component.spring.batch;
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.util.CamelContextHelper;
-import org.springframework.batch.core.Job;
+import org.apache.camel.impl.UriEndpointComponent;
 import org.springframework.batch.core.launch.JobLauncher;
 
-public class SpringBatchComponent extends DefaultComponent {
+public class SpringBatchComponent extends UriEndpointComponent {
 
     private static final String DEFAULT_JOB_LAUNCHER_REF_NAME = "jobLauncher";
 
     private JobLauncher jobLauncher;
-
     private JobLauncher defaultResolvedJobLauncher;
-
     private Map<String, JobLauncher> allResolvedJobLaunchers;
 
+    public SpringBatchComponent() {
+        super(SpringBatchEndpoint.class);
+    }
+
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object>
parameters) throws Exception {
-        Job resolvedJob = CamelContextHelper.mandatoryLookup(getCamelContext(), remaining,
Job.class);
-        SpringBatchEndpoint endpoint = new SpringBatchEndpoint(uri, this, jobLauncher, defaultResolvedJobLauncher,
allResolvedJobLaunchers, resolvedJob);
+        SpringBatchEndpoint endpoint = new SpringBatchEndpoint(uri, this, jobLauncher, defaultResolvedJobLauncher,
allResolvedJobLaunchers, remaining);
         setProperties(endpoint, parameters);
         return endpoint;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/f8d29076/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
index dfe525f..e4ac38c 100644
--- a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
+++ b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
@@ -23,34 +23,44 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.CamelContextHelper;
 import org.springframework.batch.core.Job;
 import org.springframework.batch.core.launch.JobLauncher;
 
+@UriEndpoint(scheme = "spring-batch", label = "spring,batch,scheduling")
 public class SpringBatchEndpoint extends DefaultEndpoint {
 
+    @UriPath
+    private String jobName;
+
     /**
      * @deprecated will be removed in Camel 3.0
      * use jobLauncher instead
      */
+    @Deprecated
     private String jobLauncherRef;
 
+    @UriParam
     private JobLauncher jobLauncher;
 
+    @UriParam
     private JobLauncher defaultResolvedJobLauncher;
 
     private Map<String, JobLauncher> allResolvedJobLaunchers;
 
-    private final Job job;
+    private Job job;
 
     public SpringBatchEndpoint(String endpointUri, Component component,
                                JobLauncher jobLauncher, JobLauncher defaultResolvedJobLauncher,
-                               Map<String, JobLauncher> allResolvedJobLaunchers,
-                               Job job) {
+                               Map<String, JobLauncher> allResolvedJobLaunchers, String
jobName) {
         super(endpointUri, component);
         this.jobLauncher = jobLauncher;
         this.defaultResolvedJobLauncher = defaultResolvedJobLauncher;
         this.allResolvedJobLaunchers = allResolvedJobLaunchers;
-        this.job = job;
+        this.jobName = jobName;
     }
 
     @Override
@@ -73,6 +83,9 @@ public class SpringBatchEndpoint extends DefaultEndpoint {
         if (jobLauncher == null) {
             jobLauncher = resolveJobLauncher();
         }
+        if (job == null && jobName != null) {
+            job = CamelContextHelper.mandatoryLookup(getCamelContext(), jobName, Job.class);
+        }
     }
 
     private JobLauncher resolveJobLauncher() {


Mime
View raw message