diff --git a/spring-batch-docs/asciidoc/common-patterns.adoc b/spring-batch-docs/asciidoc/common-patterns.adoc index 99bc39535..bea1b1003 100644 --- a/spring-batch-docs/asciidoc/common-patterns.adoc +++ b/spring-batch-docs/asciidoc/common-patterns.adoc @@ -382,7 +382,7 @@ from `read`, an `Integer` is returned. This number can then be used to query for image::{batch-asciidoc}images/drivingQueryJob.png[Driving Query Example, scaledwidth="60%"] An `ItemProcessor` should be used to transform the key obtained from the driving query -into a full 'Foo' object. An existing DAO can be used to query for the full object based +into a full `Foo` object. An existing DAO can be used to query for the full object based on the key. [[multiLineRecords]] @@ -602,7 +602,7 @@ public class NoWorkFoundStepExecutionListener extends StepExecutionListenerSuppo The preceding `StepExecutionListener` inspects the `readCount` property of the `StepExecution` during the 'afterStep' phase to determine if no items were read. If that -is the case, an exit code of FAILED is returned, indicating that the `Step` should fail. +is the case, an exit code `FAILED` is returned, indicating that the `Step` should fail. Otherwise, `null` is returned, which does not affect the status of the `Step`. [[passingDataToFutureSteps]] @@ -699,7 +699,7 @@ public Step step1() { public ExecutionContextPromotionListener promotionListener() { ExecutionContextPromotionListener listener = new ExecutionContextPromotionListener(); - listener.setKeys(new String[] {"someKey" }); + listener.setKeys(new String[] {"someKey"}); return listener; } diff --git a/spring-batch-docs/asciidoc/images/drivingQueryJob.png b/spring-batch-docs/asciidoc/images/drivingQueryJob.png index 175269eed..878e4b895 100644 Binary files a/spring-batch-docs/asciidoc/images/drivingQueryJob.png and b/spring-batch-docs/asciidoc/images/drivingQueryJob.png differ diff --git a/spring-batch-docs/asciidoc/images/job-launcher-sequence-async.png b/spring-batch-docs/asciidoc/images/job-launcher-sequence-async.png index e993c4ad7..d2a7a40e3 100644 Binary files a/spring-batch-docs/asciidoc/images/job-launcher-sequence-async.png and b/spring-batch-docs/asciidoc/images/job-launcher-sequence-async.png differ diff --git a/spring-batch-docs/asciidoc/images/job-launcher-sequence-sync.png b/spring-batch-docs/asciidoc/images/job-launcher-sequence-sync.png index ba2af9294..0461e7a25 100644 Binary files a/spring-batch-docs/asciidoc/images/job-launcher-sequence-sync.png and b/spring-batch-docs/asciidoc/images/job-launcher-sequence-sync.png differ diff --git a/spring-batch-docs/asciidoc/images/jobTier.png b/spring-batch-docs/asciidoc/images/jobTier.png deleted file mode 100644 index ddae9cb16..000000000 Binary files a/spring-batch-docs/asciidoc/images/jobTier.png and /dev/null differ diff --git a/spring-batch-docs/asciidoc/job.adoc b/spring-batch-docs/asciidoc/job.adoc index e35819e88..79222c54b 100644 --- a/spring-batch-docs/asciidoc/job.adoc +++ b/spring-batch-docs/asciidoc/job.adoc @@ -274,10 +274,10 @@ It should be noted that `afterJob` will be [source, java] ---- public void afterJob(JobExecution jobExecution){ - if( jobExecution.getStatus() == BatchStatus.COMPLETED ){ + if (jobExecution.getStatus() == BatchStatus.COMPLETED ) { //job success } - else if(jobExecution.getStatus() == BatchStatus.FAILED){ + else if (jobExecution.getStatus() == BatchStatus.FAILED) { //job failure } } diff --git a/spring-batch-docs/asciidoc/readersAndWriters.adoc b/spring-batch-docs/asciidoc/readersAndWriters.adoc index f791663ee..fba836b8d 100644 --- a/spring-batch-docs/asciidoc/readersAndWriters.adoc +++ b/spring-batch-docs/asciidoc/readersAndWriters.adoc @@ -60,7 +60,7 @@ However, if the underlying resource is transactional (such as a JMS queue) then `read` may return the same logical item on subsequent calls in a rollback scenario. It is also worth noting that a lack of items to process by an `ItemReader` does not cause an exception to be thrown. For example, a database `ItemReader` that is configured with a -query that returns 0 results returns `null` on the first invocation of read. +query that returns 0 results returns `null` on the first invocation of `read`. [[itemWriter]] === `ItemWriter` @@ -155,14 +155,14 @@ public class Bar { public Bar(Foo foo) {} } -public class FooProcessor implements ItemProcessor{ +public class FooProcessor implements ItemProcessor { public Bar process(Foo foo) throws Exception { //Perform simple transformation, convert a Foo to a Bar return new Bar(foo); } } -public class BarWriter implements ItemWriter{ +public class BarWriter implements ItemWriter { public void write(List bars) throws Exception { //write bars } @@ -232,14 +232,14 @@ public class Foobar { public Foobar(Bar bar) {} } -public class FooProcessor implements ItemProcessor{ +public class FooProcessor implements ItemProcessor { public Bar process(Foo foo) throws Exception { //Perform simple transformation, convert a Foo to a Bar return new Bar(foo); } } -public class BarProcessor implements ItemProcessor{ +public class BarProcessor implements ItemProcessor { public Foobar process(Bar bar) throws Exception { return new Foobar(bar); } @@ -261,8 +261,8 @@ A `FooProcessor` and a `BarProcessor` can be 'chained' together to give the resu CompositeItemProcessor compositeProcessor = new CompositeItemProcessor(); List itemProcessors = new ArrayList(); -itemProcessors.add(new FooTransformer()); -itemProcessors.add(new BarTransformer()); +itemProcessors.add(new FooProcessor()); +itemProcessors.add(new BarProcessor()); compositeProcessor.setDelegates(itemProcessors); ---- @@ -528,7 +528,7 @@ creating `Resource` objects beyond showing the following simple example: Resource resource = new FileSystemResource("resources/trades.csv"); ---- -In complex batch environments, the directory structures are often managed by the EAI +In complex batch environments, the directory structures are often managed by the Enterprise Application Integration (EAI) infrastructure, where drop zones for external interfaces are established for moving files from FTP locations to batch processing locations and vice versa. File moving utilities are beyond the scope of the Spring Batch architecture, but it is not unusual for batch @@ -749,8 +749,8 @@ The file can then be read by correctly constructing a `FlatFileItemReader` and c ---- FlatFileItemReader itemReader = new FlatFileItemReader<>(); itemReader.setResource(new FileSystemResource("resources/players.csv")); -//DelimitedLineTokenizer defaults to comma as its delimiter DefaultLineMapper lineMapper = new DefaultLineMapper<>(); +//DelimitedLineTokenizer defaults to comma as its delimiter lineMapper.setLineTokenizer(new DelimitedLineTokenizer()); lineMapper.setFieldSetMapper(new PlayerFieldSetMapper()); itemReader.setLineMapper(lineMapper); @@ -774,7 +774,7 @@ as shown in the following example: [source, java] ---- -tokenizer.setNames(new String[] {"ID", "lastName","firstName","position","birthYear","debutYear"}); +tokenizer.setNames(new String[] {"ID", "lastName", "firstName", "position", "birthYear", "debutYear"}); ---- A `FieldSetMapper` can use this information as follows: @@ -785,7 +785,7 @@ A `FieldSetMapper` can use this information as follows: public class PlayerMapper implements FieldSetMapper { public Player mapFieldSet(FieldSet fs) { - if(fs == null){ + if (fs == null) { return null; } @@ -878,7 +878,7 @@ in the form of ranges, as shown in the following example: [source, xml, role="xmlContent"] ---- + class="org.springframework.batch.item.file.transform.FixedLengthTokenizer"> @@ -905,10 +905,10 @@ public FixedLengthTokenizer fixedLengthTokenizer() { FixedLengthTokenizer tokenizer = new FixedLengthTokenizer(); tokenizer.setNames("ISIN", "Quantity", "Price", "Customer"); - tokenizer.setColumns(new Range(1-12), - new Range(13-15), - new Range(16-20), - new Range(21-29)); + tokenizer.setColumns(new Range(1, 12), + new Range(13, 15), + new Range(16, 20), + new Range(21, 29)); return tokenizer; } @@ -1054,7 +1054,7 @@ tokenizer.setNames(new String[] {"A", "B", "C", "D"}); try { tokenizer.tokenize("a,b,c"); } -catch(IncorrectTokenCountException e){ +catch (IncorrectTokenCountException e) { assertEquals(4, e.getExpectedCount()); assertEquals(3, e.getActualCount()); } @@ -2816,7 +2816,7 @@ reads from a provided list. We start by implementing the most basic contract of [source, java] ---- -public class CustomItemReader implements ItemReader{ +public class CustomItemReader implements ItemReader { List items; @@ -2890,10 +2890,10 @@ public class CustomItemReader implements ItemReader, ItemStream { } public void open(ExecutionContext executionContext) throws ItemStreamException { - if(executionContext.containsKey(CURRENT_INDEX)){ + if (executionContext.containsKey(CURRENT_INDEX)) { currentIndex = new Long(executionContext.getLong(CURRENT_INDEX)).intValue(); } - else{ + else { currentIndex = 0; } } @@ -3221,7 +3221,7 @@ an instance of the `MappingLdifReader`. ===== `AvroItemReader` The `AvroItemReader` reads serialized Avro data from a Resource. Each read returns an instance of the type specified by a Java class or Avro Schema. -The reader may be optionnally configured for input that embeds an Avro schema or not. +The reader may be optionally configured for input that embeds an Avro schema or not. Spring Batch provides an `AvroItemReaderBuilder` to construct an instance of the `AvroItemReader`. [[specializedWriters]] diff --git a/spring-batch-docs/asciidoc/scalability.adoc b/spring-batch-docs/asciidoc/scalability.adoc index 3369ae5e7..ff29b946c 100644 --- a/spring-batch-docs/asciidoc/scalability.adoc +++ b/spring-batch-docs/asciidoc/scalability.adoc @@ -59,7 +59,7 @@ as shown in the following example: [source, java, role="javaContent"] ---- @Bean -public TaskExecutor taskExecutor(){ +public TaskExecutor taskExecutor() { return new SimpleAsyncTaskExecutor("spring_batch"); } @@ -214,7 +214,7 @@ public Flow flow2() { } @Bean -public TaskExecutor taskExecutor(){ +public TaskExecutor taskExecutor() { return new SimpleAsyncTaskExecutor("spring_batch"); } ---- diff --git a/spring-batch-docs/asciidoc/spring-batch-intro.adoc b/spring-batch-docs/asciidoc/spring-batch-intro.adoc index 23619728a..1b0e6649d 100644 --- a/spring-batch-docs/asciidoc/spring-batch-intro.adoc +++ b/spring-batch-docs/asciidoc/spring-batch-intro.adoc @@ -33,7 +33,7 @@ Spring Batch provides reusable functions that are essential in processing large of records, including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management. It also provides more advanced technical services and features that enable extremely high-volume and high performance batch jobs -though optimization and partitioning techniques. Spring Batch can be used in both simple +through optimization and partitioning techniques. Spring Batch can be used in both simple use cases (such as reading a file into a database or running a stored procedure) as well as complex, high volume use cases (such as moving high volumes of data between databases, transforming it, and so on). High-volume batch jobs can leverage the framework in a diff --git a/spring-batch-docs/asciidoc/step.adoc b/spring-batch-docs/asciidoc/step.adoc index d87360a5b..b744c073b 100644 --- a/spring-batch-docs/asciidoc/step.adoc +++ b/spring-batch-docs/asciidoc/step.adoc @@ -495,7 +495,7 @@ the `playerLoad` step contains no additional configuration. It can be started an of times, and, if complete, is skipped. The `gameLoad` step, however, needs to be run every time in case extra files have been added since it last ran. It has 'allow-start-if-complete' set to 'true' in order to always be started. (It is assumed -that the database tables games are loaded into has a process indicator on it, to ensure +that the database table games are loaded into has a process indicator on it, to ensure new games can be properly found by the summarization step). The summarization step, which is the most important in the job, is configured to have a start limit of 2. This is useful because if the step continually fails, a new exit code is returned to the diff --git a/spring-batch-docs/asciidoc/testing.adoc b/spring-batch-docs/asciidoc/testing.adoc index e355e184f..916ec7a5f 100644 --- a/spring-batch-docs/asciidoc/testing.adoc +++ b/spring-batch-docs/asciidoc/testing.adoc @@ -159,7 +159,7 @@ public class SkipSampleFunctionalTests { === Testing Individual Steps For complex batch jobs, test cases in the end-to-end testing - approach may become unmanageable. It these cases, it may be more useful to + approach may become unmanageable. In these cases, it may be more useful to have test cases to test individual steps on their own. The `JobLauncherTestUtils` class contains a method called `launchStep`, which takes a step name and runs just