diff --git a/archetypes/simple-cli/src/main/resources/META-INF/MANIFEST.MF b/archetypes/simple-cli/src/main/resources/META-INF/MANIFEST.MF
index 14a9a40fa..570a67a5c 100644
--- a/archetypes/simple-cli/src/main/resources/META-INF/MANIFEST.MF
+++ b/archetypes/simple-cli/src/main/resources/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ Export-Package: example;version="2.0.0.CI-SNAPSHOT";uses:="org.springf
Bundle-Classpath: .
Bundle-Version: 2.0.0.CI-SNAPSHOT
Built-By: dsyer
-Build-Jdk: 1.6.0_03
+Build-Jdk: 1.6.0_10
Bundle-Name: Spring Batch Cammand Line Archetype
Bundle-ManifestVersion: 2
Created-By: Apache Maven
diff --git a/docs/src/site/docbook/reference/job.xml b/docs/src/site/docbook/reference/job.xml
index e3c6db573..36b13e988 100644
--- a/docs/src/site/docbook/reference/job.xml
+++ b/docs/src/site/docbook/reference/job.xml
@@ -353,7 +353,7 @@
+ width="66%" />
@@ -375,7 +375,7 @@
+ width="66%" />
@@ -590,7 +590,7 @@
-
@@ -614,7 +614,7 @@
+ width="65%" />
diff --git a/docs/src/site/docbook/reference/step.xml b/docs/src/site/docbook/reference/step.xml
index 4d9eeb42d..138b0f7aa 100644
--- a/docs/src/site/docbook/reference/step.xml
+++ b/docs/src/site/docbook/reference/step.xml
@@ -56,16 +56,16 @@
Below is a code representation of the same concepts shown
above:
-
+
+]]>
Configuring a Step
@@ -75,14 +75,14 @@
potentially contain many collaborators. In order to ease configuration,
the Spring Batch namespace can be used:
-
- <job id="sampleJob">
- <step id="step1" job-repository="jobRepository" transaction-manager="transactionManager">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="10"/>
- </step>
- </job>
+
+
+
+
+
-
+]]>
The configuration above represents the only required dependencies
to create a item-oriented step:
@@ -133,16 +133,16 @@
reference it from multiple jobs. This can be achieved with the 'ref'
attribute:
-
- <job id="sampleJob">
- <step id="step1" ref="standaloneStep" />
- </job>
+
+ ref="standaloneStep"
+
- <step id="standaloneStep" job-repository="jobRepository" transaction-manager="transactionManager">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="10"/>
- </step>
+
+
+
-
+]]>
It should be noted that the id attribute is still required on the
step within the job element. This is for two reasons:
@@ -177,15 +177,15 @@
number of items that are processed within a commit can be
configured.
-
- <job id="sampleJob">
- <step id="step1" job-repository="jobRepository" transaction-manager="transactionManager">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="10"/>
- </step>
- </job>
+
+
+ commit-interval="10"
+
+
-
+]]>
In the example above, 10 items will be processed within each
transaction. At the beginning of processing a transaction is begun, and
@@ -217,13 +217,13 @@
as a Step that can be run infinitely. Below is
an example start limit configuration:
-
- <step id="step1">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="10" start-limit="1"/>
- </step>
+
+ start-limit="1"
+
-
+]]>
The simple step above can be run only once. Attempting to run it
again will cause an exception to be thrown. It should be noted that
@@ -243,35 +243,35 @@
successfully, will be skipped. Setting allow-start-if-complete to
"true" overrides this so that the step will always run:
-
- <step id="step1">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="10"
- allow-start-if-complete="true"/>
- </step>
+
+ allow-start-if-complete="true"
+
-
+]]>
Step restart configuration example
-
- <job id="footballJob" restartable="true">
- <step id="playerload" next="gameLoad">
- <tasklet reader="playerFileItemReader" writer="playerWriter"
- commit-interval="10" />
- </step>
- <step id="gameLoad" next="playerSummarization">
- <tasklet reader="gameFileItemReader" writer="gameWriter"
- commit-interval="10" allow-start-if-complete="true"/>
- </step>
- <step id="playerSummarization">
- <tasklet reader="playerSummarizationSource" writer="summaryWriter"
- commit-interval="10" start-limit="3"/>
- </step>
- </job>
+
+
+
+
+
+
+
+
+
+
+
-
+]]>
The above example configuration is for a job that loads in
information about football games and summarizes them. It contains
@@ -384,17 +384,17 @@
loaded because it was formatted incorrectly or was missing necessary
information, then there probably won't be issues. Usually these bad
records are logged as well, which will be covered later when discussing
- listeners.
- <step id="step1">
- <tasklet reader="flatFileItemReader" writer="itemWriter" commit-interval="10" skip-limit="10">
- <skippable-exception-classes>
+ listeners.
+ skip-limit="10"
+ ]]><skippable-exception-classes>
org.springframework.batch.item.file.FlatFileParseException
- </skippable-exception-classes>
- </tasklet>
- </step>
+ </skippable-exception-classes>
+
-
+]]>
In this example, a FlatFileItemReader is
used, and if at any point a
@@ -411,20 +411,20 @@
Job to fail. In certain scenarios this may be the
correct behavior. However, in other scenarios it may be easier to
identify which exceptions should cause failure and skip everything
- else:
- <step id="step1">
- <tasklet reader="flatFileItemReader" writer="itemWriter" commit-interval="10" skip-limit="10">
- <skippable-exception-classes>
+ else:
+ skip-limit="10"
+]]> <skippable-exception-classes>
java.lang.Exception
</skippable-exception-classes>
<fatal-exception-classes>
java.io.FileNotFoundException
</fatal-exception-classes>
- </tasklet>
- </step>
+
+
-
+]]>
By setting the skippable exceptions to
java.lang.Exception, any exception that is thrown
@@ -446,17 +446,17 @@
process holds a lock on, waiting and trying again might result in
success. In this case, retry should be configured:
-
- <step id="step1">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="2" retry-limit="3">
- <retryable-exception-classes>
+
+ retry-limit="3"
+ ]]><retryable-exception-classes>
org.springframework.dao.DeadlockLoserDataAccessException
- </retryable-exception-classes>
- </tasklet>
- </step>
+ </retryable-exception-classes>
+
-
+]]>
The Step allows a limit for the number of
times an individual item can be retried, and a list of exceptions that
@@ -481,14 +481,14 @@
symbol will indicate that that exception should not cause
rollback.
-
- <step id="step1">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="2" skip-limit="1"
- transaction-attribute="+org.springframework.batch.item.validator.ValidationException">
- </tasklet>
- </step>
+
+ transaction-attribute="+org.springframework.batch.item.validator.ValidationException"
+
+
-
+]]>
Transaction attributes can be used to control multiple other
settings such as isolation and propagation behavior. More information on
@@ -508,14 +508,14 @@
this reason, the step can be configured to not buffer the
items:
-
- <step id="step1">
- <tasklet reader="itemReader" writer="itemWriter" commit-interval="2" skip-limit="1"
- is-reader-transactional-queue="true">
- </tasklet>
- </step>
+
+ is-reader-transactional-queue="true"
+
+
-
+]]>
@@ -540,27 +540,27 @@
can be registered on the Step through the
'streams' element, as illustrated below:
-
- <step id="step1">
- <tasklet reader="itemReader" writer="compositeWriter" commit-interval="2">
- <streams>
+
+
+ ]]><streams>
<stream ref="fileItemWriter1"/>
<stream ref="fileItemWriter2"/>
- </streams>
- </tasklet>
- </step>
+ </streams>
+
- <beans:bean id="compositeWriter"
- class="org.springframework.batch.item.support.CompositeItemWriter">
- <beans:property name="delegates">
- <beans:list>
- <beans:ref bean="fileItemWriter1" />
- <beans:ref bean="fileItemWriter2" />
- </beans:list>
- </beans:property>
- </beans:bean>
+
+
+
+
+
+
+
+
-
+]]>
In the example above, the
CompositeItemWriter is not an
@@ -590,15 +590,15 @@
interface (or an extension thereof) can be applied to a step via the
listeners element:
-
- <step id="step1">
- <tasklet reader="reader" writer="writer" commit-interval="10"/>
- <listeners>
- <listener ref="stepListener"/>
- </listeners>
- </step>
+
+
+
+
+
+
-
+]]>
In addition to the StepListener interfaces,
annotations are provided to address the same concerns.
@@ -611,7 +611,7 @@
for notification before a Step is started and
after it has ends, whether it ended normally or failed:
-
+
+]]>
ExitStatus is the return type of
afterStep in order to allow listeners the
@@ -648,12 +648,12 @@
useful to perform logic before a chunk begins processing or after a
chunk has completed:
- public interface ChunkListener extends StepListener {
+
+ }]]>
The beforeChunk method is called after
the transaction is started, but before read
@@ -682,14 +682,14 @@
When discussing skip logic above, it was mentioned that it may
be beneficial to log out skipped records, so that they can be deal
with later. In the case of read errors, this can be done with an
- ItemReaderListener: public interface ItemReadListener<T> extends StepListener {
+ ItemReaderListener: extends StepListener {
void beforeRead();
void afterRead(T item);
void onReadError(Exception ex);
-}
+}]]>
The beforeRead method will be called
before each call to read on the
@@ -724,14 +724,14 @@
Just as with the ItemReadListener, the
processing of an item can be 'listened' to:
- public interface ItemProcessListener<T, S> extends StepListener {
+ extends StepListener {
void beforeProcess(T item);
void afterProcess(T item, S result);
void onProcessError(T item, Exception e);
-}
+}]]>
The beforeProcess method will be called
before process on the
@@ -766,14 +766,14 @@
The writing of an item can be 'listened' to with the
ItemWriteListener:
- public interface ItemWriteListener<S> extends StepListener {
+ extends StepListener {
- void beforeWrite(List<? extends S> items);
+ void beforeWrite(List extends S> items);
- void afterWrite(List<? extends S> items);
+ void afterWrite(List extends S> items);
- void onWriteError(Exception exception, List<? extends S> items);
-}
+ void onWriteError(Exception exception, List extends S> items);
+}]]>
The beforeWrite method will be called
before write on the
@@ -813,8 +813,8 @@
this reason, there is a separate interface for tracking skipped
items:
-
- public interface SkipListener<T,S> extends StepListener {
+ extends StepListener {
void onSkipInRead(Throwable t);
@@ -823,7 +823,7 @@
void onSkipInWrite(S item, Throwable t);
}
-
+]]>
onSkipInRead will be called whenever an
item is skipped while reading. It should be noted that rollbacks may
@@ -899,10 +899,10 @@
Tasklet object; no 'tasklet' element is needed
within the 'step':
-
- <step id="step1" tasklet="myTasklet" />
+ tasklet="myTasklet"
-
+]]>
TaskletStep will automatically register the
@@ -923,15 +923,15 @@
this class without having to write an adapter for the
Tasklet interface:
-
- <bean id="myTasklet" class="org.springframework.batch.core.step.tasklet.TaskletAdapter">
- <property name="targetObject">
- <bean class="org.mycompany.FooDao">
- </property>
- <property name="targetMethod" value-"updateFoo" />
- </bean>
+
+
+
+
+
+
-
+]]>
@@ -946,7 +946,7 @@
project, is a Tasklet implementation with just
such a responsibility:
- public class FileDeletingTasklet implements Tasklet, InitializingBean {
+
+ }]]>
The above Tasklet implementation will
delete all files within a given directory. It should be noted that the
@@ -979,22 +979,22 @@
that is left is to reference the Tasklet from the
Step:
-
- <job id="taskletJob">
- <step id="deleteFilesInDir" tasklet="fileDeletingTasklet"/>
- </job>
+
+
+
- <bean id="fileDeletingTasklet"
- class="org.springframework.batch.sample.tasklet.FileDeletingTasklet">
- <property name="directoryResource">
- <bean id="directory"
- class="org.springframework.core.io.FileSystemResource">
- <constructor-arg value="target/test-outputs/test-dir" />
- </bean>
- </property>
- </bean>
+
+
+
+
+
+
+
-
+]]>
@@ -1031,18 +1031,18 @@
This can be achieved using the 'next' attribute of the step
element:
-
- <job id="job">
- <step id="stepA" next="stepB" />
- <step id="stepB" next="stepC"/>
- <step id="stepC" />
- </job>
+
+
+
+
+
-In the scenario above, 'step A' will execute first because it
- is the first Step listed. If 'step A' completes
- normally, then 'step B' will execute, and so on. However, if 'step A'
- fails, then the entire Job will fail and 'step B'
- will not execute.
+]]>In the scenario above, 'step A' will execute first because
+ it is the first Step listed. If 'step A'
+ completes normally, then 'step B' will execute, and so on. However, if
+ 'step A' fails, then the entire Job will fail and
+ 'step B' will not execute.
With the Spring Batch namespace, the first step listed in the
@@ -1100,17 +1100,17 @@
The next element specifies a pattern to match and the step to
execute next:
-
- <job id="job">
- <step id="stepA">
- <next on="FAILED" to="stepB" />
- <next on="*" to="stepC" />
- </step>
- <step id="stepB" next="stepC" />
- <step id="stepC" />
- </job>
+
+
+
+
+
+
+
+
-
+]]>
The "on" attribute of a transition element uses a simple
pattern-matching scheme to match the ExitStatus
@@ -1152,16 +1152,16 @@
StepExecution and is used by the framework to
record the status of a Job or
Step. It can be one of the following values:
- COMPLETED, STARTING, STARTED, FAILED, STOPPING, STOPPED, or UNKNOWN.
- Most of them are self explanatory: COMPLETED is the status set when a
- step or job has completed successfully, FAILED is set when it fails,
- and so on. The example above contains the following 'next'
+ COMPLETED, STARTING, STARTED, STOPPING, STOPPED, FAILED, ABANDONED or
+ UNKNOWN. Most of them are self explanatory: COMPLETED is the status
+ set when a step or job has completed successfully, FAILED is set when
+ it fails, and so on. The example above contains the following 'next'
element:
-
- <next on="FAILED" to="stepB" />
+
-
+]]>
At first glance, it would appear that the 'on' attribute
references the BatchStatus of the
@@ -1178,14 +1178,14 @@
code needs to be different? A good example comes from the skip sample
job within the samples project:
-
- <step id="step1">
- <end on="FAILED" />
- <next on="COMPLETED WITH SKIPS" to="errorPrint1" />
- <next on="*" to="step2" />
- </step>
+
+
+
+
+
-
+]]>
The above step has three possibilities:
@@ -1211,18 +1211,18 @@
change the exit code based on the condition of the execution having
skipped records:
- public class SkipCheckingListener extends StepExecutionListenerSupport {
+ 0) {
return new ExitStatus("COMPLETED WITH SKIPS");
} else {
return null;
}
}
- }
+ }]]>
The above code is a StepExecutionListener
that first checks to make sure the Step was
@@ -1250,7 +1250,7 @@
after the following step executes, the Job will
end:
- <step id="stepC" />
+ ]]>
If no transitions are defined for a Step,
then the Job's statuses will be defined as
@@ -1303,18 +1303,18 @@
In the following scenario, if step2 fails, then the
Job will stop with a
- BatchStatus of COMPLETE and an
+ BatchStatus of COMPLETED and an
ExitStatus of "COMPLETED" and step3 will not
- execute; otherwise, execution will move to step3. Additionally, if
- step2 fails, the Job will not be
- restartable.
+ execute; otherwise, execution will move to step3. Note that if step2
+ fails, the Job will not be restartable (because
+ the status is COMPLETED).
- <step id="step1" next="step2">
- <step id="step2">
- <end on="FAILED"/>
- <next on="*" to="step3"/>
- </step>
- <step id="step3">
+
+
+
+
+
+ ]]>
@@ -1338,33 +1338,33 @@
Additionally, if step2 fails, and the Job is
restarted, then execution will begin again on step2.
- <step id="step1" next="step2">
- <step id="step2">
- <fail on="FAILED" status="EARLY TERMINATION"/>
- <next on="*" to="step3"/>
- </step>
- <step id="step3">
+
+
+
+
+
+ ]]>
- The 'Pause' Element
+ The 'Stop' Element
- The 'pause' element instructs a Job to
- stop with a BatchStatus of STOPPED. Pausing a
- Job is a meant to be a temporary break in
- processing so that the operator can take some action before restarting
- the Job. The 'pause' element requires a 'to'
- attribute that specifies the step where execution should pick up once
- the Job.
+ The 'stop' element instructs a Job to
+ stop with a BatchStatus of STOPPED. Stopping a
+ Job can provide a temporary break in processing
+ so that the operator can take some action before restarting the
+ Job. The 'stop' element requires a 'restart'
+ attribute that specifies the step where execution should pick up when
+ the Job is restarted.
In the following scenario, if step1 finsihes with COMPLETE, then
the job will then stop. Once it is restarted, execution will begin on
step2.
- <step id="step1">
- <pause on="COMPLETED" to="step2"/>
- </step>
- <step id="step2"/>
+
+
+
+ ]]>
@@ -1377,7 +1377,7 @@
JobExecutionDecider can be used to assist in the
decision.
-
+
+]]>
In the job configuration, a "decision" tag will specify the
decider to use as well as all of the transitions.
-
- <job id="job">
- <step id="step1" next="decision" />
+
+
- <decision id="skipCheckingDecision" decider="decider">
- <next on="FAILED" to="step2" />
- <next on="COMPLETED" to="step3" />
- </step>
+
+
+
+
- <step id="step2" next="step3"/>
- <step id="step3" />
- </job>
+
+
+
- <bean id="decider" class="com.MyDecider"/>
+
-
+]]>
@@ -1428,16 +1428,16 @@
elements such as the 'next' attribute or the 'next', 'end', 'fail', or
'pause' elements.
- <split id="split1" next="step4">
- <flow>
- <step id="step1" next="step2"/>
- <step id="step2"/>
- </flow>
- <flow>
- <step id="step3"/>
- </flow>
- </split>
- <step id="step4"/>
+
+
+
+
+
+
+
+
+
+ ]]>
@@ -1451,14 +1451,14 @@
Flat File resources can be configured using standard Spring
constructs:
-
- <bean id="flatFileItemReader"
- class="org.springframework.batch.item.file.FlatFileItemReader">
- <property name="resource"
- value="file://outputs/20070122.testStream.CustomerReportStep.TEMP.txt" />
- </bean>
+
+
+
-
+]]>
The above Resource will load the file from
the file system location specified. Note that absolute locations have to
@@ -1468,13 +1468,13 @@
at runtime as a parameter to the job. This could be solved using '-D'
parameters, i.e. a system property:
-
- <bean id="flatFileItemReader"
- class="org.springframework.batch.item.file.FlatFileItemReader">
- <property name="resource" value="${input.file.name}" />
- </bean>
+
+
+
-
+]]>
All that would be required for this solution to work would be a
system argument (-Dinput.file.name="file://file.txt"). (Note that although
@@ -1490,34 +1490,34 @@
accomplish this, Spring Batch allows for the late binding of various Job
and Step attributes:
-
- <bean id="flatFileItemReader" scope="step"
- class="org.springframework.batch.item.file.FlatFileItemReader">
- <property name="resource" value="#{jobParameters[input.file.name]}" />
- </bean>
+
+ #{jobParameters[input.file.name]}
+
-
+]]>
Both the JobExecution and
StepExecution level
ExecutionContext can be accessed in the same
way:
-
- <bean id="flatFileItemReader" scope="step"
- class="org.springframework.batch.item.file.FlatFileItemReader">
- <property name="resource" value="#{jobExecutionContext[input.file.name]}" />
- </bean>
+
+ #{jobExecutionContext[input.file.name]}
+
-
+]]>
-
- <bean id="flatFileItemReader" scope="step"
- class="org.springframework.batch.item.file.FlatFileItemReader">
- <property name="resource" value="#{stepExecutionContext[input.file.name]}" />
- </bean>
+
+ #{stepExecutionContext[input.file.name]}
+
-
+]]>
Step Scope
@@ -1525,13 +1525,13 @@
All of the late binding examples from above have a scope of "step"
declared on the bean definition:
-
- <bean id="flatFileItemReader" scope="step"
- class="org.springframework.batch.item.file.FlatFileItemReader">
- <property name="resource" value="#{jobParameters[input.file.name]}" />
- </bean>
+ scope="step"
+
+
-
+]]>
Using a scope of Step is required in order
to use late binding since the bean cannot actually be instantiated until
@@ -1539,10 +1539,10 @@
be found. Because it is not part of the Spring container by default, it
must be added explicitly:
-
- <bean class="org.springframework.batch.core.scope.StepScope" />
+
-
+]]>
diff --git a/spring-batch-core/pom.xml b/spring-batch-core/pom.xml
index f8cdb6b5b..b41bacd1f 100644
--- a/spring-batch-core/pom.xml
+++ b/spring-batch-core/pom.xml
@@ -3,7 +3,6 @@
4.0.0
org.springframework.batch.core
- 2.0.0.CI-SNAPSHOT
jar
Core
diff --git a/spring-batch-infrastructure-tests/pom.xml b/spring-batch-infrastructure-tests/pom.xml
index cbb27915e..4974be90e 100644
--- a/spring-batch-infrastructure-tests/pom.xml
+++ b/spring-batch-infrastructure-tests/pom.xml
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.springframework.batch.infrastructure.tests
- 2.0.0.CI-SNAPSHOT
jar
Infrastructure Tests
Integration tests for the Spring Batch Infrastructure
diff --git a/spring-batch-infrastructure/pom.xml b/spring-batch-infrastructure/pom.xml
index fed28e708..b8fffd0d5 100644
--- a/spring-batch-infrastructure/pom.xml
+++ b/spring-batch-infrastructure/pom.xml
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.springframework.batch.infrastructure
- 2.0.0.CI-SNAPSHOT
jar
Infrastructure
diff --git a/spring-batch-integration/pom.xml b/spring-batch-integration/pom.xml
index 4167e5be8..4aed5c716 100644
--- a/spring-batch-integration/pom.xml
+++ b/spring-batch-integration/pom.xml
@@ -1,6 +1,9 @@
+ 4.0.0
+ org.springframework.batch.integration
+ Enterprise Integration
org.springframework.batch
@@ -8,10 +11,6 @@
2.0.0.CI-SNAPSHOT
..
- 4.0.0
- org.springframework.batch.integration
-
- Enterprise Integration
diff --git a/spring-batch-samples/pom.xml b/spring-batch-samples/pom.xml
index 4c0bf9a28..fea5cd502 100644
--- a/spring-batch-samples/pom.xml
+++ b/spring-batch-samples/pom.xml
@@ -2,7 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.springframework.batch.samples
- 2.0.0.CI-SNAPSHOT
jar
Samples
diff --git a/spring-batch-test/pom.xml b/spring-batch-test/pom.xml
index 63df1d1fb..1f16bdcc4 100755
--- a/spring-batch-test/pom.xml
+++ b/spring-batch-test/pom.xml
@@ -4,7 +4,6 @@
4.0.0
org.springframework.batch.test
- 2.0.0.CI-SNAPSHOT
Test
jar
Domain for batch job testing