Skip to content

Commit 9692eb7

Browse files
committed
Merge pull request javaee-samples#289 from rafabene/JDF-802
Applied some standartization
2 parents 688c6c0 + 034513f commit 9692eb7

File tree

933 files changed

+9746
-7988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

933 files changed

+9746
-7988
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ target/
55
libs/
66
tmp/
77
node_modules/
8+
jaxws/jaxws-client/src/main/
89

910
# OS Files #
1011
.DS_Store

batch/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Java EE 7 Samples: Batch #
2+
3+
The [JSR 352](https://jcp.org/en/jsr/detail?id=352) specifies a programming model for batch applications and a runtime for scheduling and executing jobs.
4+
5+
## Samples ##
6+
7+
- batchlet-simple
8+
- chunk-checkpoint
9+
- chunk-csv-database
10+
- chunk-exception
11+
- chunk-mapper
12+
- chunk-optional-processor
13+
- chunk-partition
14+
- chunk-simple
15+
- decision
16+
- flow
17+
- batch-listeners
18+
- multiple-steps
19+
- split
20+
- chunk-simple-nobeans
21+
- scheduling
22+
23+
## How to run
24+
25+
More information on how to run can be found at: <https://github.com/javaee-samples/javaee7-samples#how-to-run->
26+
27+

batch/batch-listeners/pom.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4+
45
<parent>
5-
<groupId>org.javaee7.batch</groupId>
6-
<artifactId>batch-samples</artifactId>
6+
<groupId>org.javaee7</groupId>
7+
<artifactId>batch</artifactId>
78
<version>1.0-SNAPSHOT</version>
89
<relativePath>../pom.xml</relativePath>
910
</parent>
10-
11-
<artifactId>batch-listeners</artifactId>
11+
<artifactId>batch-batch-listeners</artifactId>
1212
<packaging>war</packaging>
13-
<name>Batch Listeners</name>
13+
<name>Java EE 7 Sample: batch - batch-listeners</name>
1414
<description>Batch Listeners - Applying Listeners to Job, Chunk, Step, Reader, Processor and Writer</description>
1515

1616
<dependencies>
1717
<dependency>
1818
<groupId>org.javaee7</groupId>
19-
<artifactId>util-samples</artifactId>
19+
<artifactId>util</artifactId>
2020
</dependency>
2121
</dependencies>
2222
</project>

batch/batch-listeners/src/main/java/org/javaee7/batch/batch/listeners/MyInputRecord.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
*/
66
public class MyInputRecord {
77
private int id;
8-
9-
public MyInputRecord() { }
10-
8+
9+
public MyInputRecord() {
10+
}
11+
1112
public MyInputRecord(int id) {
1213
this.id = id;
1314
}
@@ -19,7 +20,7 @@ public int getId() {
1920
public void setId(int id) {
2021
this.id = id;
2122
}
22-
23+
2324
@Override
2425
public String toString() {
2526
return "MyInputRecord: " + id;

batch/batch-listeners/src/main/java/org/javaee7/batch/batch/listeners/MyItemProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class MyItemProcessor implements ItemProcessor {
1212
@Override
1313
public Object processItem(Object t) {
1414
System.out.println("processItem: " + t);
15-
16-
return (((MyInputRecord)t).getId() % 2 == 0) ? null : new MyOutputRecord(((MyInputRecord)t).getId() * 2);
15+
16+
return (((MyInputRecord) t).getId() % 2 == 0) ? null : new MyOutputRecord(((MyInputRecord) t).getId() * 2);
1717
}
1818
}

batch/batch-listeners/src/main/java/org/javaee7/batch/batch/listeners/MyItemReader.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
*/
1010
@Named
1111
public class MyItemReader extends AbstractItemReader {
12-
12+
1313
private final StringTokenizer tokens;
14-
14+
1515
public MyItemReader() {
1616
tokens = new StringTokenizer("1,2,3,4,5,6,7,8,9,10", ",");
1717
}
18-
18+
1919
@Override
2020
public MyInputRecord readItem() {
2121
if (tokens.hasMoreTokens()) {

batch/batch-listeners/src/main/java/org/javaee7/batch/batch/listeners/MyOutputRecord.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
*/
66
public class MyOutputRecord {
77
private int id;
8-
9-
public MyOutputRecord() { }
10-
8+
9+
public MyOutputRecord() {
10+
}
11+
1112
public MyOutputRecord(int id) {
1213
this.id = id;
1314
}
@@ -19,7 +20,7 @@ public int getId() {
1920
public void setId(int id) {
2021
this.id = id;
2122
}
22-
23+
2324
@Override
2425
public String toString() {
2526
return "MyOutputRecord: " + id;

batch/batch-listeners/src/test/java/org/javaee7/batch/batch/listeners/BatchListenersTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ public class BatchListenersTest {
9393
@Deployment
9494
public static WebArchive createDeployment() {
9595
WebArchive war = ShrinkWrap.create(WebArchive.class)
96-
.addClass(BatchTestHelper.class)
97-
.addPackage("org.javaee7.batch.batch.listeners")
98-
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
99-
.addAsResource("META-INF/batch-jobs/myJob.xml");
96+
.addClass(BatchTestHelper.class)
97+
.addPackage("org.javaee7.batch.batch.listeners")
98+
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
99+
.addAsResource("META-INF/batch-jobs/myJob.xml");
100100
System.out.println(war.toString(true));
101101
return war;
102102
}

batch/batchlet-simple/pom.xml

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33

44
<modelVersion>4.0.0</modelVersion>
5+
56
<parent>
6-
<groupId>org.javaee7.batch</groupId>
7-
<artifactId>batch-samples</artifactId>
7+
<groupId>org.javaee7</groupId>
8+
<artifactId>batch</artifactId>
89
<version>1.0-SNAPSHOT</version>
910
<relativePath>../pom.xml</relativePath>
1011
</parent>
11-
12-
<artifactId>batchlet-simple</artifactId>
12+
<artifactId>batch-batchlet-simple</artifactId>
1313
<packaging>war</packaging>
14-
<name>Batchlet Simple</name>
14+
<name>Java EE 7 Sample: batch - batchlet-simple</name>
1515
<description>Batchlet Simple - Execute a task oriented step</description>
1616

1717
<dependencies>
1818
<dependency>
1919
<groupId>org.javaee7</groupId>
20-
<artifactId>util-samples</artifactId>
20+
<artifactId>util</artifactId>
2121
</dependency>
2222
</dependencies>
2323
</project>
24-

batch/batchlet-simple/src/test/java/org/javaee7/batch/batchlet/simple/MyBatchletTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ public class MyBatchletTest {
5252
@Deployment
5353
public static WebArchive createDeployment() {
5454
WebArchive war = ShrinkWrap.create(WebArchive.class)
55-
.addClass(BatchTestHelper.class)
56-
.addClass(MyBatchlet.class)
57-
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
58-
.addAsResource("META-INF/batch-jobs/myJob.xml");
55+
.addClass(BatchTestHelper.class)
56+
.addClass(MyBatchlet.class)
57+
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
58+
.addAsResource("META-INF/batch-jobs/myJob.xml");
5959
System.out.println(war.toString(true));
6060
return war;
6161
}

batch/chunk-checkpoint/pom.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33

44
<modelVersion>4.0.0</modelVersion>
5+
56
<parent>
6-
<groupId>org.javaee7.batch</groupId>
7-
<artifactId>batch-samples</artifactId>
7+
<groupId>org.javaee7</groupId>
8+
<artifactId>batch</artifactId>
89
<version>1.0-SNAPSHOT</version>
910
<relativePath>../pom.xml</relativePath>
1011
</parent>
11-
12-
<artifactId>chunk-checkpoint</artifactId>
12+
<artifactId>batch-chunk-checkpoint</artifactId>
1313
<packaging>war</packaging>
14-
<name>Batch Chunk Checkpoint</name>
14+
<name>Java EE 7 Sample: batch - chunk-checkpoint</name>
1515
<description>Chunk Checkpoint - Custom Checkpoint Policy</description>
1616

1717
<dependencies>
1818
<dependency>
1919
<groupId>org.javaee7</groupId>
20-
<artifactId>util-samples</artifactId>
20+
<artifactId>util</artifactId>
2121
</dependency>
2222
</dependencies>
2323
</project>

batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/MyInputRecord.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
*/
66
public class MyInputRecord {
77
private int id;
8-
9-
public MyInputRecord() { }
10-
8+
9+
public MyInputRecord() {
10+
}
11+
1112
public MyInputRecord(int id) {
1213
this.id = id;
1314
}
@@ -19,7 +20,7 @@ public int getId() {
1920
public void setId(int id) {
2021
this.id = id;
2122
}
22-
23+
2324
@Override
2425
public String toString() {
2526
return "MyInputRecord: " + id;

batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/MyItemProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class MyItemProcessor implements ItemProcessor {
1212
@Override
1313
public MyOutputRecord processItem(Object t) {
1414
System.out.println("processItem: " + t);
15-
16-
return (((MyInputRecord)t).getId() % 2 == 0) ? null : new MyOutputRecord(((MyInputRecord)t).getId() * 2);
15+
16+
return (((MyInputRecord) t).getId() % 2 == 0) ? null : new MyOutputRecord(((MyInputRecord) t).getId() * 2);
1717
}
1818
}

batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/MyItemReader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
*/
1111
@Named
1212
public class MyItemReader extends AbstractItemReader {
13-
13+
1414
private StringTokenizer tokens;
1515
static int COUNT = 0;
1616

1717
@Override
1818
public void open(Serializable checkpoint) throws Exception {
1919
tokens = new StringTokenizer("1,2,3,4,5,6,7,8,9,10", ",");
2020
}
21-
21+
2222
@Override
2323
public MyInputRecord readItem() {
2424
if (tokens.hasMoreTokens()) {

batch/chunk-checkpoint/src/main/java/org/javaee7/batch/chunk/checkpoint/MyOutputRecord.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
*/
66
public class MyOutputRecord {
77
private int id;
8-
9-
public MyOutputRecord() { }
10-
8+
9+
public MyOutputRecord() {
10+
}
11+
1112
public MyOutputRecord(int id) {
1213
this.id = id;
1314
}
@@ -19,7 +20,7 @@ public int getId() {
1920
public void setId(int id) {
2021
this.id = id;
2122
}
22-
23+
2324
@Override
2425
public String toString() {
2526
return "MyOutputRecord: " + id;

batch/chunk-checkpoint/src/main/resources/META-INF/batch-jobs/myJob.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<processor ref="myItemProcessor"/>
77
<writer ref="myItemWriter"/>
88
<checkpoint-algorithm ref="myCheckpointAlgorithm"/>
9-
</chunk>
9+
</chunk>
1010
</step>
1111
</job>
1212

batch/chunk-checkpoint/src/test/java/org/javaee7/batch/chunk/checkpoint/BatchChunkCheckpointTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ public class BatchChunkCheckpointTest {
6060
@Deployment
6161
public static WebArchive createDeployment() {
6262
WebArchive war = ShrinkWrap.create(WebArchive.class)
63-
.addClass(BatchTestHelper.class)
64-
.addPackage("org.javaee7.batch.chunk.checkpoint")
65-
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
66-
.addAsResource("META-INF/batch-jobs/myJob.xml");
63+
.addClass(BatchTestHelper.class)
64+
.addPackage("org.javaee7.batch.chunk.checkpoint")
65+
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
66+
.addAsResource("META-INF/batch-jobs/myJob.xml");
6767
System.out.println(war.toString(true));
6868
return war;
6969
}

batch/chunk-csv-database/pom.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33

44
<modelVersion>4.0.0</modelVersion>
5+
56
<parent>
6-
<groupId>org.javaee7.batch</groupId>
7-
<artifactId>batch-samples</artifactId>
7+
<groupId>org.javaee7</groupId>
8+
<artifactId>batch</artifactId>
89
<version>1.0-SNAPSHOT</version>
910
<relativePath>../pom.xml</relativePath>
1011
</parent>
11-
12-
<artifactId>chunk-csv-database</artifactId>
12+
<artifactId>batch-chunk-csv-database</artifactId>
1313
<packaging>war</packaging>
14-
<name>Batch Chunk CSV Database</name>
14+
<name>Java EE 7 Sample: batch - chunk-csv-database</name>
1515
<description>Chunk Processing - Read, Process, Write to a Database</description>
1616

1717
<dependencies>
1818
<dependency>
1919
<groupId>org.javaee7</groupId>
20-
<artifactId>util-samples</artifactId>
20+
<artifactId>util</artifactId>
2121
</dependency>
2222
</dependencies>
2323
</project>

batch/chunk-csv-database/src/main/java/org/javaee7/batch/chunk/csv/database/MyItemProcessor.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ public class MyItemProcessor implements ItemProcessor {
1717
@Override
1818
public Person processItem(Object t) {
1919
System.out.println("processItem: " + t);
20-
21-
StringTokenizer tokens = new StringTokenizer((String)t, ",");
20+
21+
StringTokenizer tokens = new StringTokenizer((String) t, ",");
2222

2323
String name = tokens.nextToken();
2424
String date;
25-
25+
2626
try {
2727
date = tokens.nextToken();
2828
format.setLenient(false);
2929
format.parse(date);
3030
} catch (ParseException e) {
3131
return null;
3232
}
33-
33+
3434
return new Person(id++, name, date);
3535
}
3636
}

0 commit comments

Comments
 (0)