OPEN - issue BATCH-927: Add JobParametersIncrementer to job namespace element
http://jira.springframework.org/browse/BATCH-927 Added support for JobParametersIncrementer to Job element.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -39,6 +39,15 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="incrementer" type="xsd:string"
|
||||
use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
A reference to a JobParametersIncrementer bean definition.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="restartable" type="xsd:boolean"
|
||||
default="false" use="optional">
|
||||
<xsd:annotation>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<beans:import resource="common-context.xml" />
|
||||
|
||||
<job id="job">
|
||||
<job id="job" incrementer="testIncrementer">
|
||||
<step name="step1">
|
||||
<simple-task tasklet="tasklet"/>
|
||||
</step>
|
||||
@@ -18,4 +18,6 @@
|
||||
<beans:bean id="tasklet" class="org.springframework.batch.core.configuration.xml.TestTasklet"/>
|
||||
|
||||
<beans:bean id="testListener" class="org.springframework.batch.core.configuration.xml.TestJobListener" />
|
||||
|
||||
<beans:bean id="testIncrementer" class="org.springframework.batch.core.configuration.xml.TestIncrementer" />
|
||||
</beans:beans>
|
||||
Reference in New Issue
Block a user