BATCH-676: Added sample jobs for non sequential execution and decisions

This commit is contained in:
lucasward
2008-11-07 20:46:57 +00:00
parent a5fdbfedaf
commit 7d5e2d14c1
22 changed files with 535 additions and 15 deletions

View File

@@ -21,6 +21,11 @@
<artifactId>org.springframework.batch.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>org.springframework.batch.test</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>com.springsource.org.aspectj.runtime</artifactId>

View File

@@ -0,0 +1,26 @@
package org.springframework.batch.sample.domain.nonSequential.internal;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.core.AttributeAccessor;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
public class ErrorLogWriter implements Tasklet {
protected final Log logger = LogFactory.getLog(getClass());
private SimpleJdbcTemplate simpleJdbcTemplate;
public ExitStatus execute(StepContribution contribution, AttributeAccessor attributes) throws Exception {
this.simpleJdbcTemplate.update("insert into ERROR_LOG values ('Some records were skipped!')");
return ExitStatus.FINISHED;
}
public void setDataSource(DataSource dataSource) {
this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
}
}

View File

@@ -0,0 +1,18 @@
package org.springframework.batch.sample.domain.nonSequential.internal;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider;
public class SkipCheckingDecider implements JobExecutionDecider {
public String decide(JobExecution jobExecution, StepExecution stepExecution) {
if (!stepExecution.getExitStatus().getExitCode().equals(ExitStatus.FAILED.getExitCode())
&& stepExecution.getSkipCount() > 0) {
return "COMPLETED WITH SKIPS";
} else {
return ExitStatus.FINISHED.getExitCode();
}
}
}

View File

@@ -0,0 +1,20 @@
package org.springframework.batch.sample.domain.nonSequential.internal;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
public class SkipCheckingListener implements StepExecutionListener {
public ExitStatus afterStep(StepExecution stepExecution) {
if (!stepExecution.getExitStatus().getExitCode().equals(ExitStatus.FAILED.getExitCode())
&& stepExecution.getSkipCount() > 0) {
return new ExitStatus(false, "COMPLETED WITH SKIPS");
} else {
return null;
}
}
public void beforeStep(StepExecution stepExecution) {
}
}

View File

@@ -8,6 +8,7 @@ DROP TABLE CUSTOMER ;
DROP TABLE PLAYERS ;
DROP TABLE GAMES ;
DROP TABLE PLAYER_SUMMARY ;
DROP TABLE ERROR_LOG ;
-- Autogenerated: do not edit this file
@@ -83,4 +84,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS BIGINT NOT NULL ,
RECEPTIONS_YARDS BIGINT NOT NULL ,
TOTAL_TD BIGINT NOT NULL
) ;
) ;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) ;

View File

@@ -8,6 +8,7 @@ DROP TABLE CUSTOMER ;
DROP TABLE PLAYERS ;
DROP TABLE GAMES ;
DROP TABLE PLAYER_SUMMARY ;
DROP TABLE ERROR_LOG ;
-- Autogenerated: do not edit this file
@@ -83,4 +84,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS BIGINT NOT NULL ,
RECEPTIONS_YARDS BIGINT NOT NULL ,
TOTAL_TD BIGINT NOT NULL
) ;
) ;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) ;

View File

@@ -8,6 +8,7 @@ DROP TABLE CUSTOMER IF EXISTS;
DROP TABLE PLAYERS IF EXISTS;
DROP TABLE GAMES IF EXISTS;
DROP TABLE PLAYER_SUMMARY IF EXISTS;
DROP TABLE ERROR_LOG IF EXISTS;
-- Autogenerated: do not edit this file
@@ -89,4 +90,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS BIGINT NOT NULL ,
RECEPTIONS_YARDS BIGINT NOT NULL ,
TOTAL_TD BIGINT NOT NULL
) ;
) ;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) ;

View File

@@ -8,6 +8,7 @@ DROP TABLE IF EXISTS CUSTOMER ;
DROP TABLE IF EXISTS PLAYERS ;
DROP TABLE IF EXISTS GAMES ;
DROP TABLE IF EXISTS PLAYER_SUMMARY ;
DROP TABLE IF EXISTS ERROR_LOG ;
-- Autogenerated: do not edit this file
@@ -86,4 +87,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS BIGINT NOT NULL ,
RECEPTIONS_YARDS BIGINT NOT NULL ,
TOTAL_TD BIGINT NOT NULL
) type=InnoDB;
) type=InnoDB;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) type=InnoDB;

