diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AggregateItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AggregateItemReader.java
index a73cb1510..490b4b277 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AggregateItemReader.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/AggregateItemReader.java
@@ -24,15 +24,14 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.MarkFailedException;
import org.springframework.batch.item.ResetFailedException;
-import org.springframework.batch.item.file.mapping.FieldSetMapper;
/**
* An {@link ItemReader} that delivers a list as its item, storing up objects
* from the injected {@link ItemReader} until they are ready to be packed out as
- * a collection. The {@link ItemReader} should mark the beginning and end of
- * records with the constant values in {@link FieldSetMapper} (
- * {@link AggregateItemReader#BEGIN_RECORD} and
- * {@link AggregateItemReader#END_RECORD}).
+ * a collection. Usually this class will be used as a wrapper for a custom
+ * {@link ItemReader} that can identify the record boundaries. The custom reader
+ * should mark the beginning and end of records with the constant values ({@link AggregateItemReader#BEGIN_RECORD}
+ * and {@link AggregateItemReader#END_RECORD}).
*
* This class is thread safe (it can be used concurrently by multiple threads)
* as long as the {@link ItemReader} is also thread safe.
@@ -124,7 +123,6 @@ public class AggregateItemReader implements ItemReader> {
*/
private class ResultHolder {
List
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/site/apt/index.apt b/spring-batch-samples/src/site/apt/index.apt
index 4ab77577a..4f99a1e17 100644
--- a/spring-batch-samples/src/site/apt/index.apt
+++ b/spring-batch-samples/src/site/apt/index.apt
@@ -46,37 +46,43 @@ Spring Batch Samples
Here is a list of samples with checks to indicate which features each one demonstrates:
*----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
-|<> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <>
+|<> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> |
*----
-adhocLoopJob | | | | | | | | | | | | | | | x | |
+{{adhocLoop}} | | | | | | | | | | | | | | |x | | | |
*----
-beanWrapperMapperSample | | x | | | | | | | | | x | | | x | | x |
+{{batchUpdate}} | | | | | |x | | | | | | | | | | | |x |
*----
-compositeProcessorSample | | | | | | | | x | | | x | | | | | x |
+{{beanWrapperMapperSample}} | |x | | | | | | | | |x | | |x | |x | | |
*----
-delegatingJob | | | | | | | | | | | | | | | | | x
+{{compositeItemWriterSample}}| | | | | | | |x | | |x | | | | |x | | |
*----
-fixedLengthImportJob | | x | | | | | | | | | x | | | | | x |
+{{delegating}} | | | | | | | | | | | | | | | | |x | |
*----
-hibernateJob | | | | | | x | | | | | x | | | | | |
+{{fixedLengthImport}} | |x | | | | | | | | |x | | | | |x | | |
*----
-ibatisJob | | | | | x | | | | | | x | | | | | |
+{{football}} |x | | | | |x | | | | |x | | | | | | | |
*----
-infiniteLoopJob | | | | | | | | | | | | | | | | |
+{{hibernate}} | | | | | |x | | | | |x | | | | | | |x |
*----
-multilineJob | | x | | x | | | | | | | | | | | | |
+{{ibatis}} | | | | |x | | | | | |x | | | | | | | |
*----
-multilineOrderJob | x | | | x | | | | x | | x | | | | | | |
+{{multiline}} | |x | |x | | | | | | | | | | | | | | |
*----
-fotballlJob | x | | | | | x | | | | | x | | | | | |
+{{multilineOrder}} |x | | |x | | | |x | |x | | | | | | | | |
*----
-restartSample | | x | | | | | | | | | x | | x | | | x |
+{{quartzSample}} |x | | | | |x | | | | |x | | | |x | | | |
*----
-simpleTaskletJob | | | | | | | | | | | | | | | | |
+{{restartSample}} | |x | | | | | | | | |x | |x | | |x | | |
*----
-tradeJob | x | | | | x | | x | | | | x | | | | | x |
+{{retrySample}} | | | | | | | | | | | | | | | |x | | |
*----
-xmlStaxJob | | | x | | | | | | x | | | | | | | |
+{{skipSample}} |x | | | |x | |x | | | |x |x | | | |x | | |
+*----
+{{tasklet}} | | | | | | | | | | | | | | | | | | |
+*----
+{{trade}} |x | | | |x | |x | | | |x | | | | |x | | |
+*----
+{{xmlStax}} | | |x | | | | | |x | | | | | | | | | |
*----
* Common Sample Source Structures
@@ -102,84 +108,93 @@ xmlStaxJob | | | x | | | | | | x | | | | | | | |
Each job consists of several steps, these steps are defined in steps
property.
-** Tasklet Job
+* Adhoc Loop and JMX Demo ({adhocLoop})
- The goal is to show the simplest use of the batch framework with a
- single job with a single step, which cleans up a directory and runs
- a system command.
+ This job is simply an infinite loop. It runs forever so it is
+ useful for testing features to do with stopping and starting jobs.
+ It is used, for instance, as one of the jobs that can be run from
+ JMX using the Eclipse launch configuration "jmxLauncher".
- This job is defined by <<>> file. The
- <<>> itself is defined by the bean definition with
- <<>>. In this example we have two steps.
+ The JMX launcher uses an additional XML configuration file
+ (adhoc-job-launcher-context.xml) to set up a <<>> for
+ running jobs asynchronously (i.e. in a backgound thread). This
+ follows the same pattern as the {{{quartzSample}Quartz sample}}, so
+ see that section for more details of the <<>>
+ configuration.
- * The first step defines a tasklet that is responsible for
- clearing out a directory though a custom <<>>. Each
- tasklet has an <<>> method which is called by the
- step. All processing of business data should be handled by this
- method.
+ The rest of the configuration for this demo consists of exposing
+ some components from the application context as JMX managed beans.
+ The <<>> is exposed as a stripped down interface
+ <<>>, so that it can be controlled from a
+ remote client (such as JConsole from the JDK) which does not have
+ Spring Batch on the classpath. See the Spring Core Reference Guide
+ for more details on how to customize the JMX configuration.
- * The second step uses another tasklet to execute a system (OS)
- command line.
+* Batch Update ({batchUpdate})
- taskletJob.xml
+ The purpose of this sample is to show to usage of the
+ <<>> to make efficient updates to a
+ database table.
- You can visualize the Spring configuration of a job through
- Spring-IDE. See {{{http://springide.org/blog/}Spring IDE}}. The
- source view of the configuration is as follows:
+ The <<>> accepts a special form of
+ <<>> as a (mandatory) dependency. This is
+ responsible for copying fields from the item to be written to a
+ <<>> matching the SQL query that has been
+ injected. The implementation of the
+ <<>> shows best
+ practice of keeping all the information needed for the execution in
+ one place, since it contains a static constant value (<<>>)
+ which is used to configure the query for the writer.
-+---
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+* BeanWrapperMapper Sample ({beanWrapperMapperSample})
-
+ This sample shows the use of automatic mapping from fields in a file
+ to a domain object. The <<>> and <<>> objects needed
+ by the job are created from the Spring configuration using prototype
+ beans, and then their properties are set using the
+ <<>>, which sets properties of the
+ prototype according to the field names in the file.
-
-
-
-+---
+ Nested property paths are resolved in the same way as normal Spring
+ binding occurs, but with a little extra leeway in terms of spelling
+ and capitalization. Thus for instance, the <<>> object has a
+ property called <<>> (lower case), but the file has been
+ configured to have a column name <<>> (upper case), and
+ the mapper will accept the values happily. Underscores instead of
+ camel-casing (e.g. <<>> instead of <<>>)
+ also work.
- For simplicity we are only displaying the job configuration itself
- and leaving out the details of the supporting batch execution
- environment configuration.
+* Composite ItemWriter Sample ({compositeItemWriterSample})
-** Fixed Length Import Job
+ This shows a common use case using a composite pattern, composing
+ instances of other framework readers or writers. It is also quite
+ common for business-specific readers or writers to wrap
+ off-the-shelf components in a similar way.
+
+ In this job the composite pattern is used just to make duplicate
+ copies of the output data. The delegates for the
+ <<>> have to be separately registered as
+ streams in the <<>> where they are used, in order for the step
+ to be restartable. This is a common feature of all delegate
+ patterns.
+
+* Delegating Sample ({delegating})
+
+ This sample shows the delegate pattern again, and also the
+ <<>> which is used to adapt a POJO to the
+ <<>> interface.
+
+* Fixed Length Import Job ({fixedLengthImport})
The goal is to demonstrate a typical scenario of importing data
from a fixed-length file to database
- This job shows a more typical scenario, when reading
- input data and processing the data is cleanly separated. The data
- provider is responsible for reading input and mapping each record to
- a domain object, which is then passed to the module processor. The
- module processor handles the processing of the domain objects, in
- this case it only writes them to database.
-
- fixedLengthImportJob.xml
-
- file with fixed row structure
+ This job shows a typical scenario, when reading input data and
+ processing the data is cleanly separated. The data provider is
+ responsible for reading input and mapping each record to a domain
+ object, which is then passed to the module processor. The module
+ processor handles the processing of the domain objects, in this case
+ it only writes them to database.
In this example we are using a simple fixed length record structure
that can be found in the project at
@@ -214,109 +229,7 @@ xmlStaxJob | | | x | | | | | | x | | | | | | | |
object
-* Multiline Order Job
-
- The goal is to demostrate how to handle a more complex file input
- format, where a record meant for processing inludes nested records
- and spans multiple lines
-
- multilineOrderJob.xml
-
- file with multiline records. OrderDataProvider is
- an example of a non-default programmatic data provider. It reads
- input until it detects that the multiline record has finished and
- encapsulates the record in a single domain object.
-
-