diff --git a/docs/models/Batch Presentation Diagrams.vsd b/docs/models/Batch Presentation Diagrams.vsd index 2cd6bc886..182d472eb 100644 Binary files a/docs/models/Batch Presentation Diagrams.vsd and b/docs/models/Batch Presentation Diagrams.vsd differ diff --git a/docs/src/site/docbook/reference/core.xml b/docs/src/site/docbook/reference/core.xml index 78a4ab822..fd2720101 100644 --- a/docs/src/site/docbook/reference/core.xml +++ b/docs/src/site/docbook/reference/core.xml @@ -49,20 +49,19 @@
- Simple Batch Execution Environment high level flow and - interaction of the architecture. + Batch Application Style Interactions and Services + format="PNG" /> + format="PNG" /> Figure 2.1: Batch Stereotypes @@ -211,8 +210,8 @@ meaning the January 1st run processes data for January 1st, etc) That is to say, each JobInstance can have multiple executions. (JobExecution is discussed in more - detail below) and only one instance can be running at a given time. - + detail below) and only one instance can be running at a given + time.
@@ -247,7 +246,7 @@ JobInstance of the EndOfDay job for 01-01-2008, as described above, that fails to successfully complete its work the first time it is run, when we attempt to run it again (with the same job - parameters of 01-01-2008), a new job execution will be created. + parameters of 01-01-2008), a new job execution will be created. A Job defines what a job is and defines how it is to be executed, and JobInstance is a purely organization object @@ -673,17 +672,56 @@
+ -
- Tasklets +
+ JobRepository - A Tasklet represents the execution of a - logical unit of work, as defined by its implementation of the Spring - Batch provided Tasklet interface. A - Tasklet is useful for encapsulating processing - logic that is not natural to split into read-(transform)-write phases, - such as invoking a system command or a stored procedure. -
+ The JobRepository is the persistence + mechanism for all of the Stereotypes mentioned above. When a job is first + launched, a JobExecution is obtained by calling the + repository's createJobExecution method, and + during the course of execution, StepExecution and + JobExecution are persisted by passing them to the + repository: + + public interface JobRepository { + + public JobExecution createJobExecution(Job job, JobParameters jobParameters) + throws JobExecutionAlreadyRunningException, JobRestartException; + + void saveOrUpdate(JobExecution jobExecution); + + void saveOrUpdate(StepExecution stepExecution); + + void saveOrUpdateExecutionContext(StepExecution stepExecution); + + StepExecution getLastStepExecution(JobInstance jobInstance, Step step); + + int getStepExecutionCount(JobInstance jobInstance, Step step); + +} + +
+ +
+ JobLauncher + + JobLauncher represents a simple interface for + launching a Job with a given set of + JobParameters: + + public interface JobLauncher { + + public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, + JobRestartException; +} + + + It is expected that implementations will obtain a valid + JobExecution fromt he + JobRepository and execute the + Job.
@@ -708,6 +746,17 @@ various implementations can be found in Chatper 3.
+
+ Tasklet + + A Tasklet represents the execution of a + logical unit of work, as defined by its implementation of the Spring Batch + provided Tasklet interface. A + Tasklet is useful for encapsulating processing + logic that is not natural to split into read-(transform)-write phases, + such as invoking a system command or a stored procedure. +
+
High Level Processing Flow diff --git a/docs/src/site/docbook/reference/execution.xml b/docs/src/site/docbook/reference/execution.xml index b94899802..fa576fe33 100644 --- a/docs/src/site/docbook/reference/execution.xml +++ b/docs/src/site/docbook/reference/execution.xml @@ -2,101 +2,97 @@ - The Batch Execution Environment + Executing A Job -
- Introduction +
+ Introduction - - The "execution" layer is fertile ground for collaboration and contributions from the community and from - projects in the field. There is lifecycle support for starting and stopping jobs. The vision for this is - that there can be multiple implementations of this interface providing different architectural patterns, and - delivering different levels of scalability and robustness, without changing either the business logic or the - job configuration. The 1.0 release of Spring Batch has an implementation of the core API that is targeted at - a single VM. - + The "execution" layer is fertile ground for collaboration and + contributions from the community and from projects in the field. There is + lifecycle support for starting and stopping jobs. The vision for this is + that there can be multiple implementations of this interface providing + different architectural patterns, and delivering different levels of + scalability and robustness, without changing either the business logic or + the job configuration. The 1.0 release of Spring Batch has an + implementation of the core API that is targeted at a single VM. - - The execution environment is responsible for providing implementations of the core domain concepts. This - includes: - - - - Run Tier - Implement the bootstrapping and launching of the Execution Environment. - + The execution environment is responsible for providing + implementations of the core domain concepts. This includes: - - Job Tier - Implement the Job and Step strategies. - + + + Run Tier - Implement the bootstrapping and launching of the + Execution Environment. + - - Application Tier - Implement the ItemReader and ItemWriter (or Tasklet) strategies. - + + Job Tier - Implement the Job and Step strategies. + - - - Data Tier - Implement a Repository solution for storing the persistence state of the batch domain. - - - - - We will describe the flow of the simple batch execution envrionment that is provided with spring-batch to - clarify the sequence of processing in the batch environment. The simple batch execution environment is a - concrete implementation of the core interfaces. The flow of a job through the execution environment is as - follows. - - - - - In the Run Tier, a single Java Project may have one or more Jobs. Jobs are configured with the Job - bean. - - + + Application Tier - Implement the ItemReader and ItemWriter (or + Tasklet) strategies. + - - - A single Job must contain at least one Step. Steps are configured with various flavours of Step - FactoryBean. If more than one step is configured for a Job, then they are executed serially and - after the previous step (all of its items / records) is complete. A Job is also responsible for - providing registered JobListener instances with callbacks before and after the job execution. - - + + Data Tier - Implement a Repository solution for storing the + persistence state of the batch domain. + + - - - Steps are responsible for executing business logic and recording progress in a StepExecution. - - + We will describe the flow of the simple batch execution envrionment + that is provided with spring-batch to clarify the sequence of processing + in the batch environment. The simple batch execution environment is a + concrete implementation of the core interfaces. The flow of a job through + the execution environment is as follows. - - - Steps are also responsible for managing the lifecycle of ItemStreams that contribute input or output - to the business logic. ItemStreams can be registered with a Step using the factory beans. Any - ItemReader or ItemWRiter injected directly into the factory bean will also be registered - automatically. - - + + + In the Run Tier, a single Java Project may have one or more + Jobs. Jobs are configured with the Job bean. + - - - Steps are also responsible for providing callbacks to the BatchListener family of listeners. These - provide a way for application developers to add additional behaviour to a step, e.g. if a checksum - or footer has to be added to an output file. - - + + A single Job must contain at least one Step. Steps are + configured with various flavours of Step FactoryBean. If more than one + step is configured for a Job, then they are executed serially and + after the previous step (all of its items / records) is complete. A + Job is also responsible for providing registered JobListener instances + with callbacks before and after the job execution. + - -
+ + Steps are responsible for executing business logic and recording + progress in a StepExecution. + -
- Simple Batch Execution Environment - -
+ + Steps are also responsible for managing the lifecycle of + ItemStreams that contribute input or output to the business logic. + ItemStreams can be registered with a Step using the factory beans. Any + ItemReader or ItemWRiter injected directly into the factory bean will + also be registered automatically. + -
- Configuration - - + + Steps are also responsible for providing callbacks to the + BatchListener family of listeners. These provide a way for application + developers to add additional behaviour to a step, e.g. if a checksum + or footer has to be added to an output file. + + +
+ +
+ Simple Job Execution Flow + + +
+ +
+ Configuration + + <property name="itemProvider"> <bean class="org.springframework.batch.sample.item.provider.PlayerItemProvider"> <property name="inputSource" ref="playerFileInputSource" /> @@ -105,14 +101,12 @@ </property> </bean> </property> - - + - The LineTokenizer is just one additional property to the - InputSource as seen here: + The LineTokenizer is just one additional property to the InputSource + as seen here: - - + <property name="tokenizer"> <bean class="org.springframework.batch.io.file.support.transform.DelimitedLineTokenizer"> @@ -120,9 +114,6 @@ value="ID,lastName,firstName,position,birthYear,debutYear" /> </bean> </property> - - - -
- - + +
+
\ No newline at end of file diff --git a/docs/src/site/resources/reference/images/spring-batch-reference-model.png b/docs/src/site/resources/reference/images/spring-batch-reference-model.png index ae1ff22ef..39d963a75 100755 Binary files a/docs/src/site/resources/reference/images/spring-batch-reference-model.png and b/docs/src/site/resources/reference/images/spring-batch-reference-model.png differ