diff --git a/docs/src/site/docbook/reference/ExecutionEnvironment.png b/docs/src/site/docbook/reference/ExecutionEnvironment.png
deleted file mode 100644
index e574236b3..000000000
Binary files a/docs/src/site/docbook/reference/ExecutionEnvironment.png and /dev/null differ
diff --git a/docs/src/site/docbook/reference/appendix.xml b/docs/src/site/docbook/reference/appendix.xml
index 369a7d34d..6acdef9ce 100644
--- a/docs/src/site/docbook/reference/appendix.xml
+++ b/docs/src/site/docbook/reference/appendix.xml
@@ -5,8 +5,137 @@
List of ItemReaders
-
+ Item Readers
+
+ Available Item Readers
-
+
+
+
+
+
+ Item Reader
+
+ Type of Item Provided
+
+ Description
+
+
+
+
+
+ ListItemReader
+
+ java.lang.Object
+
+ Provides the items from a list, one at a
+ time
+
+
+
+ ValidatingItemReader
+
+ java.lang.Object
+
+ A simple extension of DelegatingItemReader
+ that provides for validation before returning input.
+
+
+
+ AggregateItemReader
+
+ java.util.Collection
+
+ An ItemReader that delivers a list as its
+ item, storing up objects from the injected ItemReader until they
+ are ready to be packed out as a collection. This ItemReader should
+ mark the beginning and end of records with the constant values in
+ FieldSetMapper AggregateItemReader#BEGIN_RECORD and
+ AggregateItemReader#END_RECORD
+
+
+
+ DelegatingItemReader
+
+ java.lang.Object
+
+ Extends AbstractMethodInvokingDelegator, which
+ enables dynamically calling of a custom method of the injected
+ object. Provides a convenient API for dynamic method invocation
+ shielding subclasses from the low-level details and exception
+ handling.
+
+
+
+ FlatFileItemReader
+
+ java.lang.String
+
+ Reads from a flat file, includes ItemStream
+ and Skippable functionality. See section on Read from a
+ File
+
+
+
+ StaxEventItemReader
+
+ java.lang.Object
+
+ Reads via StAX. See HOWTO - Read from a
+ File
+
+
+
+ JdbcCursorItemReader
+
+ java.lang.Object
+
+ Reads from a database cursor via JDBC. See
+ HOWTO - Read from a Database
+
+
+
+ DrivingQueryItemReader
+
+ java.lang.Object
+
+ Base class for operations that read from a
+ database based on a single driving query. Configured by injecting
+ a KeyGenerator object. See HOWTO - Read from a Database
+
+
+
+ HibernateCursorItemReader
+
+ java.lang.Object
+
+ Reads from a cursor based on an HQL query. See
+ section on Reading from a Database
+
+
+
+ IbatisDrivingQueryItemReader
+
+ java.lang.Object
+
+ Reads via iBATIS based on a driving query. See
+ HOWTO - Read from a Database
+
+
+
+ JmsItemReader
+
+ javax.jms.Message
+
+ Given a Spring JmsOperations object and a JMS
+ Destination or destination name to send errors, provides items
+ received through the injected JmsOperations receive()
+ method
+
+
+
+
-
\ No newline at end of file
+
diff --git a/docs/src/site/docbook/reference/glossary-test.xml b/docs/src/site/docbook/reference/glossary-test.xml
deleted file mode 100644
index a0d8fed82..000000000
--- a/docs/src/site/docbook/reference/glossary-test.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/docs/src/site/docbook/reference/glossary.xml b/docs/src/site/docbook/reference/glossary.xml
index fdd13231f..2331816df 100644
--- a/docs/src/site/docbook/reference/glossary.xml
+++ b/docs/src/site/docbook/reference/glossary.xml
@@ -1,72 +1,96 @@
-
-
-
- Glossary
-
- Glossary Items
-
-
-
- Batch: An accumulation of
- business transactions over time.
-
-
- Batch Application Style:
- Term used to designate batch as an application style in its own
- right similar to online, Web or SOA. It has standard elements of
- input, validation, transformation of information to business
- model, business processing and output. In addition, it requires
- monitoring at a macro level.
-
-
- Batch Processing: The
- handling of a batch of many business transactions that have
- accumulated over a period of time (e.g. an hour, day, week,
- month, or year). It is the application of a process, or set of
- processes, to many data entities or objects in a repetitive and
- predictable fashion with either no manual element, or a separate
- manual element for error processing.
-
-
+
+
+
+
+ Spring Batch Glossary
- Batch Window: The time
- frame within which a batch job must complete. This can be
- constrained by other systems coming online, other dependent jobs
- needing to execute or other factors specific to the batch
- environment.
+
+ Batch
+
+ An accumulation of business transactions over
+ time.
+
+
+
-
+
+ Batch Application Style
+
+
+ Term used to designate batch as an application style in its
+ own right similar to online, Web or SOA. It has standard
+ elements of input, validation, transformation of
+ information to business model, business processing and
+ output. In addition, it requires monitoring at a macro
+ level.
+
+
+
-
+
+ Batch Processing
+
+
+ The handling of a batch of many business transactions that
+ have accumulated over a period of time (e.g. an hour, day,
+ week, month, or year). It is the application of a process,
+ or set of processes, to many data entities or objects in a
+ repetitive and predictable fashion with either no manual
+ element, or a separate manual element for error processing.
+
+
+
- Step Controller: It is the
- main batch task or Unit of Work controller. It initializes the
- tasklet, and controls the transaction environment based on commit
- interval setting, etc.
+
+ Batch Window
+
+
+ The time frame within which a batch job must complete. This
+ can be constrained by other systems coming online, other
+ dependent jobs needing to execute or other factors specific
+ to the batch environment.
+
+
+
-
+
+ Step Controller
+
+
+ It is the main batch task or Unit of Work controller. It
+ initializes the tasklet, and controls the transaction
+ environment based on commit interval setting, etc.
+
+
+
-
+
+ Tasklet
+
+
+ The main application program created by application developer to process
+ the business logic for each LUW.
+
+
+
- Tasklet: The main
- application program created by application developer to process
- the business logic for each LUW.
+
+ Batch Job Type
+
+
+ Job Types describe application of jobs for particular type
+ of processing. Common areas are interface processing
+ (typically flat files), forms processing (either for online
+ pdf generation or print formats), report processing.
+
+
+
-
-
-
-
- Batch Job Type: Job Types
- describe application of jobs for particular type of processing.
- Common areas are interface processing (typically flat files),
- forms processing (either for online pdf generation or print
- formats), report processing. s
-
-
-
-
-
- Driving Query: A driving
+
+ Driving Query
+
+ A driving
query identifies the set of work for a job to do; the job then
breaks that work into individual units of work. For instance,
identify all financial transactions that have a status of
@@ -75,110 +99,151 @@
each record ID then becomes a unit of work. A driving query may
involve a join (if the criteria for selection falls across two or
more tables) or it may work with a single table.
+
-
+
-
+
- Logicial Unit of Work
- (LUW): A batch job iterates through a driving query
+ Logicial Unit of Work
+ (LUW)
+
+ A batch job iterates through a driving query
(or another input source such as a file) to perform the set of
work that the job must accomplish. Each iteration of work
performed is a unit of work.
+
-
+
-
+
- Commit Interval: A set of
+ Commit Interval
+
+ A set of
LUWs constitute a commit interval.
+
-
+
-
+
- Partitioning: Splitting a
+ Partitioning
+
+ Splitting a
job into multiple threads where each thread is responsible for a
subset of the overall data to be processed. The threads of
execution may be within the same JVM or they may span JVMs in a
clustered environment that supports workload balancing.
+
-
+
-
+
- Staging Table: A table
+ Staging Table
+
+ A table
that holds temporary data while it is being processed.
+
-
+
-
+
- Restartable: - a job that
+ Restartable
+
+ - a job that
can be executed again and will assume the same identity as when
run initially. In othewords, it is has the same job instance
id.
+
-
+
-
+
- Rerunnable - a job that is restartable and manages it's own state in terms of previous run's record
- processing. Note>>: Rerunnable is tied to the driving query. If the driving query can be formed so that it will limit the
- processed rows when the job is restarted than re-runnable = true. This is managed by the application architecture. Often times a
- condition is added to the where statement to limit the rows returned by the driving query with something like "and
- processedFlag != true".
+ Rerunnable
+
+
+ a job that is restartable and manages it's own state in
+ terms of previous run's record processing. Note>>
+ Rerunnable is tied to the driving query. If the driving
+ query can be formed so that it will limit the processed rows
+ when the job is restarted than re-runnable = true. This is
+ managed by the application architecture. Often times a
+ condition is added to the where statement to limit the rows
+ returned by the driving query with something like "and
+ processedFlag != true".
+
+ Understanding Rerunnable
+
+ If re-runnable = false the architecture assumes responsibility for
+ tracking which rows have been processed. There is a default strategy
+ for tracking the last record processed by partition. Most batch jobs
+ only have one partition. The option is only valid for a restartable
+ job. The reason being is that the architecture will have to persist
+ the restart data, which is only available on a restartable job as the
+ restart data is saved and made available from the execution of the
+ last run if restartable = true. In pseudo code it is the following:
+
+
+ StartOver ::= restartable = false. Restartable ::= true | false If
+ (Restartable) re-runnable ::= true | false We don't persist restart
+ information for a non-restartable job. As you can see, it doesn't
+ make sense. Rerunnable has always confused the best of us and we're
+ open to suggestions on how to better explain it.
+
+
+
+
-
-
+
-
+
- Repeat: One of the most basic units of batch processing, that defines repeatability calling a
- portion of code until it is finished, and while there is no error. Typically a batch process would be repeatable as long as there is input.
-
+ Repeat
+
+ One of the most basic units of batch processing, that
+ defines repeatability calling a portion of code until it is
+ finished, and while there is no error. Typically a batch
+ process would be repeatable as long as there is input.
+
+
+
+
-
-
-
-
- Retry: Simplifies the execution of operations with retry semantics most frequently associated
+ Retry
+
+ Simplifies the execution of operations with retry semantics most frequently associated
with handling transactional output exceptions. Retry is slightly different from repeat, rather than continually calling a block of code,
retry is stateful, and continually calls the same block of code with the same input, until it either succeeds, or some type of retry limit
has been exceeded. It is only generally useful if the operation is non-deterministic meaning that a retry on a subsequent invocation might
succeed because something in the environment has improved.
+
-
+
-
+
- Recover: Recover operations handle an exception in such a way that a repeat process is able to
+ Recover
+
+ Recover operations handle an exception in such a way that a repeat process is able to
continue.
+
-
-
+
+
- Skip: Skip is a recovery strategy often used on file input sources as the strategy for ignoring
+ Skip
+
+ Skip is a recovery strategy often used on file input sources as the strategy for ignoring
bad input records that failed validation.
+
-
-
-
-
-
+
+
+
diff --git a/docs/src/site/docbook/reference/index.xml b/docs/src/site/docbook/reference/index.xml
index e9e2d1096..23d489573 100644
--- a/docs/src/site/docbook/reference/index.xml
+++ b/docs/src/site/docbook/reference/index.xml
@@ -37,6 +37,7 @@
-
+
+
diff --git a/docs/src/site/docbook/reference/infrastructure.xml b/docs/src/site/docbook/reference/infrastructure.xml
index 4baa8d25a..ffb551c86 100644
--- a/docs/src/site/docbook/reference/infrastructure.xml
+++ b/docs/src/site/docbook/reference/infrastructure.xml
@@ -86,139 +86,8 @@
role="bold">ItemReaders are the means for providing data from
many different types of input sources. The table provide below list an
inventory of ItemReaders currently available. In addition it is easy to
- create a custom ItemReader.
-
-
-
-
-
-
-
-
-
- Item Reader
-
- Type of Item Provided
-
- Description
-
-
-
-
-
- ListItemReader
-
- java.lang.Object
-
- Provides the items from a list, one at a
- time
-
-
-
- ValidatingItemReader
-
- java.lang.Object
-
- A simple extension of DelegatingItemReader
- that provides for validation before returning input.
-
-
-
- AggregateItemReader
-
- java.util.Collection
-
- An ItemReader that delivers a list as its
- item, storing up objects from the injected ItemReader until they
- are ready to be packed out as a collection. This ItemReader should
- mark the beginning and end of records with the constant values in
- FieldSetMapper AggregateItemReader#BEGIN_RECORD and
- AggregateItemReader#END_RECORD
-
-
-
- DelegatingItemReader
-
- java.lang.Object
-
- Extends AbstractMethodInvokingDelegator, which
- enables dynamically calling of a custom method of the injected
- object. Provides a convenient API for dynamic method invocation
- shielding subclasses from the low-level details and exception
- handling.
-
-
-
- FlatFileItemReader
-
- java.lang.String
-
- Reads from a flat file, includes ItemStream
- and Skippable functionality. See section on Read from a
- File
-
-
-
- StaxEventItemReader
-
- java.lang.Object
-
- Reads via StAX. See HOWTO - Read from a
- File
-
-
-
- JdbcCursorItemReader
-
- java.lang.Object
-
- Reads from a database cursor via JDBC. See
- HOWTO - Read from a Database
-
-
-
- DrivingQueryItemReader
-
- java.lang.Object
-
- Base class for operations that read from a
- database based on a single driving query. Configured by injecting
- a KeyGenerator object. See HOWTO - Read from a Database
-
-
-
- HibernateCursorItemReader
-
- java.lang.Object
-
- Reads from a cursor based on an HQL query. See
- section on Reading from a Database
-
-
-
- IbatisDrivingQueryItemReader
-
- java.lang.Object
-
- Reads via iBATIS based on a driving query. See
- HOWTO - Read from a Database
-
-
-
- JmsItemReader
-
- javax.jms.Message
-
- Given a Spring JmsOperations object and a JMS
- Destination or destination name to send errors, provides items
- received through the injected JmsOperations receive()
- method
-
-
-
-
+ create a custom ItemReader. A list of the available ItemReaders can be
+ found in Appendix A.
The Item Reader is a basic interface for generic input operations.
Subclasses implementing this interface will be responsible for reading
diff --git a/docs/src/site/docbook/reference/samples.xml b/docs/src/site/docbook/reference/samples.xml
index e02921da3..4d2b2208e 100644
--- a/docs/src/site/docbook/reference/samples.xml
+++ b/docs/src/site/docbook/reference/samples.xml
@@ -435,8 +435,8 @@
the data from the input source and maps the line to the Trade object.
- trade = (Trade) tradeFieldSetMapper.mapLine(inputSource.readFieldSet());
-
+ trade = (Trade) tradeFieldSetMapper.mapLine(inputSource.readFieldSet());
+
If data exists and an object is returned it is simply passed to
the output source. If there is no data to read an ExitStatus with the
status of FINISHED is returned from the Tasklet.
@@ -507,88 +507,88 @@
<import resource="BatchArchConfig.xml" />
- <bean id="simpleTaskletJob" parent="Job">
- <property name="name" value="fixedLengthImportJob" />
- <property name="steps">
- <list>
- <bean id="tradeStep" parent="Step">
- <property name="name" value="ImportTradeDataStep" />
- <property name="module">
- <bean class="com.accenture.adsj.refapp.batch.module.SimpleTradeTasklet">
- <property name="inputTemplate" ref="fileInputTemplate" />
- <property name="tradeDbWriter" ref="tradeWriter" />
- </bean>
- </property>
- <property name="commitFrequency" value="5" />
- <property name="startPolicy">
- <bean class="org.springframework.batch.container.conf.StartPolicy">
- <property name="ignoreComplete" value="true" />
- <property name="restartEnabled" value="true" />
- <property name="startlimit" value="12" />
- </bean>
- </property>
- <property name="exceptionPolicy">
- <bean class="org.springframework.batch.container.conf.ExceptionPolicy">
- <property name="totalExceptionLimit" value="20" />
- <property name="transactionInvalidExceptionLimit" value="20" />
- <property name="transactionValidExceptionLimit" value="5" />
- </bean>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean id="tradeWriter" class="com.accenture.adsj.refapp.batch.dao.DbTradeWriter">
- <property name="jdbcTemplate" ref="jdbcTemplate" />
- <property name="incrementer">
- <bean parent="incrementerParent">
- <property name="incrementerName" value="TRADE_SEQ" />
- </bean>
- </property>
- </bean>
- <bean id="fileInputTemplate" class="org.springframework.batch.container.io.file.support.FlatFileInputTemplate">
- <property name="name" value="FileInputSource" />
- <property name="fileLocatorStrategy" ref="fileLocator" />
- <property name="tokenizer">
- <bean class="org.springframework.batch.container.io.file.support.FixedLineTokenizer">
- <property name="fileDescriptor" ref="fixedFileDescriptor" />
- </bean>
- </property>
- </bean>
+ <bean id="simpleTaskletJob" parent="Job">
+ <property name="name" value="fixedLengthImportJob" />
+ <property name="steps">
+ <list>
+ <bean id="tradeStep" parent="Step">
+ <property name="name" value="ImportTradeDataStep" />
+ <property name="module">
+ <bean class="com.accenture.adsj.refapp.batch.module.SimpleTradeTasklet">
+ <property name="inputTemplate" ref="fileInputTemplate" />
+ <property name="tradeDbWriter" ref="tradeWriter" />
+ </bean>
+ </property>
+ <property name="commitFrequency" value="5" />
+ <property name="startPolicy">
+ <bean class="org.springframework.batch.container.conf.StartPolicy">
+ <property name="ignoreComplete" value="true" />
+ <property name="restartEnabled" value="true" />
+ <property name="startlimit" value="12" />
+ </bean>
+ </property>
+ <property name="exceptionPolicy">
+ <bean class="org.springframework.batch.container.conf.ExceptionPolicy">
+ <property name="totalExceptionLimit" value="20" />
+ <property name="transactionInvalidExceptionLimit" value="20" />
+ <property name="transactionValidExceptionLimit" value="5" />
+ </bean>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ <bean id="tradeWriter" class="com.accenture.adsj.refapp.batch.dao.DbTradeWriter">
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
+ <property name="incrementer">
+ <bean parent="incrementerParent">
+ <property name="incrementerName" value="TRADE_SEQ" />
+ </bean>
+ </property>
+ </bean>
+ <bean id="fileInputTemplate" class="org.springframework.batch.container.io.file.support.FlatFileInputTemplate">
+ <property name="name" value="FileInputSource" />
+ <property name="fileLocatorStrategy" ref="fileLocator" />
+ <property name="tokenizer">
+ <bean class="org.springframework.batch.container.io.file.support.FixedLineTokenizer">
+ <property name="fileDescriptor" ref="fixedFileDescriptor" />
+ </bean>
+ </property>
+ </bean>
<bean id="fixedFileDescriptor" class="org.springframework.batch.container.io.support.DefaultFileDescriptor">
- <property name="recordDescriptors">
- <bean class="org.springframework.batch.container.io.support.DefaultRecordDescriptor">
- <property name="fieldDescriptors">
- <list>
- <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
- <property name="name" value="ISIN" />
- <property name="length" value="12" />
- </bean>
- <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
- <property name="name" value="Quantity" />
- <property name="length" value="3" />
- </bean>
- <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
- <property name="name" value="Price" />
- <property name="length" value="5" />
- </bean>
- <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
- <property name="name" value="Customer" />
- <property name="length" value="9" />
- </bean>
- </list>
- </property>
- </bean>
- </property>
+ <property name="recordDescriptors">
+ <bean class="org.springframework.batch.container.io.support.DefaultRecordDescriptor">
+ <property name="fieldDescriptors">
+ <list>
+ <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
+ <property name="name" value="ISIN" />
+ <property name="length" value="12" />
+ </bean>
+ <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
+ <property name="name" value="Quantity" />
+ <property name="length" value="3" />
+ </bean>
+ <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
+ <property name="name" value="Price" />
+ <property name="length" value="5" />
+ </bean>
+ <bean class="org.springframework.batch.container.io.support.DefaultFieldDescriptor">
+ <property name="name" value="Customer" />
+ <property name="length" value="9" />
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </property>
</bean>
<bean id="tradeLineMapper" class="com.accenture.adsj.refapp.batch.mapping.TradeRowMapper" />
<bean class="com.accenture.adsj.refapp.batch.advice.LogAdvice" id="logAdvice" />
<aop:config>
- <aop:aspect id="logging" ref="logAdvice">
- <aop:around pointcut-ref="pointcut" method="doBasicLogging" />
- <aop:pointcut id="pointcut" expression="execution(* org.springframework.batch.container.dao.*.*(..))" />
- </aop:aspect>
+ <aop:aspect id="logging" ref="logAdvice">
+ <aop:around pointcut-ref="pointcut" method="doBasicLogging" />
+ <aop:pointcut id="pointcut" expression="execution(* org.springframework.batch.container.dao.*.*(..))" />
+ </aop:aspect>
</aop:config>
</beans>
@@ -806,13 +806,13 @@
src/main/resources/data/footballjob/input/. Each line within this file
represents a player, with a unique id, the player’s name, position, etc:
- AbduKa00,Abdul-Jabbar,Karim,rb,1974,1996
- AbduRa00,Abdullah,Rabih,rb,1975,1999
- AberWa00,Abercrombie,Walter,rb,1959,1982
- AbraDa00,Abramowicz,Danny,wr,1945,1967
- AdamBo00,Adams,Bob,te,1946,1969
- AdamCh00,Adams,Charlie,wr,1979,2003
-
+ AbduKa00,Abdul-Jabbar,Karim,rb,1974,1996
+ AbduRa00,Abdullah,Rabih,rb,1975,1999
+ AberWa00,Abercrombie,Walter,rb,1959,1982
+ AbraDa00,Abramowicz,Danny,wr,1945,1967
+ AdamBo00,Adams,Bob,te,1946,1969
+ AdamCh00,Adams,Charlie,wr,1979,2003
+
One of the first noticeable characteristics of the file is that each
data element is separated by a comma, a format most are familiar with
@@ -828,13 +828,13 @@
The second file, ‘games.csv’ is formatted the same as the previous
example, and resides in the same directory:
- AbduKa00,1996,mia,10,nwe,0,0,0,0,0,29,104,,16,2
- AbduKa00,1996,mia,11,clt,0,0,0,0,0,18,70,,11,2
- AbduKa00,1996,mia,12,oti,0,0,0,0,0,18,59,,0,0
- AbduKa00,1996,mia,13,pit,0,0,0,0,0,16,57,,0,0
- AbduKa00,1996,mia,14,rai,0,0,0,0,0,18,39,,7,0
- AbduKa00,1996,mia,15,nyg,0,0,0,0,0,17,96,,14,0
-
+ AbduKa00,1996,mia,10,nwe,0,0,0,0,0,29,104,,16,2
+ AbduKa00,1996,mia,11,clt,0,0,0,0,0,18,70,,11,2
+ AbduKa00,1996,mia,12,oti,0,0,0,0,0,18,59,,0,0
+ AbduKa00,1996,mia,13,pit,0,0,0,0,0,16,57,,0,0
+ AbduKa00,1996,mia,14,rai,0,0,0,0,0,18,39,,7,0
+ AbduKa00,1996,mia,15,nyg,0,0,0,0,0,17,96,,14,0
+
Each line in the file represents an individual player’s performance
in a particular game, containing such statistics as passing yards,
@@ -882,14 +882,14 @@
file which can be found in the jobs folder under src/main/resources. When
you drill down into the footballjob you will see that the configuration
has a list of steps:
- <property name="steps">
- <list>
- <bean id="playerload"> ... </bean>
- <bean id="gameLoad"> ... </bean
- <bean id="playerSummarization"> ... </bean>
- </list>
- </property>
-
+ <property name="steps">
+ <list>
+ <bean id="playerload"> ... </bean>
+ <bean id="gameLoad"> ... </bean
+ <bean id="playerSummarization"> ... </bean>
+ </list>
+ </property>
+
The step is run until there is no more input to process, which in
this case would mean that each file has been completely processed. To
@@ -907,16 +907,16 @@
Now that we’ve discussed the entire flow of the batch job, we can
dive deeper into the first step: playerLoad:
- <bean id="playerload" class="org.springframework.batch...SimpleStepConfiguration">
- <property name="commitInterval" value="100" />
- <property name="tasklet">
- <bean class="org.springframework...RestartableItemProviderTasklet">
- <property name="itemProvider">...</property>
- <property name="itemProcessor">...</property>
- </bean>
- </property>
- </bean>
-
+ <bean id="playerload" class="org.springframework.batch...SimpleStepConfiguration">
+ <property name="commitInterval" value="100" />
+ <property name="tasklet">
+ <bean class="org.springframework...RestartableItemProviderTasklet">
+ <property name="itemProvider">...</property>
+ <property name="itemProcessor">...</property>
+ </bean>
+ </property>
+ </bean>
+
The root bean in this case is a StepConfiguration, which can be
considered a ‘blueprint’ of sorts that tells the execution environment
@@ -978,17 +978,17 @@
class="org.springframework.batch.io.file.support.DefaultFlatFileInputSource">
<property name="resource">
<bean class="org.springframework.core.io.ClassPathResource">
- <constructor-arg value="data/footballjob/input/player.csv" />
+ <constructor-arg value="data/footballjob/input/player.csv" />
</bean>
</property>
<property name="tokenizer">
<bean class = "org.springframework.batch.io.file.support.transform.DelimitedLineTokenizer">
<property name="names"
- value="ID,lastName,firstName,position,birthYear,debutYear" />
+ value="ID,lastName,firstName,position,birthYear,debutYear" />
</bean>
</property>
</bean>
-
+
There are two required dependencies of the input source; the first
is a resource to read in, which is the file to process. The second
@@ -1008,24 +1008,24 @@ class="org.springframework.batch.io.file.support.DefaultFlatFileInputSource">
You can see this below:
public class PlayerMapper implements FieldSetMapper {
- public Object mapLine(FieldSet fs) {
-
- if(fs == null){
- return null;
- }
-
- Player player = new Player();
- player.setID(fs.readString("ID"));
- player.setLastName(fs.readString("lastName"));
- player.setFirstName(fs.readString("firstName"));
- player.setPosition(fs.readString("position"));
- player.setDebutYear(fs.readInt("debutYear"));
- player.setBirthYear(fs.readInt("birthYear"));
-
- return player;
- }
+ public Object mapLine(FieldSet fs) {
+
+ if(fs == null){
+ return null;
+ }
+
+ Player player = new Player();
+ player.setID(fs.readString("ID"));
+ player.setLastName(fs.readString("lastName"));
+ player.setFirstName(fs.readString("firstName"));
+ player.setPosition(fs.readString("position"));
+ player.setDebutYear(fs.readInt("debutYear"));
+ player.setBirthYear(fs.readInt("birthYear"));
+
+ return player;
+ }
}
-
+
The flow of the ItemProvider, in this case, starts with a call to
readFieldSet on the InputSource. The next line in the file is read in as a
@@ -1048,23 +1048,23 @@ public class PlayerMapper implements FieldSetMapper {
returns a domain object to the processor. However, in this case, the input
source is the database, not a file:
<bean id="playerSummarizationSource"
- class="org.springframework.batch.io.sql.SqlCursorInputSource">
- <property name="dataSource" ref="dataSource" />
- <property name="mapper">
- <bean class="sample.mapping.PlayerSummaryMapper" />
- </property>
- <property name="sql">
- <value>
- SELECT games.player_id, games.year, SUM(COMPLETES),
- SUM(ATTEMPTS), SUM(PASSING_YARDS), SUM(PASSING_TD),
- SUM(INTERCEPTIONS), SUM(RUSHES), SUM(RUSH_YARDS),
- SUM(RECEPTIONS), SUM(RECEPTIONS_YARDS), SUM(TOTAL_TD)
- from games, players where players.player_id =
- games.player_id group by games.player_id, games.year
- </value>
- </property>
+ class="org.springframework.batch.io.sql.SqlCursorInputSource">
+ <property name="dataSource" ref="dataSource" />
+ <property name="mapper">
+ <bean class="sample.mapping.PlayerSummaryMapper" />
+ </property>
+ <property name="sql">
+ <value>
+ SELECT games.player_id, games.year, SUM(COMPLETES),
+ SUM(ATTEMPTS), SUM(PASSING_YARDS), SUM(PASSING_TD),
+ SUM(INTERCEPTIONS), SUM(RUSHES), SUM(RUSH_YARDS),
+ SUM(RECEPTIONS), SUM(RECEPTIONS_YARDS), SUM(TOTAL_TD)
+ from games, players where players.player_id =
+ games.player_id group by games.player_id, games.year
+ </value>
+ </property>
</bean>
-
+
The SqlCursorInputSource has three dependences:
@@ -1091,4 +1091,4 @@ public class PlayerMapper implements FieldSetMapper {
to wrap the ItemProcessors and output each record as it is processed to
the logger, which will greatly impact performance.
-
\ No newline at end of file
+