From 59494813c2c2118e449d397b117969aa8f094a77 Mon Sep 17 00:00:00 2001 From: lucasward Date: Mon, 17 Nov 2008 19:08:55 +0000 Subject: [PATCH] OPEN - issue BATCH-927: Add JobParametersIncrementer to job namespace element http://jira.springframework.org/browse/BATCH-927 Added support for JobParametersIncrementer to Job element. --- .../batch/core/configuration/xml/JobParser.java | 5 +++++ .../core/configuration/xml/spring-batch-2.0.xsd | 9 +++++++++ .../core/configuration/xml/TestIncrementer.java | 13 +++++++++++++ .../xml/JobExecutionListenerParserTests-context.xml | 4 +++- 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java index 3579562be..8e59c28ff 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/JobParser.java @@ -60,6 +60,11 @@ public class JobParser extends AbstractBeanDefinitionParser { if (StringUtils.hasText(restartableAttribute)) { builder.addPropertyValue("restartable", restartableAttribute); } + + String incrementer = (element.getAttribute("incrementer")); + if(StringUtils.hasText(incrementer)){ + builder.addPropertyReference("jobParametersIncrementer", incrementer); + } FlowParser flowParser = new FlowParser(); AbstractBeanDefinition flowDef = flowParser.parse(element, parserContext, jobName); diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd index ad7297f13..0053e5f0d 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/configuration/xml/spring-batch-2.0.xsd @@ -39,6 +39,15 @@ + + + + + + diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java new file mode 100644 index 000000000..bb665dfb2 --- /dev/null +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/TestIncrementer.java @@ -0,0 +1,13 @@ +package org.springframework.batch.core.configuration.xml; + +import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.JobParametersIncrementer; + +public class TestIncrementer implements JobParametersIncrementer{ + + public JobParameters getNext(JobParameters parameters) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerParserTests-context.xml index aa36a113c..069f2470e 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerParserTests-context.xml @@ -6,7 +6,7 @@ - + @@ -18,4 +18,6 @@ + + \ No newline at end of file