View File

@@ -8,6 +8,7 @@ DROP TABLE CUSTOMER ;
DROP TABLE PLAYERS ;
DROP TABLE GAMES ;
DROP TABLE PLAYER_SUMMARY ;
DROP TABLE ERROR_LOG ;
-- Autogenerated: do not edit this file
@@ -83,4 +84,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS NUMBER(38) NOT NULL ,
RECEPTIONS_YARDS NUMBER(38) NOT NULL ,
TOTAL_TD NUMBER(38) NOT NULL
) ;
) ;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) ;

View File

@@ -8,6 +8,7 @@ DROP TABLE CUSTOMER ;
DROP TABLE PLAYERS ;
DROP TABLE GAMES ;
DROP TABLE PLAYER_SUMMARY ;
DROP TABLE ERROR_LOG ;
-- Autogenerated: do not edit this file
@@ -83,4 +84,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS BIGINT NOT NULL ,
RECEPTIONS_YARDS BIGINT NOT NULL ,
TOTAL_TD BIGINT NOT NULL
) ;
) ;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) ;

View File

@@ -8,12 +8,13 @@ DROP TABLE CUSTOMER ;
DROP TABLE PLAYERS ;
DROP TABLE GAMES ;
DROP TABLE PLAYER_SUMMARY ;
DROP TABLE ERROR_LOG ;
-- Autogenerated: do not edit this file
CREATE TABLE CUSTOMER_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT IDENTITY);
CREATE TABLE TRADE_SEQ (ID BIGINT IDENTITY);
CREATE TABLE CUSTOMER_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT IDENTITY);
CREATE TABLE TRADE_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_STAGING (
ID BIGINT NOT NULL PRIMARY KEY ,
@@ -83,4 +84,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS BIGINT NOT NULL ,
RECEPTIONS_YARDS BIGINT NOT NULL ,
TOTAL_TD BIGINT NOT NULL
) ;
) ;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) ;

View File

@@ -8,12 +8,13 @@ DROP TABLE CUSTOMER ;
DROP TABLE PLAYERS ;
DROP TABLE GAMES ;
DROP TABLE PLAYER_SUMMARY ;
DROP TABLE ERROR_LOG ;
-- Autogenerated: do not edit this file
CREATE TABLE CUSTOMER_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT IDENTITY);
CREATE TABLE TRADE_SEQ (ID BIGINT IDENTITY);
CREATE TABLE CUSTOMER_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT IDENTITY);
CREATE TABLE TRADE_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_STAGING (
ID BIGINT NOT NULL PRIMARY KEY ,
@@ -83,4 +84,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS BIGINT NOT NULL ,
RECEPTIONS_YARDS BIGINT NOT NULL ,
TOTAL_TD BIGINT NOT NULL
) ;
) ;
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) ;

View File

