BATCH-63: renamed <task> and <chunk> to <simple-task> and <process-task>
This commit is contained in:
@@ -70,16 +70,16 @@ public class StepParser {
|
||||
String stepRef = element.getAttribute("name");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Element> taskElements = (List<Element>) DomUtils.getChildElementsByTagName(element, "task");
|
||||
List<Element> simpleTaskElements = (List<Element>) DomUtils.getChildElementsByTagName(element, "simple-task");
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Element> chunkElements = (List<Element>) DomUtils.getChildElementsByTagName(element, "chunk");
|
||||
if (taskElements.size() > 0) {
|
||||
Object task = parseTask(taskElements.get(0), parserContext);
|
||||
List<Element> processTaskElements = (List<Element>) DomUtils.getChildElementsByTagName(element, "process-task");
|
||||
if (simpleTaskElements.size() > 0) {
|
||||
Object task = parseSimpleTask(simpleTaskElements.get(0), parserContext);
|
||||
stateBuilder.addConstructorArgValue(stepRef);
|
||||
stateBuilder.addConstructorArgValue(task);
|
||||
}
|
||||
else if (chunkElements.size() > 0) {
|
||||
Object task = parseChunk(chunkElements.get(0), parserContext);
|
||||
else if (processTaskElements.size() > 0) {
|
||||
Object task = parseProcessTask(processTaskElements.get(0), parserContext);
|
||||
stateBuilder.addConstructorArgValue(stepRef);
|
||||
stateBuilder.addConstructorArgValue(task);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class StepParser {
|
||||
* @param parserContext
|
||||
* @return the TaskletStep bean
|
||||
*/
|
||||
protected RootBeanDefinition parseChunk(Element element, ParserContext parserContext) {
|
||||
protected RootBeanDefinition parseProcessTask(Element element, ParserContext parserContext) {
|
||||
|
||||
RootBeanDefinition bd;
|
||||
|
||||
@@ -237,7 +237,7 @@ public class StepParser {
|
||||
RuntimeBeanReference tx = new RuntimeBeanReference(transactionManager);
|
||||
bd.getPropertyValues().addPropertyValue("transactionManager", tx);
|
||||
|
||||
String commitInterval = element.getAttribute("chunk-size");
|
||||
String commitInterval = element.getAttribute("commit-interval");
|
||||
if (StringUtils.hasText(commitInterval)) {
|
||||
bd.getPropertyValues().addPropertyValue("commitInterval", commitInterval);
|
||||
}
|
||||
@@ -374,7 +374,7 @@ public class StepParser {
|
||||
* @param parserContext
|
||||
* @return the TaskletStep bean
|
||||
*/
|
||||
protected RootBeanDefinition parseTask(Element element, ParserContext parserContext) {
|
||||
protected RootBeanDefinition parseSimpleTask(Element element, ParserContext parserContext) {
|
||||
|
||||
RootBeanDefinition bd = new RootBeanDefinition("org.springframework.batch.core.step.tasklet.TaskletStep", null, null);
|
||||
|
||||
|
||||
@@ -202,20 +202,8 @@
|
||||
<xsd:extension base="nextType">
|
||||
<xsd:sequence>
|
||||
<xsd:choice>
|
||||
<xsd:element name="chunk" minOccurs="0" maxOccurs="1">
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="chunkType"/>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="task" minOccurs="0" maxOccurs="1">
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="taskType"/>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="process-task" type="processTaskType" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element name="simple-task" type="simpleTaskType" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:choice>
|
||||
<xsd:group ref="transitions"/>
|
||||
</xsd:sequence>
|
||||
@@ -232,7 +220,7 @@
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="taskType">
|
||||
<xsd:complexType name="simpleTaskType">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="stepDefType">
|
||||
<xsd:attribute name="tasklet" type="xsd:string" use="required">
|
||||
@@ -246,7 +234,7 @@
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="chunkType">
|
||||
<xsd:complexType name="processTaskType">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="stepDefType">
|
||||
<xsd:sequence>
|
||||
@@ -259,13 +247,20 @@
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="listener" minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="id" type="xsd:ID"/>
|
||||
<xsd:attribute name="ref" type="xsd:string"/>
|
||||
<xsd:attribute name="class" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="listener" type="listenerType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="retryListeners" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
List of all listeners for the step definition
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="listener" type="listenerType" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
@@ -286,6 +281,18 @@
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="transaction-attributes" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The transaction attributes to be used for the transaction used during the execution
|
||||
of the task within the step.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
<xsd:element name="skippable-exception-classes" minOccurs="0" maxOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
@@ -320,7 +327,7 @@
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="chunk-size" type="xsd:integer" use="required">
|
||||
<xsd:attribute name="commit-interval" type="xsd:integer" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The number of items that will be processed before commit is called for the transaction.
|
||||
@@ -370,6 +377,35 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="cache-capacity" type="xsd:integer" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The capacity of the cache in the retry policy.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="is-reader-transactional-queue" type="xsd:boolean" default="false" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Whether the reader is a transactional queue. If it is then items read should not be cached
|
||||
in the event of a rollback since they will be returned to the queue.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="task-executor" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="java:org.springframework.core.task.TaskExecutor"><![CDATA[
|
||||
The task executor responsible for executing the task..
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.core.task.TaskExecutor" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
@@ -397,6 +433,18 @@
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="listenerType">
|
||||
<xsd:attribute name="id" type="xsd:ID"/>
|
||||
<xsd:attribute name="ref" type="xsd:string"/>
|
||||
<xsd:attribute name="class" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="jobExecutionListenerType">
|
||||
<xsd:attribute name="before-method" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="after-method" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="ref" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:group name="transitions">
|
||||
<xsd:sequence>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
|
||||
@@ -510,7 +558,7 @@
|
||||
if the bean name of the desired TransactionManager is not 'transactionManager'.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
`<tool:annotation kind="ref">
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type
|
||||
type="org.springframework.transaction.PlatformTransactionManager" />
|
||||
</tool:annotation>
|
||||
@@ -519,10 +567,4 @@
|
||||
</xsd:attribute>
|
||||
</xsd:attributeGroup>
|
||||
|
||||
|
||||
<xsd:complexType name="jobExecutionListenerType">
|
||||
<xsd:attribute name="before-method" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="after-method" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="ref" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
@@ -44,7 +44,7 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class StepWithSimpleChunkJobParserTests {
|
||||
public class StepWithBasicProcessTaskJobParserTests {
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
@@ -26,7 +26,6 @@ import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
@@ -45,7 +44,7 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class StepWithFaultTolerantChunkJobParserTests {
|
||||
public class StepWithFaultTolerantProcessTaskJobParserTests {
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
@@ -39,7 +39,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class StepWithTaskJobParserTests {
|
||||
public class StepWithSimpleTaskJobParserTests {
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<job id="job">
|
||||
<step name="step1">
|
||||
<task tasklet="tasklet"/>
|
||||
<simple-task tasklet="tasklet"/>
|
||||
</step>
|
||||
<listeners>
|
||||
<listener after-method="afterJob" ref="testListener"/>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
<job id="job">
|
||||
<step name="ft-step">
|
||||
<chunk reader="reader" processor="processor" writer="writer"
|
||||
fault-tolerant="false" chunk-size="10">
|
||||
<process-task reader="reader" processor="processor" writer="writer"
|
||||
fault-tolerant="false" commit-interval="10">
|
||||
<listeners>
|
||||
<listener class="org.springframework.batch.core.configuration.xml.TestListener"/>
|
||||
<listener ref="listener"/>
|
||||
@@ -17,7 +17,7 @@
|
||||
<streams>
|
||||
<stream ref="reader"/>
|
||||
</streams>
|
||||
</chunk>
|
||||
</process-task>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
<job id="job">
|
||||
<step name="ft-step">
|
||||
<chunk reader="reader" processor="processor" writer="writer"
|
||||
fault-tolerant="true" chunk-size="10" skip-limit="20" retry-limit="3">
|
||||
<process-task reader="reader" processor="processor" writer="writer"
|
||||
fault-tolerant="true" commit-interval="10" skip-limit="20" retry-limit="3">
|
||||
<listeners>
|
||||
<listener class="org.springframework.batch.core.configuration.xml.TestListener"/>
|
||||
<listener ref="listener"/>
|
||||
@@ -17,7 +17,7 @@
|
||||
<streams>
|
||||
<stream ref="reader"/>
|
||||
</streams>
|
||||
</chunk>
|
||||
</process-task>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
<job id="job">
|
||||
<step name="step1">
|
||||
<task tasklet="tasklet"/>
|
||||
<simple-task tasklet="tasklet"/>
|
||||
<next on="*" to="step2" />
|
||||
</step>
|
||||
<step name="step2">
|
||||
<task tasklet="tasklet"/>
|
||||
<simple-task tasklet="tasklet"/>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
Reference in New Issue
Block a user