resolve conflict
This commit is contained in:
commit
3090229867
|
@ -1,43 +1,38 @@
|
||||||
# Getting Started: Creating a Batch Service
|
<#assign project_id="gs-batch-processing">
|
||||||
|
This guide walks you through creating a basic batch-driven solution.
|
||||||
|
|
||||||
What you'll build
|
What you'll build
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
This guide walks you through creating a basic batch-driven solution. You build a service that imports data from a CSV spreadsheet, transforms it with custom code, and stores the final results in a database.
|
You build a service that imports data from a CSV spreadsheet, transforms it with custom code, and stores the final results in a database.
|
||||||
|
|
||||||
What you'll need
|
What you'll need
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
- About 15 minutes
|
- About 15 minutes
|
||||||
- {!include#prereq-editor-jdk-buildtools}
|
- <@prereq_editor_jdk_buildtools/>
|
||||||
|
|
||||||
|
## <@how_to_complete_this_guide jump_ahead='Create a business class'/>
|
||||||
|
|
||||||
## {!include#how-to-complete-this-guide}
|
|
||||||
|
|
||||||
<a name="scratch"></a>
|
<a name="scratch"></a>
|
||||||
Set up the project
|
Set up the project
|
||||||
------------------
|
------------------
|
||||||
{!include#build-system-intro}
|
<@build_system_intro/>
|
||||||
|
|
||||||
{!include#create-directory-structure-hello}
|
<@create_directory_structure_hello/>
|
||||||
|
|
||||||
### Create a Maven POM
|
### Create a Maven POM
|
||||||
|
|
||||||
{!include:initial/pom.xml}
|
<@snippet path="pom.xml" prefix="initial"/>
|
||||||
|
|
||||||
{!include#bootstrap-starter-pom-disclaimer}
|
<@bootstrap_starter_pom_disclaimer/>
|
||||||
|
|
||||||
### Create business data
|
### Create business data
|
||||||
|
|
||||||
Typically your customer or a business analyst supplies a spreadsheet. In this case, you make it up.
|
Typically your customer or a business analyst supplies a spreadsheet. In this case, you make it up.
|
||||||
|
|
||||||
`src/main/resources/sample-data.csv`
|
<@snippet path="src/main/resources/sample-data.csv" prefix="initial"/>
|
||||||
```text
|
|
||||||
Jill,Doe
|
|
||||||
Joe,Doe
|
|
||||||
Justin,Doe
|
|
||||||
Jane,Doe
|
|
||||||
John,Doe
|
|
||||||
```
|
|
||||||
|
|
||||||
This spreadsheet contains a first name and a last name on each row, separated by a comma. This is a fairly common pattern that Spring handles out-of-the-box, as you will see.
|
This spreadsheet contains a first name and a last name on each row, separated by a comma. This is a fairly common pattern that Spring handles out-of-the-box, as you will see.
|
||||||
|
|
||||||
|
@ -45,7 +40,9 @@ This spreadsheet contains a first name and a last name on each row, separated by
|
||||||
|
|
||||||
Next, you write a SQL script to create a table to store the data.
|
Next, you write a SQL script to create a table to store the data.
|
||||||
|
|
||||||
{!include:complete/src/main/resources/schema.sql}
|
<@snippet path="src/main/resources/schema-all.sql" prefix="initial"/>
|
||||||
|
|
||||||
|
> **Note:** Spring Boot runs `schema-@@platform@@.sql` automatically during startup. `-all` is the default for all platforms.
|
||||||
|
|
||||||
<a name="initial"></a>
|
<a name="initial"></a>
|
||||||
Create a business class
|
Create a business class
|
||||||
|
@ -53,7 +50,7 @@ Create a business class
|
||||||
|
|
||||||
Now that you see the format of data inputs and outputs, you write code to represent a row of data.
|
Now that you see the format of data inputs and outputs, you write code to represent a row of data.
|
||||||
|
|
||||||
{!include:complete/src/main/java/hello/Person.java}
|
<@snippet path="src/main/java/hello/Person.java" prefix="complete"/>
|
||||||
|
|
||||||
You can instantiate the `Person` class either with first and last name through a constructor, or by setting the properties.
|
You can instantiate the `Person` class either with first and last name through a constructor, or by setting the properties.
|
||||||
|
|
||||||
|
@ -62,7 +59,7 @@ Create an intermediate processor
|
||||||
|
|
||||||
A common paradigm in batch processing is to ingest data, transform it, and then pipe it out somewhere else. Here you write a simple transformer that converts the names to uppercase.
|
A common paradigm in batch processing is to ingest data, transform it, and then pipe it out somewhere else. Here you write a simple transformer that converts the names to uppercase.
|
||||||
|
|
||||||
{!include:complete/src/main/java/hello/PersonItemProcessor.java}
|
<@snippet path="src/main/java/hello/PersonItemProcessor.java" prefix="complete"/>
|
||||||
|
|
||||||
`PersonItemProcessor` implements Spring Batch's `ItemProcessor` interface. This makes it easy to wire the code into a batch job that you define further down in this guide. According to the interface, you receive an incoming `Person` object, after which you transform it to an upper-cased `Person`.
|
`PersonItemProcessor` implements Spring Batch's `ItemProcessor` interface. This makes it easy to wire the code into a batch job that you define further down in this guide. According to the interface, you receive an incoming `Person` object, after which you transform it to an upper-cased `Person`.
|
||||||
|
|
||||||
|
@ -73,13 +70,13 @@ Put together a batch job
|
||||||
|
|
||||||
Now you put together the actual batch job. Spring Batch provides many utility classes that reduce the need to write custom code. Instead, you can focus on the business logic.
|
Now you put together the actual batch job. Spring Batch provides many utility classes that reduce the need to write custom code. Instead, you can focus on the business logic.
|
||||||
|
|
||||||
{!include:complete/src/main/java/hello/BatchConfiguration.java}
|
<@snippet path="src/main/java/hello/BatchConfiguration.java" prefix="complete"/>
|
||||||
|
|
||||||
For starters, the `@EnableBatchProcessing` annotation adds many critical beans that support jobs and saves you a lot of leg work.
|
For starters, the `@EnableBatchProcessing` annotation adds many critical beans that support jobs and saves you a lot of leg work.
|
||||||
|
|
||||||
Break it down:
|
Break it down:
|
||||||
|
|
||||||
{!include:complete/src/main/java/hello/BatchConfiguration.java#reader-writer-processor}
|
<@snippet "src/main/java/hello/BatchConfiguration.java" "readerwriterprocessor" "/complete"/>
|
||||||
|
|
||||||
The first chunk of code defines the input, processor, and output.
|
The first chunk of code defines the input, processor, and output.
|
||||||
- `reader()` creates an `ItemReader`. It looks for a file called `sample-data.csv` and parses each line item with enough information to turn it into a `Person`.
|
- `reader()` creates an `ItemReader`. It looks for a file called `sample-data.csv` and parses each line item with enough information to turn it into a `Person`.
|
||||||
|
@ -88,7 +85,7 @@ The first chunk of code defines the input, processor, and output.
|
||||||
|
|
||||||
The next chunk focuses on the actual job configuration.
|
The next chunk focuses on the actual job configuration.
|
||||||
|
|
||||||
{!include:complete/src/main/java/hello/BatchConfiguration.java#job-step}
|
<@snippet "src/main/java/hello/BatchConfiguration.java" "jobstep" "/complete"/>
|
||||||
|
|
||||||
The first method defines the job and the second one defines a single step. Jobs are built from steps, where each step can involve a reader, a processor, and a writer.
|
The first method defines the job and the second one defines a single step. Jobs are built from steps, where each step can involve a reader, a processor, and a writer.
|
||||||
|
|
||||||
|
@ -100,29 +97,13 @@ In the step definition, you define how much data to write at a time. In this cas
|
||||||
|
|
||||||
Finally, you run the application.
|
Finally, you run the application.
|
||||||
|
|
||||||
{!include:complete/src/main/java/hello/BatchConfiguration.java#template-main}
|
<@snippet "src/main/java/hello/BatchConfiguration.java" "templatemain" "/complete"/>
|
||||||
|
|
||||||
This example uses a memory-based database (provided by `@EnableBatchProcessing`), meaning that when it's done, the data is gone. For demonstration purposes, there is extra code to create a `JdbcTemplate`, query the database, and print out the names of people the batch job inserts.
|
This example uses a memory-based database (provided by `@EnableBatchProcessing`), meaning that when it's done, the data is gone. For demonstration purposes, there is extra code to create a `JdbcTemplate`, query the database, and print out the names of people the batch job inserts.
|
||||||
|
|
||||||
|
## <@build_an_executable_jar/>
|
||||||
|
|
||||||
Build an executable JAR
|
<@run_the_application_with_maven module="batch job"/>
|
||||||
-----------------------
|
|
||||||
Add the following to your `pom.xml` file, keeping existing properties and plugins intact:
|
|
||||||
|
|
||||||
{!include:complete/pom.xml#shade-config}
|
|
||||||
|
|
||||||
Create a single executable JAR file containing all necessary dependency classes:
|
|
||||||
|
|
||||||
$ mvn package
|
|
||||||
|
|
||||||
|
|
||||||
Run the batch job
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Now you can run the job from the JAR as well, and distribute that as an executable artifact:
|
|
||||||
|
|
||||||
$ java -jar target/gs-batch-processing-complete-0.1.0.jar
|
|
||||||
|
|
||||||
|
|
||||||
The job prints out a line for each person that gets transformed. After the job runs, you can also see the output from querying the database.
|
The job prints out a line for each person that gets transformed. After the job runs, you can also see the output from querying the database.
|
||||||
|
|
||||||
|
@ -130,5 +111,3 @@ Summary
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Congratulations! You built a batch job that ingested data from a spreadsheet, processed it, and wrote it to a database.
|
Congratulations! You built a batch job that ingested data from a spreadsheet, processed it, and wrote it to a database.
|
||||||
|
|
||||||
[zip]: https://github.com/springframework-meta/gs-batch-processing/archive/master.zip
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
### Related Resources
|
||||||
|
|
||||||
|
There's more to data integration than is covered here. You may want to continue your exploration of Spring messaging and integration with the following
|
||||||
|
|
||||||
|
### Getting Started Guides
|
||||||
|
|
||||||
|
* [Integrating Data][gs-integration]
|
||||||
|
* [Capturing Stream Data][gs-capturing-stream-data]
|
||||||
|
* [Messaging with JMS][gs-messaging-jms]
|
||||||
|
* [Messaging with RabbitMQ][gs-messaging-rabbitmq]
|
||||||
|
* [Messaging with Redis][gs-messaging-redis]
|
||||||
|
|
||||||
|
[gs-integration]: /guides/gs/integration/
|
||||||
|
[gs-capturing-stream-data]: /guides/gs/capturing-stream-data/
|
||||||
|
[gs-messaging-jms]: /guides/gs/messaging-jms/
|
||||||
|
[gs-messaging-rabbitmq]: /guides/gs/messaging-rabbitmq/
|
||||||
|
[gs-messaging-redis]: /guides/gs/messaging-redis/
|
||||||
|
|
||||||
|
### Tutorials
|
||||||
|
|
||||||
|
* [Designing and Implementing RESTful Web Services with Spring][tut-rest]
|
||||||
|
|
||||||
|
[tut-rest]: /guides/tutorials/rest
|
||||||
|
|
||||||
|
### Understanding
|
||||||
|
|
||||||
|
* [REST][u-rest]
|
||||||
|
* [JSON][u-json]
|
||||||
|
|
||||||
|
[u-rest]: /understanding/REST
|
||||||
|
[u-json]: /understanding/JSON
|
|
@ -0,0 +1,34 @@
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven { url "http://repo.springsource.org/libs-snapshot" }
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath("org.springframework.boot:spring-boot-gradle-plugin:0.5.0.BUILD-SNAPSHOT")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'spring-boot'
|
||||||
|
|
||||||
|
jar {
|
||||||
|
baseName = 'gs-batch-processing'
|
||||||
|
version = '0.1.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url "http://repo.springsource.org/libs-snapshot" }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile("org.springframework.boot:spring-boot-starter-batch:0.5.0.BUILD-SNAPSHOT")
|
||||||
|
compile("org.hsqldb:hsqldb")
|
||||||
|
testCompile("junit:junit:4.11")
|
||||||
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
gradleVersion = '1.7'
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
||||||
|
#Fri Aug 09 11:38:26 CDT 2013
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=http\://services.gradle.org/distributions/gradle-1.7-bin.zip
|
|
@ -0,0 +1,164 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
@ -0,0 +1,90 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
|
@ -4,19 +4,19 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>gs-batch-processing-complete</artifactId>
|
<artifactId>gs-batch-processing</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>0.1.0</version>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.bootstrap</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-bootstrap-starters</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.bootstrap</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-bootstrap-batch-starter</artifactId>
|
<artifactId>spring-boot-starter-batch</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
|
@ -24,7 +24,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<!-- {!begin#shade-config} -->
|
|
||||||
<properties>
|
<properties>
|
||||||
<start-class>hello.BatchConfiguration</start-class>
|
<start-class>hello.BatchConfiguration</start-class>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -32,30 +31,30 @@
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<version>2.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<!-- {!end#shade-config} -->
|
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spring-snapshots</id>
|
<id>spring-snapshots</id>
|
||||||
<url>http://repo.springsource.org/snapshot</url>
|
<url>http://repo.springsource.org/libs-snapshot</url>
|
||||||
<snapshots><enabled>true</enabled></snapshots>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>spring-milestones</id>
|
|
||||||
<url>http://repo.springsource.org/milestone</url>
|
|
||||||
<snapshots><enabled>true</enabled></snapshots>
|
<snapshots><enabled>true</enabled></snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
<id>spring-snapshots</id>
|
<id>spring-snapshots</id>
|
||||||
<url>http://repo.springsource.org/snapshot</url>
|
<url>http://repo.springsource.org/libs-snapshot</url>
|
||||||
<snapshots><enabled>true</enabled></snapshots>
|
<snapshots><enabled>true</enabled></snapshots>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.batch.core.Job;
|
import org.springframework.batch.core.Job;
|
||||||
import org.springframework.batch.core.Step;
|
import org.springframework.batch.core.Step;
|
||||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||||
|
@ -21,8 +22,7 @@ import org.springframework.batch.item.file.FlatFileItemReader;
|
||||||
import org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper;
|
import org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper;
|
||||||
import org.springframework.batch.item.file.mapping.DefaultLineMapper;
|
import org.springframework.batch.item.file.mapping.DefaultLineMapper;
|
||||||
import org.springframework.batch.item.file.transform.DelimitedLineTokenizer;
|
import org.springframework.batch.item.file.transform.DelimitedLineTokenizer;
|
||||||
import org.springframework.bootstrap.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -35,7 +35,7 @@ import org.springframework.jdbc.core.RowMapper;
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
public class BatchConfiguration {
|
public class BatchConfiguration {
|
||||||
|
|
||||||
// {!begin#reader-writer-processor}
|
// {!begin readerwriterprocessor}
|
||||||
@Bean
|
@Bean
|
||||||
public ItemReader<Person> reader() {
|
public ItemReader<Person> reader() {
|
||||||
FlatFileItemReader<Person> reader = new FlatFileItemReader<Person>();
|
FlatFileItemReader<Person> reader = new FlatFileItemReader<Person>();
|
||||||
|
@ -64,9 +64,9 @@ public class BatchConfiguration {
|
||||||
writer.setDataSource(dataSource);
|
writer.setDataSource(dataSource);
|
||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
// {!end#reader-writer-processor}
|
// {!end readerwriterprocessor}
|
||||||
|
|
||||||
// {!begin#job-step}
|
// {!begin jobstep}
|
||||||
@Bean
|
@Bean
|
||||||
public Job importUserJob(JobBuilderFactory jobs, Step s1) {
|
public Job importUserJob(JobBuilderFactory jobs, Step s1) {
|
||||||
return jobs.get("importUserJob")
|
return jobs.get("importUserJob")
|
||||||
|
@ -86,9 +86,9 @@ public class BatchConfiguration {
|
||||||
.writer(writer)
|
.writer(writer)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
// {!end#job-step}
|
// {!end jobstep}
|
||||||
|
|
||||||
// {!begin#template-main}
|
// {!begin templatemain}
|
||||||
@Bean
|
@Bean
|
||||||
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||||
return new JdbcTemplate(dataSource);
|
return new JdbcTemplate(dataSource);
|
||||||
|
@ -106,5 +106,5 @@ public class BatchConfiguration {
|
||||||
System.out.println("Found <" + person + "> in the database.");
|
System.out.println("Found <" + person + "> in the database.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// {!end#template-main}
|
// {!end templatemain}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,4 +33,5 @@ public class Person {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "firstName: " + firstName + ", lastName: " + lastName;
|
return "firstName: " + firstName + ", lastName: " + lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package hello;
|
||||||
import org.springframework.batch.item.ItemProcessor;
|
import org.springframework.batch.item.ItemProcessor;
|
||||||
|
|
||||||
public class PersonItemProcessor implements ItemProcessor<Person, Person> {
|
public class PersonItemProcessor implements ItemProcessor<Person, Person> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Person process(final Person person) throws Exception {
|
public Person process(final Person person) throws Exception {
|
||||||
final String firstName = person.getFirstName().toUpperCase();
|
final String firstName = person.getFirstName().toUpperCase();
|
||||||
|
@ -14,4 +15,5 @@ public class PersonItemProcessor implements ItemProcessor<Person, Person> {
|
||||||
|
|
||||||
return transformedPerson;
|
return transformedPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
DROP TABLE people IF EXISTS;
|
||||||
|
|
||||||
|
CREATE TABLE people (
|
||||||
|
person_id BIGINT IDENTITY NOT NULL PRIMARY KEY,
|
||||||
|
first_name VARCHAR(20),
|
||||||
|
last_name VARCHAR(20)
|
||||||
|
);
|
|
@ -1,7 +0,0 @@
|
||||||
DROP TABLE people IF EXISTS;
|
|
||||||
|
|
||||||
CREATE TABLE people (
|
|
||||||
person_id BIGINT IDENTITY NOT NULL PRIMARY KEY,
|
|
||||||
first_name VARCHAR(20),
|
|
||||||
last_name VARCHAR(20)
|
|
||||||
);
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven { url "http://repo.springsource.org/libs-snapshot" }
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath("org.springframework.boot:spring-boot-gradle-plugin:0.5.0.BUILD-SNAPSHOT")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
|
||||||
|
jar {
|
||||||
|
baseName = 'gs-batch-processing'
|
||||||
|
version = '0.1.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url "http://repo.springsource.org/libs-snapshot" }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile("org.springframework.boot:spring-boot-starter-batch:0.5.0.BUILD-SNAPSHOT")
|
||||||
|
compile("org.hsqldb:hsqldb")
|
||||||
|
testCompile("junit:junit:4.11")
|
||||||
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
gradleVersion = '1.7'
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
||||||
|
#Fri Aug 09 11:38:32 CDT 2013
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=http\://services.gradle.org/distributions/gradle-1.7-bin.zip
|
|
@ -0,0 +1,164 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
@ -0,0 +1,90 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
|
@ -4,19 +4,19 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>gs-batch-processing-initial</artifactId>
|
<artifactId>gs-batch-processing</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>0.1.0</version>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.bootstrap</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-bootstrap-starters</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>0.5.0.BUILD-SNAPSHOT</version>
|
<version>0.5.0.BUILD-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.bootstrap</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-bootstrap-batch-starter</artifactId>
|
<artifactId>spring-boot-starter-batch</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
|
@ -24,23 +24,29 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spring-snapshots</id>
|
<id>spring-snapshots</id>
|
||||||
<url>http://repo.springsource.org/snapshot</url>
|
<url>http://repo.springsource.org/libs-snapshot</url>
|
||||||
<snapshots><enabled>true</enabled></snapshots>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>spring-milestones</id>
|
|
||||||
<url>http://repo.springsource.org/milestone</url>
|
|
||||||
<snapshots><enabled>true</enabled></snapshots>
|
<snapshots><enabled>true</enabled></snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
<id>spring-snapshots</id>
|
<id>spring-snapshots</id>
|
||||||
<url>http://repo.springsource.org/snapshot</url>
|
<url>http://repo.springsource.org/libs-snapshot</url>
|
||||||
<snapshots><enabled>true</enabled></snapshots>
|
<snapshots><enabled>true</enabled></snapshots>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
DROP TABLE people IF EXISTS;
|
||||||
|
|
||||||
|
CREATE TABLE people (
|
||||||
|
person_id BIGINT IDENTITY NOT NULL PRIMARY KEY,
|
||||||
|
first_name VARCHAR(20),
|
||||||
|
last_name VARCHAR(20)
|
||||||
|
);
|
|
@ -1,7 +0,0 @@
|
||||||
DROP TABLE people IF EXISTS;
|
|
||||||
|
|
||||||
CREATE TABLE people (
|
|
||||||
person_id BIGINT IDENTITY NOT NULL PRIMARY KEY,
|
|
||||||
first_name VARCHAR(20),
|
|
||||||
last_name VARCHAR(20)
|
|
||||||
);
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
cd ../complete
|
||||||
|
|
||||||
|
mvn clean package
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -ne 0 ]; then
|
||||||
|
exit $ret
|
||||||
|
fi
|
||||||
|
rm -rf target
|
||||||
|
|
||||||
|
./gradlew build
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -ne 0 ]; then
|
||||||
|
exit $ret
|
||||||
|
fi
|
||||||
|
rm -rf build
|
||||||
|
|
||||||
|
cd ../initial
|
||||||
|
|
||||||
|
mvn clean package
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -ne 0 ]; then
|
||||||
|
exit $ret
|
||||||
|
fi
|
||||||
|
rm -rf target
|
||||||
|
|
||||||
|
./gradlew build
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -ne 0 ]; then
|
||||||
|
exit $ret
|
||||||
|
fi
|
||||||
|
rm -rf build
|
||||||
|
|
||||||
|
exit
|
Loading…
Reference in New Issue