BATCH-1075: moved 'allow-start-if-complete' and 'start-limit' attributes to <step>

This commit is contained in:
trisberg
2009-02-13 16:08:36 +00:00
parent c308168e86
commit e463b6a96b
3 changed files with 32 additions and 27 deletions

View File

@@ -61,6 +61,8 @@ public abstract class AbstractStepParser {
bd.getPropertyValues().addPropertyValue("tasklet", taskletBeanRef);
}
checkStepAttributes(stepElement, bd);
RuntimeBeanReference jobRepositoryBeanRef = new RuntimeBeanReference(jobRepositoryRef);
bd.getPropertyValues().addPropertyValue("jobRepository", jobRepositoryBeanRef);
@@ -118,14 +120,7 @@ public abstract class AbstractStepParser {
}
// now, set the properties on the new bean
String startLimit = element.getAttribute("start-limit");
if (StringUtils.hasText(startLimit)) {
bd.getPropertyValues().addPropertyValue("startLimit", startLimit);
}
String allowStartIfComplete = element.getAttribute("allow-start-if-complete");
if (StringUtils.hasText(allowStartIfComplete)) {
bd.getPropertyValues().addPropertyValue("allowStartIfComplete", allowStartIfComplete);
}
checkStepAttributes(stepElement, bd);
String readerBeanId = element.getAttribute("reader");
if (StringUtils.hasText(readerBeanId)) {
@@ -206,6 +201,17 @@ public abstract class AbstractStepParser {
}
private void checkStepAttributes(Element element, RootBeanDefinition bd) {
String startLimit = element.getAttribute("start-limit");
if (StringUtils.hasText(startLimit)) {
bd.getPropertyValues().addPropertyValue("startLimit", startLimit);
}
String allowStartIfComplete = element.getAttribute("allow-start-if-complete");
if (StringUtils.hasText(allowStartIfComplete)) {
bd.getPropertyValues().addPropertyValue("allowStartIfComplete", allowStartIfComplete);
}
}
private boolean checkIntValueForFaultToleranceNeeded(String stringValue) {
if (StringUtils.hasText(stringValue)) {
int value = Integer.valueOf(stringValue);

View File

@@ -65,7 +65,7 @@
<xsd:extension base="stepType">
<xsd:attribute name="id" type="xsd:ID" use="required" />
<xsd:attributeGroup ref="jobRepositoryAttribute"/>
<xsd:attributeGroup ref="taskletAttribute"/>
<xsd:attributeGroup ref="stepAttributes"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -145,7 +145,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attributeGroup ref="taskletAttribute"/>
<xsd:attributeGroup ref="stepAttributes"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -384,20 +384,6 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="start-limit" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The maximum number of times a Step may be started.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="allow-start-if-complete" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
Set to true to allow a step to be started even if it is already complete.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="skip-limit" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
@@ -694,7 +680,7 @@
</xsd:attribute>
</xsd:attributeGroup>
<xsd:attributeGroup name="taskletAttribute">
<xsd:attributeGroup name="stepAttributes">
<xsd:attribute name="tasklet" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation>
@@ -707,6 +693,20 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="start-limit" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The maximum number of times a Step may be started.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="allow-start-if-complete" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
Set to true to allow a step to be started even if it is already complete.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:attributeGroup>
</xsd:schema>

View File

@@ -5,9 +5,8 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<job id="job">
<step id="step">
<step id="step" start-limit="25" allow-start-if-complete="true">
<tasklet reader="reader" processor="processor" writer="writer"
start-limit="25" allow-start-if-complete="true"
commit-interval="10" skip-limit="20"
retry-limit="3" cache-capacity="100"
transaction-attribute="PROPAGATION_REQUIRED,ISOLATION_DEFAULT,timeout_10,-org.springframework.dao.DataIntegrityViolationException"