-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
26 lines (21 loc) · 1.67 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
For simplicity sake, I contain all files in the master folder.
In the real world, folder structure would look like:
MyProject/src/com/vinhuang/...
Address Extract Sample Code Package contains 4 main components:
AddressExtract.xml --> Spring configuration where the data injection, SQL connection, and Spring Batch structure take place
AddressExtractProcessor.java --> Main processing java code
AddressExtractOutput.java --> POJO for our output
Agent.java --> POJO for our input
Functionality/Intended Use:
The program will retrieve all Agents from agent table, and process it accordingly before writing the result to a flat file in
the specified directory ${dir}, which is controlled in a separate properties file (omitted from the sample)
Main blueprint/road map for this Address Extract sample program is located in the AddressExtract.xml. To run this program,
a separate configuration is needed, and this configuration will implement Spring CommandLineJobRunner with the XML file as
the argument. This program will not run because I omitted majority of the critical configuration components
AddressExtract.xml contains 3 major parts in its chunk:
--> Reader: reads the data from our agent table, and using parameterized data access (to heighten security against possible
injection attacks). Map input from database to Agent POJO
--> Processor: process the data retrieved from the reader and produce output to the writer. In here, processor is specified
in the AddressExtractProcessor.java
--> Writer: writes output from processor to a flat file called AddressExtract.txt
Note: I demonstrated multi-threading with threads 9; therefore, using synchronized reader and writer to prevent incorrect process