@@ -0,0 +1,79 @@
AbduKa00,1998,mia,6,jax,0,0,0,0,0,21,43,0,0,1
AbduKa00,1998,mia,7,ram,0,0,0,0,0,17,59,2,12,0
AbduKa00,1998,mia,8,nwe,0,0,0,0,0,21,56,3,12,0
AbduKa00,1998,mia,9,buf,0,0,0,0,0,22,97,2,9,1
AbduKa00,1999,cle,10,pit,0,0,0,0,0,18,56,1,7,0
AbduKa00,1999,cle,11,car,0,0,0,0,0,7,11,2,2,0
AbduKa00,1999,cle,12,oti,0,0,0,0,0,15,35,1,1,0
AbduKa00,1999,cle,13,sdg,0,0,0,0,0,10,29,1,21,0
AbduKa00,1999,cle,14,cin,0,0,0,0,0,5,10,2,7,1
AbduKa00,1999,cle,15,jax,0,0,0,0,0,13,36,1,4,0
AbduKa00,1999,cle,16,clt,0,0,0,0,0,19,84,2,7,0
AbduKa00,1999,cle,1,den,0,0,0,0,0,16,60,1,7,1
AbduKa00,1999,cle,2,crd,0,0,0,0,0,9,33,3,18,0
AbduKa00,1999,cle,4,buf,0,0,0,0,0,3,2,0,0,0
AbduKa00,1999,cle,7,ram,0,0,0,0,0,6,27,2,8,0
AbduKa00,1999,cle,8,nor,0,0,0,0,0,13,39,0,0,0
AbduKa00,1999,cle,9,rav,0,0,0,0,0,9,23,1,2,0
AbduKa00,2000,clt,1,kan,0,0,0,0,0,1,-2,0,0,0
AbduRa00,1999,tam,13,min,0,0,0,0,0,0,0,1,3,0
AbduRa00,1999,tam,15,rai,0,0,0,0,0,4,12,0,0,0
AbduRa00,1999,tam,1,nyg,0,0,0,0,0,1,0,0,0,0
AbduRa00,1999,tam,8,det,0,0,0,0,0,0,0,1,8,0
AbduRa00,2000,tam,12,chi,0,0,0,0,0,2,18,0,0,0
AbduRa00,2000,tam,14,dal,0,0,0,0,0,10,38,1,11,0
AbduRa00,2000,tam,15,mia,0,0,0,0,0,4,14,0,0,0
AbduRa00,2000,tam,1,nwe,0,0,0,0,0,0,0,1,3,0
AbduRa00,2001,tam,15,nor,0,0,0,0,0,3,6,0,0,0
AbduRa00,2001,tam,17,phi,0,0,0,0,0,8,34,2,26,0
AbduRa00,2003,chi,10,det,0,0,0,0,0,2,3,1,7,0
AbduRa00,2003,chi,11,ram,0,0,0,0,0,1,1,0,0,0
AbduRa00,2003,chi,13,crd,0,0,0,0,0,1,0,0,0,0
AbduRa00,2003,chi,14,gnb,0,0,0,0,0,2,3,1,5,0
AbduRa00,2003,chi,15,min,0,0,0,0,0,1,3,0,0,0
AbduRa00,2003,chi,17,kan,0,0,0,0,0,2,8,2,19,0
AbduRa00,2003,chi,2,min,0,0,0,0,0,1,2,2,10,0
AbduRa00,2003,chi,4,gnb,0,0,0,0,0,1,-4,2,14,0
AbduRa00,2003,chi,5,rai,0,0,0,0,0,2,8,0,0,0
AbduRa00,2003,chi,7,sea,0,0,0,0,0,3,4,0,0,0
AbduRa00,2003,chi,8,det,0,0,0,0,0,1,6,0,0,0
AbduRa00,2003,chi,9,sdg,0,0,0,0,0,1,3,0,0,0
AbduRa00,2004,nwe,10,buf,0,0,0,0,0,4,-5,0,0,0
AbduRa00,2004,nwe,16,nyj,0,0,0,0,0,1,5,0,0,0
AbduRa00,2004,nwe,17,sfo,0,0,0,0,0,2,5,0,0,0
AbduRa00,2004,nwe,2,crd,0,0,0,0,0,1,4,0,0,0
AbduRa00,2004,nwe,5,mia,0,0,0,0,0,5,4,0,0,1
AbduRa00,2004,nwe,6,sea,0,0,0,0,0,0,0,1,9,0
AdamCh00,2005,den,10,rai,0,0,0,0,0,2,5,0,0,0
AdamCh00,2005,den,11,nyj,0,0,0,0,0,1,3,2,21,0
AdamCh00,2005,den,12,dal,0,0,0,0,0,0,0,1,7,0
AdamCh00,2005,den,13,kan,0,0,0,0,0,0,0,0,0,0
AdamCh00,2005,den,14,rav,0,0,0,0,0,0,0,3,35,0
AdamCh00,2005,den,15,buf,0,0,0,0,0,0,0,0,0,0
AdamCh00,2005,den,16,rai,0,0,0,0,0,1,-7,0,0,0
AdamCh00,2005,den,17,sdg,0,0,0,0,0,0,0,2,6,0
AdamCh00,2005,den,1,mia,0,0,0,0,0,0,0,2,35,0
AdamCh00,2005,den,2,sdg,0,0,0,0,0,0,0,3,31,0
AdamCh00,2005,den,3,kan,0,0,0,0,0,0,0,2,23,0
AdamCh00,2005,den,4,jax,0,0,0,0,0,1,13,1,9,0
AdamCh00,2005,den,5,was,0,0,0,0,0,0,0,2,11,0
AdamCh00,2005,den,6,nwe,0,0,0,0,0,0,0,0,0,0
AdamCh00,2005,den,7,nyg,0,0,0,0,0,0,0,0,0,0
AdamCh00,2005,den,8,phi,0,0,0,0,0,0,0,3,25,0
AdamMi00,1997,pit,5,oti,0,0,0,0,0,0,0,1,39,0
AddaJo00,2006,clt,10,buf,0,0,0,0,0,13,78,7,46,1
AddaJo00,2006,clt,11,dal,0,0,0,0,0,13,50,1,7,0
AddaJo00,2006,clt,12,phi,0,0,0,0,0,24,171,2,37,4
AddaJo00,2006,clt,13,oti,0,0,0,0,0,16,56,1,11,0
AddaJo00,2006,clt,14,jax,0,0,0,0,0,11,22,1,14,0
AddaJo00,2006,clt,15,cin,0,0,0,0,0,8,50,2,29,0
AddaJo00,2006,clt,16,htx,0,0,0,0,0,15,100,4,8,0
AddaJo00,2006,clt,17,mia,0,0,0,0,0,21,64,3,29,0
AddaJo00,2006,clt,1,nyg,0,0,0,0,0,7,26,3,22,0
AddaJo00,2006,clt,2,htx,0,0,0,0,0,16,82,2,22,1
AddaJo00,2006,clt,3,jax,0,0,0,0,0,3,15,3,13,0
AddaJo00,2006,clt,4,nyj,0,0,0,0,0,20,84,3,15,1
AddaJo00,2006,clt,5,oti,0,0,0,0,0,13,62,2,15,0
AddaJo00,2006,clt,7,was,0,0,0,0,0,11,85,1,20,0
AddaJo00,2006,clt,8,den,0,0,0,0,0,17,93,5,37,0
AddaJo00,2006,clt,9,nwe,0,0,0,0,0,18,43,0,0,1
1 AbduKa00 1998 mia 6 jax 0 0 0 0 0 21 43 0 0 1
2 AbduKa00 1998 mia 7 ram 0 0 0 0 0 17 59 2 12 0
3 AbduKa00 1998 mia 8 nwe 0 0 0 0 0 21 56 3 12 0
4 AbduKa00 1998 mia 9 buf 0 0 0 0 0 22 97 2 9 1
5 AbduKa00 1999 cle 10 pit 0 0 0 0 0 18 56 1 7 0
6 AbduKa00 1999 cle 11 car 0 0 0 0 0 7 11 2 2 0
7 AbduKa00 1999 cle 12 oti 0 0 0 0 0 15 35 1 1 0
8 AbduKa00 1999 cle 13 sdg 0 0 0 0 0 10 29 1 21 0
9 AbduKa00 1999 cle 14 cin 0 0 0 0 0 5 10 2 7 1
10 AbduKa00 1999 cle 15 jax 0 0 0 0 0 13 36 1 4 0
11 AbduKa00 1999 cle 16 clt 0 0 0 0 0 19 84 2 7 0
12 AbduKa00 1999 cle 1 den 0 0 0 0 0 16 60 1 7 1
13 AbduKa00 1999 cle 2 crd 0 0 0 0 0 9 33 3 18 0
14 AbduKa00 1999 cle 4 buf 0 0 0 0 0 3 2 0 0 0
15 AbduKa00 1999 cle 7 ram 0 0 0 0 0 6 27 2 8 0
16 AbduKa00 1999 cle 8 nor 0 0 0 0 0 13 39 0 0 0
17 AbduKa00 1999 cle 9 rav 0 0 0 0 0 9 23 1 2 0
18 AbduKa00 2000 clt 1 kan 0 0 0 0 0 1 -2 0 0 0
19 AbduRa00 1999 tam 13 min 0 0 0 0 0 0 0 1 3 0
20 AbduRa00 1999 tam 15 rai 0 0 0 0 0 4 12 0 0 0
21 AbduRa00 1999 tam 1 nyg 0 0 0 0 0 1 0 0 0 0
22 AbduRa00 1999 tam 8 det 0 0 0 0 0 0 0 1 8 0
23 AbduRa00 2000 tam 12 chi 0 0 0 0 0 2 18 0 0 0
24 AbduRa00 2000 tam 14 dal 0 0 0 0 0 10 38 1 11 0
25 AbduRa00 2000 tam 15 mia 0 0 0 0 0 4 14 0 0 0
26 AbduRa00 2000 tam 1 nwe 0 0 0 0 0 0 0 1 3 0
27 AbduRa00 2001 tam 15 nor 0 0 0 0 0 3 6 0 0 0
28 AbduRa00 2001 tam 17 phi 0 0 0 0 0 8 34 2 26 0
29 AbduRa00 2003 chi 10 det 0 0 0 0 0 2 3 1 7 0
30 AbduRa00 2003 chi 11 ram 0 0 0 0 0 1 1 0 0 0
31 AbduRa00 2003 chi 13 crd 0 0 0 0 0 1 0 0 0 0
32 AbduRa00 2003 chi 14 gnb 0 0 0 0 0 2 3 1 5 0
33 AbduRa00 2003 chi 15 min 0 0 0 0 0 1 3 0 0 0
34 AbduRa00 2003 chi 17 kan 0 0 0 0 0 2 8 2 19 0
35 AbduRa00 2003 chi 2 min 0 0 0 0 0 1 2 2 10 0
36 AbduRa00 2003 chi 4 gnb 0 0 0 0 0 1 -4 2 14 0
37 AbduRa00 2003 chi 5 rai 0 0 0 0 0 2 8 0 0 0
38 AbduRa00 2003 chi 7 sea 0 0 0 0 0 3 4 0 0 0
39 AbduRa00 2003 chi 8 det 0 0 0 0 0 1 6 0 0 0
40 AbduRa00 2003 chi 9 sdg 0 0 0 0 0 1 3 0 0 0
41 AbduRa00 2004 nwe 10 buf 0 0 0 0 0 4 -5 0 0 0
42 AbduRa00 2004 nwe 16 nyj 0 0 0 0 0 1 5 0 0 0
43 AbduRa00 2004 nwe 17 sfo 0 0 0 0 0 2 5 0 0 0
44 AbduRa00 2004 nwe 2 crd 0 0 0 0 0 1 4 0 0 0
45 AbduRa00 2004 nwe 5 mia 0 0 0 0 0 5 4 0 0 1
46 AbduRa00 2004 nwe 6 sea 0 0 0 0 0 0 0 1 9 0
47 AdamCh00 2005 den 10 rai 0 0 0 0 0 2 5 0 0 0
48 AdamCh00 2005 den 11 nyj 0 0 0 0 0 1 3 2 21 0
49 AdamCh00 2005 den 12 dal 0 0 0 0 0 0 0 1 7 0
50 AdamCh00 2005 den 13 kan 0 0 0 0 0 0 0 0 0 0
51 AdamCh00 2005 den 14 rav 0 0 0 0 0 0 0 3 35 0
52 AdamCh00 2005 den 15 buf 0 0 0 0 0 0 0 0 0 0
53 AdamCh00 2005 den 16 rai 0 0 0 0 0 1 -7 0 0 0
54 AdamCh00 2005 den 17 sdg 0 0 0 0 0 0 0 2 6 0
55 AdamCh00 2005 den 1 mia 0 0 0 0 0 0 0 2 35 0
56 AdamCh00 2005 den 2 sdg 0 0 0 0 0 0 0 3 31 0
57 AdamCh00 2005 den 3 kan 0 0 0 0 0 0 0 2 23 0
58 AdamCh00 2005 den 4 jax 0 0 0 0 0 1 13 1 9 0
59 AdamCh00 2005 den 5 was 0 0 0 0 0 0 0 2 11 0
60 AdamCh00 2005 den 6 nwe 0 0 0 0 0 0 0 0 0 0
61 AdamCh00 2005 den 7 nyg 0 0 0 0 0 0 0 0 0 0
62 AdamCh00 2005 den 8 phi 0 0 0 0 0 0 0 3 25 0
63 AdamMi00 1997 pit 5 oti 0 0 0 0 0 0 0 1 39 0
64 AddaJo00 2006 clt 10 buf 0 0 0 0 0 13 78 7 46 1
65 AddaJo00 2006 clt 11 dal 0 0 0 0 0 13 50 1 7 0
66 AddaJo00 2006 clt 12 phi 0 0 0 0 0 24 171 2 37 4
67 AddaJo00 2006 clt 13 oti 0 0 0 0 0 16 56 1 11 0
68 AddaJo00 2006 clt 14 jax 0 0 0 0 0 11 22 1 14 0
69 AddaJo00 2006 clt 15 cin 0 0 0 0 0 8 50 2 29 0
70 AddaJo00 2006 clt 16 htx 0 0 0 0 0 15 100 4 8 0
71 AddaJo00 2006 clt 17 mia 0 0 0 0 0 21 64 3 29 0
72 AddaJo00 2006 clt 1 nyg 0 0 0 0 0 7 26 3 22 0
73 AddaJo00 2006 clt 2 htx 0 0 0 0 0 16 82 2 22 1
74 AddaJo00 2006 clt 3 jax 0 0 0 0 0 3 15 3 13 0
75 AddaJo00 2006 clt 4 nyj 0 0 0 0 0 20 84 3 15 1
76 AddaJo00 2006 clt 5 oti 0 0 0 0 0 13 62 2 15 0
77 AddaJo00 2006 clt 7 was 0 0 0 0 0 11 85 1 20 0
78 AddaJo00 2006 clt 8 den 0 0 0 0 0 17 93 5 37 0
79 AddaJo00 2006 clt 9 nwe 0 0 0 0 0 18 43 0 0 1

