[BUILD-63] <job-repository/> and <tasklet-step/> complete.

This commit is contained in:
nebhale
2008-02-22 13:32:33 +00:00
parent 455bfe2fab
commit ca5bf67556
9 changed files with 150 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.0.3.v200801241658]]></pluginVersion>
<pluginVersion><![CDATA[2.0.4.v200802132100]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
@@ -16,7 +16,19 @@
<config>src/test/resources/beanRefContext.xml</config>
<config>src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml</config>
<config>src/test/resources/org/springframework/batch/execution/bootstrap/support/test-environment.xml</config>
<config>src/test/java/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepOk.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDb2.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryDerby.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryHsql.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMissingDataSource.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryMySql.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOk.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryOracle.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerJobRepositoryPostgres.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepMissingTasklet.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepOk.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunAlways.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunIncomplete.xml</config>
<config>src/test/resources/org/springframework/batch/execution/configuration/BatchNamespaceHandlerTaskletStepRerunNever.xml</config>
</configs>
<configSets>
<configSet>

View File

@@ -73,6 +73,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.execution.configuration;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
@@ -6,19 +22,23 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* <code>NamespaceHandler</code> for the <code>batch-execution</code> namespace.
*
* <p>Provides a {@link BeanDefinitionParser} for the <code>&lt;batch:job&gt;</code> tag. A <code>job</code>
* tag can include nested <code>chunked-step</code> and <code>tasklet-step</code> tags.
* <p>
* Provides a {@link BeanDefinitionParser} for the <code>&lt;batch:job&gt;</code> tag. A <code>job</code> tag can
* include nested <code>chunked-step</code> and <code>tasklet-step</code> tags.
*
* <p>
* Provides a {@link BeanDefinitionParser} for the <code>&lt;batch:job-repository&gt;</code> tag.
*
* @author Ben Hale
*/
public class BatchNamespaceHandler extends NamespaceHandlerSupport {
/**
* Register the {@link BeanDefinitionParser BeanDefinitionParser} for the
* '<code>job</code>', tag.
* Register the {@link BeanDefinitionParser BeanDefinitionParser} for the '<code>job</code>', tag.
*/
public void init() {
registerBeanDefinitionParser("job", new JobBeanDefinitionParser());
registerBeanDefinitionParser("job-repository", new JobRepositoryBeanDefinitionParser());
}
}

View File

@@ -4,6 +4,34 @@
targetNamespace="http://www.springframework.org/schema/batch"
elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<xs:element name="job-repository">
<xs:annotation>
<xs:documentation><![CDATA[Defines a repository for storing and retrieving metadata for jobs and steps.]]></xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="data-source" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The datasource to use to back this repository.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="db-type" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The type of database this job repository will be communicating with.]]></xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="db2"/>
<xs:enumeration value="derby"/>
<xs:enumeration value="hsql"/>
<xs:enumeration value="mysql"/>
<xs:enumeration value="oracle"/>
<xs:enumeration value="postgres"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="job">
<xs:annotation>
<xs:documentation><![CDATA[Defines a uniquely identified job that is referenced at runtime.]]></xs:documentation>
@@ -21,7 +49,7 @@
</xs:annotation>
</xs:element>
</xs:choice>
<xs:attribute name="id" type="xs:string" use="required">
<xs:attribute name="id" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The unique identifier to use in this step. The id must be unique within the context of this job.]]></xs:documentation>
</xs:annotation>
@@ -31,7 +59,7 @@
<!-- Types -->
<xs:complexType name="chunkStepType">
<xs:attribute name="id" type="xs:string" use="required">
<xs:attribute name="id" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The unique identifier to use in this step. The id must be unique within the context of this job.]]></xs:documentation>
</xs:annotation>
@@ -41,17 +69,17 @@
<xs:documentation><![CDATA[The number of elements to be processed per chunk. This must be a number greater than 0.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="item-reader" type="xs:string" use="required">
<xs:attribute name="item-reader" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The id of the ItemReader implementation to read from in this step]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="item-writer" type="xs:string" use="required">
<xs:attribute name="item-writer" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The id of the ItemWriter implementation to write to in this step]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="transaction-manager" type="xs:string" use="optional"
<xs:attribute name="transaction-manager" type="xs:token" use="optional"
default="transaction-manager">
<xs:annotation>
<xs:documentation><![CDATA[The id of the transaction manager to use in this step. This should be an implementation of Spring's PlatformTransactionManager.]]></xs:documentation>
@@ -71,12 +99,12 @@
</xs:complexType>
<xs:complexType name="taskletStepType">
<xs:attribute name="id" type="xs:string" use="required">
<xs:attribute name="id" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The unique identifier to use in this step. The id must be unique within the context of this job.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="tasklet" type="xs:string" use="required">
<xs:attribute name="tasklet" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The id of the Tasklet implementation to execute in this step.]]></xs:documentation>
</xs:annotation>

View File

@@ -5,8 +5,13 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet=""/>
</job>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -5,10 +5,16 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
<beans:bean id="processorTasklet" class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -0,0 +1,20 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet" rerun="always"/>
</job>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -0,0 +1,20 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet" rerun="incomplete"/>
</job>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -0,0 +1,20 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet" rerun="never"/>
</job>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>