Merging changes from branch...

BATCH-1323: Modify skip/retry/no-rollback exception class configurations to allow for include/exclude
BATCH-1339: Move task-executor attribute up from <chunk/> to <tasklet/>
BATCH-1348: Allow inlining of reader/writer/processor into <chunk/>
BATCH-1357: Allow empty <listeners/>, <retry-listeners/>, and <streams/> lists
BATCH-1358: Move InfiniteLoopIncrementer into core, and rename it to RunIdIncrementer
BATCH-1367: Syntactic sugar for Item*Adapter in namespace
BATCH-1375: Give CompositeItemProcessor's and CompositeItemWriter's property the same name (delegates)
This commit is contained in:
dhgarrette
2009-08-23 15:17:20 +00:00
parent 9e8bdba83d
commit 8146e55503
72 changed files with 1168 additions and 902 deletions

View File

@@ -1,39 +0,0 @@
/*
* Copyright 2006-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.sample.common;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.JobParametersIncrementer;
/**
* @author Dave Syer
*
*/
public class InfiniteLoopIncrementer implements JobParametersIncrementer {
/**
* Increment the run.id parameter.
*/
public JobParameters getNext(JobParameters parameters) {
if (parameters==null || parameters.isEmpty()) {
return new JobParametersBuilder().addLong("run.id", 1L).toJobParameters();
}
long id = parameters.getLong("run.id",1L) + 1;
return new JobParametersBuilder().addLong("run.id", id).toJobParameters();
}
}

View File

@@ -25,7 +25,7 @@
<bean id="writer" class="org.springframework.batch.sample.common.InfiniteLoopWriter" />
<bean id="jobParametersIncrementer"
class="org.springframework.batch.sample.common.InfiniteLoopIncrementer"/>
class="org.springframework.batch.core.launch.support.RunIdIncrementer"/>
<aop:config>
<aop:aspect ref="eventAdvice">

View File

@@ -19,7 +19,7 @@
skip-limit="5"
commit-interval="3">
<skippable-exception-classes>
java.lang.RuntimeException
<include class="java.lang.RuntimeException"/>
</skippable-exception-classes>
</chunk>
</tasklet>

View File

@@ -34,7 +34,7 @@
<bean id="infiniteLoopJob" parent="simpleJob">
<property name="jobParametersIncrementer">
<bean class="org.springframework.batch.sample.common.InfiniteLoopIncrementer" />
<bean class="org.springframework.batch.core.launch.support.RunIdIncrementer" />
</property>
<property name="steps">
<!--bean id="step1" parent="taskletStep">

View File

@@ -16,12 +16,11 @@
</tasklet>
</step>
<step id="loading">
<tasklet>
<tasklet task-executor="taskExecutor">
<chunk reader="stagingReader"
processor="stagingProcessor"
writer="tradeWriter"
commit-interval="1"
task-executor="taskExecutor"/>
commit-interval="1"/>
</tasklet>
</step>
</job>

View File

@@ -12,7 +12,7 @@
commit-interval="1"
retry-limit="3">
<retryable-exception-classes>
java.lang.Exception
<include class="java.lang.Exception"/>
</retryable-exception-classes>
</chunk>
</tasklet>

View File

@@ -10,8 +10,8 @@
<chunk reader="fileItemReader" processor="tradeProcessor" writer="tradeWriter"
commit-interval="3" skip-limit="10">
<skippable-exception-classes>
org.springframework.batch.item.file.FlatFileParseException
org.springframework.batch.item.WriteFailedException
<include class="org.springframework.batch.item.file.FlatFileParseException"/>
<include class="org.springframework.batch.item.WriteFailedException"/>
</skippable-exception-classes>
</chunk>
</tasklet>
@@ -42,7 +42,7 @@
<tasklet>
<chunk writer="itemTrackingWriter">
<skippable-exception-classes merge="true">
org.springframework.batch.item.validator.ValidationException
<include class="org.springframework.batch.item.validator.ValidationException"/>
</skippable-exception-classes>
</chunk>
</tasklet>
@@ -55,7 +55,7 @@
<chunk reader="tradeSqlItemReader" processor="tradeProcessor" writer="dummyWriter"
commit-interval="2" skip-limit="10">
<skippable-exception-classes>
java.lang.RuntimeException
<include class="java.lang.RuntimeException"/>
</skippable-exception-classes>
</chunk>
</tasklet>
@@ -64,18 +64,20 @@
<step id="baseStep" abstract="true" xmlns="http://www.springframework.org/schema/batch">
<tasklet>
<listeners>
<listener class="org.springframework.batch.sample.common.SkipCheckingListener"/>
<listener ref="promotionListener"/>
<listener>
<bean class="org.springframework.batch.sample.common.SkipCheckingListener" xmlns="http://www.springframework.org/schema/beans" />
</listener>
<listener>
<bean class="org.springframework.batch.core.listener.ExecutionContextPromotionListener" xmlns="http://www.springframework.org/schema/beans">
<property name="keys" value="stepName"/>
</bean>
</listener>
</listeners>
</tasklet>
</step>
<bean id="dummyWriter" class="org.springframework.batch.sample.support.DummyItemWriter"/>
<bean id="promotionListener" class="org.springframework.batch.core.listener.ExecutionContextPromotionListener" scope="step">
<property name="keys" value="stepName"/>
</bean>
<bean id="fileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">
<property name="resource" value="classpath:/data/skipJob/input/input#{jobParameters[run.id]}.txt" />
<property name="lineMapper">
@@ -108,6 +110,6 @@
<bean id="skipCheckingDecider" class="org.springframework.batch.sample.common.SkipCheckingDecider"/>
<bean id="incrementer" class="org.springframework.batch.sample.common.InfiniteLoopIncrementer"/>
<bean id="incrementer" class="org.springframework.batch.core.launch.support.RunIdIncrementer"/>
</beans>