forked from Apress/pro-spring-5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
146 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
dependencies { | ||
compile db.h2, db.dbcp2, spring.batchIntegration, spring.integrationFile | ||
} | ||
jar { | ||
manifest { | ||
attributes("Created-By" : "Iuliana Cosmina", | ||
"Specification-Title": "Pro Spring 5", | ||
"Main-Class" : "com.apress.prospring5.ch18.FileWatcherDemo", | ||
"Class-Path" : configurations.compile.collect { it.getName() }.join(' ')) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
chapter18/integration/src/main/java/com/apress/prospring4/ch18/FileWatcher.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
chapter18/integration/src/main/java/com/apress/prospring4/ch18/PersonItemProcessor.java
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...er18/integration/src/main/java/com/apress/prospring4/ch18/StepExecutionStatsListener.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
chapter18/integration/src/main/java/com/apress/prospring5/ch18/FileWatcherDemo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.apress.prospring5.ch18; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.context.support.GenericXmlApplicationContext; | ||
|
||
public class FileWatcherDemo { | ||
|
||
private static Logger logger = LoggerFactory.getLogger(FileWatcherDemo.class); | ||
|
||
public static void main(String... args) throws Exception { | ||
GenericXmlApplicationContext ctx | ||
= new GenericXmlApplicationContext("/spring/singerJob.xml"); | ||
assert (ctx != null); | ||
logger.info("Application started..."); | ||
System.in.read(); | ||
ctx.close(); | ||
} | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
...prospring4/ch18/MessageToJobLauncher.java → ...prospring5/ch18/MessageToJobLauncher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
chapter18/integration/src/main/java/com/apress/prospring5/ch18/SingerItemProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.apress.prospring5.ch18; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.batch.item.ItemProcessor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component("itemProcessor") | ||
public class SingerItemProcessor implements ItemProcessor<Singer, Singer> { | ||
private static Logger logger = LoggerFactory.getLogger(SingerItemProcessor.class); | ||
|
||
@Override | ||
public Singer process(Singer singer) throws Exception { | ||
String firstName = singer.getFirstName().toUpperCase(); | ||
String lastName = singer.getLastName().toUpperCase(); | ||
String song = singer.getSong().toUpperCase(); | ||
|
||
Singer transformedSinger = new Singer(); | ||
transformedSinger.setFirstName(firstName); | ||
transformedSinger.setLastName(lastName); | ||
transformedSinger.setSong(song); | ||
|
||
logger.info("Transformed singer: " + singer + " Into: " + transformedSinger); | ||
|
||
return transformedSinger; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...er18/integration/src/main/java/com/apress/prospring5/ch18/StepExecutionStatsListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.apress.prospring5.ch18; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.batch.core.ExitStatus; | ||
import org.springframework.batch.core.StepExecution; | ||
import org.springframework.batch.core.listener.StepExecutionListenerSupport; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class StepExecutionStatsListener extends StepExecutionListenerSupport { | ||
|
||
public static Logger logger = LoggerFactory.getLogger(StepExecutionStatsListener.class); | ||
|
||
@Override | ||
public ExitStatus afterStep(StepExecution stepExecution) { | ||
logger.info("--> Wrote: " + stepExecution.getWriteCount() | ||
+ " items in step: " + stepExecution.getStepName()); | ||
return null; | ||
} | ||
} |
Empty file.
7 changes: 0 additions & 7 deletions
7
chapter18/integration/src/main/resources/META-INF/spring/jobs/personJob/support/person.sql
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...ter18/integration/src/main/resources/META-INF/spring/jobs/personJob/support/test-data.csv
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
|
||
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"> | ||
<resetJUL>true</resetJUL> | ||
</contextListener> | ||
|
||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<logger name="com.apress.prospring5.ch18" level="debug"/> | ||
|
||
<logger name="org.springframework" level="info"/> | ||
|
||
<root level="info"> | ||
<appender-ref ref="console" /> | ||
</root> | ||
</configuration> |
Oops, something went wrong.