View File

@@ -0,0 +1,20 @@
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
AdamCu00,Adams,Curtis,rb,1962
AdamGe00,Adams,George,rb,1962,1985
AdamGr00,Adams,Grant,2000,2005
AdamJo00,Adams,John,rb,1937,1959
Adams,Michael,wr,1974,1997
AdamMi01,Adamle,Mike,rb,1949,1971
AdamTo00,Adams,Tony,qb,1950,1975
AdamTo01,Adams,Tom,wr,1940,1962
AdamTo02,Adamle,Tony,rb,,1950
AdamWi00,Adams,Willie,wr,1956,1979
AddaJo00,Addai,Joseph,1983,2006,rb
AdkiJa00,Adkisson,James,te,1980,2005
AdkiMa00,Adkins,Margene,wr,1947,1970
AdkiSa00,Adkins,Sam,qb,1955,1977
1 AbduKa00,Abdul-Jabbar,Karim,rb,1974,1996
2 AbduRa00,Abdullah,Rabih,rb,1975,1999
3 AberWa00,Abercrombie,Walter,rb,1959,1982
4 AbraDa00,Abramowicz,Danny,wr,1945,1967
5 AdamBo00,Adams,Bob,te,1946,1969
6 AdamCh00,Adams,Charlie,wr,1979,2003
7 AdamCu00,Adams,Curtis,rb,1962
8 AdamGe00,Adams,George,rb,1962,1985
9 AdamGr00,Adams,Grant,2000,2005
10 AdamJo00,Adams,John,rb,1937,1959
11 Adams,Michael,wr,1974,1997
12 AdamMi01,Adamle,Mike,rb,1949,1971
13 AdamTo00,Adams,Tony,qb,1950,1975
14 AdamTo01,Adams,Tom,wr,1940,1962
15 AdamTo02,Adamle,Tony,rb,,1950
16 AdamWi00,Adams,Willie,wr,1956,1979
17 AddaJo00,Addai,Joseph,1983,2006,rb
18 AdkiJa00,Adkisson,James,te,1980,2005
19 AdkiMa00,Adkins,Margene,wr,1947,1970
20 AdkiSa00,Adkins,Sam,qb,1955,1977

View File

@@ -0,0 +1,20 @@
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
AdamCu00,Adams,Curtis,rb,1962,1985
AdamGe00,Adams,George,rb,1962,1985
AdamGr00,Adams,Grant,wr,2000,2005
AdamJo00,Adams,John,rb,1937,1959
AdamMi00,Adams,Michael,wr,1974,1997
AdamMi01,Adamle,Mike,rb,1949,1971
AdamTo00,Adams,Tony,qb,1950,1975
AdamTo01,Adams,Tom,wr,1940,1962
AdamTo02,Adamle,Tony,rb,1924,1950
AdamWi00,Adams,Willie,wr,1956,1979
AddaJo00,Addai,Joseph,rb,1983,2006
AdkiJa00,Adkisson,James,te,1980,2005
AdkiMa00,Adkins,Margene,wr,1947,1970
AdkiSa00,Adkins,Sam,qb,1955,1977
1 AbduKa00 Abdul-Jabbar Karim rb 1974 1996
2 AbduRa00 Abdullah Rabih rb 1975 1999
3 AberWa00 Abercrombie Walter rb 1959 1982
4 AbraDa00 Abramowicz Danny wr 1945 1967
5 AdamBo00 Adams Bob te 1946 1969
6 AdamCh00 Adams Charlie wr 1979 2003
7 AdamCu00 Adams Curtis rb 1962 1985
8 AdamGe00 Adams George rb 1962 1985
9 AdamGr00 Adams Grant wr 2000 2005
10 AdamJo00 Adams John rb 1937 1959
11 AdamMi00 Adams Michael wr 1974 1997
12 AdamMi01 Adamle Mike rb 1949 1971
13 AdamTo00 Adams Tony qb 1950 1975
14 AdamTo01 Adams Tom wr 1940 1962
15 AdamTo02 Adamle Tony rb 1924 1950
16 AdamWi00 Adams Willie wr 1956 1979
17 AddaJo00 Addai Joseph rb 1983 2006
18 AdkiJa00 Adkisson James te 1980 2005
19 AdkiMa00 Adkins Margene wr 1947 1970
20 AdkiSa00 Adkins Sam qb 1955 1977

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<import resource="nonSequentialJob-base.xml" />
<bean id="skipCheckingDecider" class="org.springframework.batch.sample.domain.nonSequential.internal.SkipCheckingDecider"/>
<batch:job id="nonSequentialDecisionJob">
<batch:step name="playerload">
<batch:next on="*" to="skipCheckingDecision" />
</batch:step>
<batch:decision id="skipCheckingDecision" decider="skipCheckingDecider">
<batch:end on="FAILED" status="FAILED"/>
<batch:next on="COMPLETED WITH SKIPS" to="errorPrint" />
<batch:next on="*" to="gameLoad" />
</batch:decision>
<batch:step name="errorPrint">
<batch:next on="*" to="gameLoad" />
</batch:step>
<batch:step name="gameLoad">
<batch:next on="*" to="playerSummarization" />
</batch:step>
<batch:step name="playerSummarization"/>
</batch:job>
<bean id="footballProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<value>
games.file.name=games-small.csv
<!-- player.file.name=player-small.csv-->
player.file.name=player-containsBadRecords.csv
job.commit.interval=2
</value>
</property>
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="order" value="1" />
</bean>
</beans>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="playerload" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="jobRepository" ref="jobRepository" />
<property name="commitInterval" value="${job.commit.interval}" />
<property name="startLimit" value="100" />
<property name="skipLimit" value="100" />
<property name="itemReader" ref="playerFileItemReader" />
<property name="itemWriter">
<bean class="org.springframework.batch.sample.domain.football.internal.PlayerItemWriter">
<property name="playerDao">
<bean class="org.springframework.batch.sample.domain.football.internal.JdbcPlayerDao">
<property name="dataSource" ref="dataSource" />
</bean>
</property>
</bean>
</property>
<property name="listeners">
<list>
<bean class="org.springframework.batch.sample.domain.nonSequential.internal.SkipCheckingListener"/>
</list>
</property>
</bean>
<bean id="errorPrint" parent="taskletStep">
<property name="tasklet">
<bean class="org.springframework.batch.sample.domain.nonSequential.internal.ErrorLogWriter">
<property name="dataSource" ref="dataSource"/>
</bean>
</property>
</bean>
<bean id="gameLoad" parent="simpleStep">
<property name="itemReader" ref="gameFileItemReader" />
<property name="itemWriter">
<bean class="org.springframework.batch.sample.domain.football.internal.JdbcGameDao">
<property name="dataSource" ref="dataSource" />
</bean>
</property>
<property name="commitInterval" value="${job.commit.interval}" />
</bean>
<bean id="playerSummarization" parent="simpleStep">
<property name="commitInterval" value="${job.commit.interval}" />
<property name="itemReader" ref="playerSummarizationSource" />
<property name="itemWriter">
<bean class="org.springframework.batch.sample.domain.football.internal.JdbcPlayerSummaryDao">
<property name="dataSource" ref="dataSource" />
</bean>
</property>
</bean>
<bean id="playerFileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="resource" value="classpath:data/nonSequentialJob/input/${player.file.name}" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="names" value="ID,lastName,firstName,position,birthYear,debutYear" />
</bean>
</property>
<property name="fieldSetMapper">
<bean class="org.springframework.batch.sample.domain.football.internal.PlayerFieldSetMapper" />
</property>
</bean>
</property>
</bean>
<bean id="gameFileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="resource" value="classpath:data/nonSequentialJob/input/${games.file.name}" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="names" value="id,year,team,week,opponent,completes,attempts,passingYards,passingTd,interceptions,rushes,rushYards,receptions,receptionYards,totalTd" />
</bean>
</property>
<property name="fieldSetMapper">
<bean class="org.springframework.batch.sample.domain.football.internal.GameFieldSetMapper" />
</property>
</bean>
</property>
</bean>
<bean id="playerSummarizationSource" class="org.springframework.batch.item.database.JdbcCursorItemReader">
<property name="dataSource" ref="dataSource" />
<property name="mapper">
<bean class="org.springframework.batch.sample.domain.football.internal.PlayerSummaryMapper" />
</property>
<property name="sql">
<value>
SELECT games.player_id, games.year_no, 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_no
</value>
</property>
</bean>
<bean id="properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<value>
games.file.name=games-small.csv
<!-- player.file.name=player-small.csv-->
player.file.name=player-containsBadRecords.csv
job.commit.interval=2
</value>
</property>
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="order" value="1" />
</bean>
</beans>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<import resource="nonSequentialJob-base.xml" />
<batch:job id="nonSequentialJob">
<batch:step name="playerload">
<batch:end on="FAILED" status="FAILED"/>
<batch:next on="COMPLETED WITH SKIPS" to="errorPrint" />
<batch:next on="*" to="gameLoad" />
</batch:step>
<batch:step name="errorPrint">
<batch:next on="*" to="gameLoad" />
</batch:step>
<batch:step name="gameLoad">
<batch:next on="*" to="playerSummarization" />
</batch:step>
<batch:step name="playerSummarization"/>
</batch:job>
<bean id="footballProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<value>
games.file.name=games-small.csv
<!-- player.file.name=player-small.csv-->
player.file.name=player-containsBadRecords.csv
job.commit.interval=2
</value>
</property>
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="order" value="1" />
</bean>
</beans>

View File

@@ -8,3 +8,4 @@ DROP TABLE $!{IFEXISTSBEFORE} CUSTOMER $!{IFEXISTS};
DROP TABLE $!{IFEXISTSBEFORE} PLAYERS $!{IFEXISTS};
DROP TABLE $!{IFEXISTSBEFORE} GAMES $!{IFEXISTS};
DROP TABLE $!{IFEXISTSBEFORE} PLAYER_SUMMARY $!{IFEXISTS};
DROP TABLE $!{IFEXISTSBEFORE} ERROR_LOG $!{IFEXISTS};

View File

@@ -72,4 +72,8 @@ CREATE TABLE PLAYER_SUMMARY (
RECEPTIONS ${BIGINT} NOT NULL ,
RECEPTIONS_YARDS ${BIGINT} NOT NULL ,
TOTAL_TD ${BIGINT} NOT NULL
) $!{VOODOO};
) $!{VOODOO};
CREATE TABLE ERROR_LOG (
MESSAGE CHAR(300) NOT NULL
) $!{VOODOO};

View File

@@ -0,0 +1,37 @@
package org.springframework.batch.sample;
import static org.junit.Assert.assertEquals;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.test.AbstractFlowJobTests;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/nonSequentialDecisionJob.xml" })
public class NonSequentialDecisionJobFunctionalTests extends AbstractFlowJobTests {
private SimpleJdbcTemplate simpleJdbcTemplate;
@Test
public void testWithSkips() throws Exception {
simpleJdbcTemplate.update("DELETE from ERROR_LOG");
simpleJdbcTemplate.update("DELETE from PLAYER_SUMMARY");
assertEquals(BatchStatus.COMPLETED, this.launchJob().getStatus());
assertEquals(1, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from ERROR_LOG"));
assertEquals(9, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from PLAYER_SUMMARY"));
}
@Autowired
public void setDataSource(DataSource dataSource) {
this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
}
}

View File

@@ -0,0 +1,37 @@
package org.springframework.batch.sample;
import static org.junit.Assert.assertEquals;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.test.AbstractFlowJobTests;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/nonSequentialJob.xml" })
public class NonSequentialJobFunctionalTests extends AbstractFlowJobTests {
private SimpleJdbcTemplate simpleJdbcTemplate;
@Test
public void testWithSkips() throws Exception {
simpleJdbcTemplate.update("DELETE from ERROR_LOG");
simpleJdbcTemplate.update("DELETE from PLAYER_SUMMARY");
assertEquals(BatchStatus.COMPLETED, this.launchJob().getStatus());
assertEquals(1, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from ERROR_LOG"));
assertEquals(9, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from PLAYER_SUMMARY"));
}
@Autowired
public void setDataSource(DataSource dataSource) {
this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
}
}