Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit 3d35dff

Browse files
author
Scott Stafford
committed
Merge branch 'dev'
2 parents 94c8c3c + 6d3c6d2 commit 3d35dff

File tree

76 files changed

+673
-532
lines changed

Some content is hidden

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

76 files changed

+673
-532
lines changed

CONTRIBUTING.md

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,18 @@ Each contributor should be knowledgeable and proficient at the following project
1414
* [MarkLogic App Deployer](https://github.com/rjrudin/ml-app-deployer)
1515
* [Git](http://git-scm.com/doc)
1616

17-
# How should I set up my development environment?
18-
19-
## What software do I need?
17+
# What software do I need?
2018

2119
* [MarkLogic 8+](http://developer.marklogic.com/products)
2220
* [Java Development Kit 1.8+](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
23-
* Recommended: [Gradle 2.+](http://gradle.org/gradle-download/)
21+
* Recommended: [Gradle 3.+](http://gradle.org/gradle-download/)
2422

2523
You will need to first install MarkLogic if you haven't already. It is recommended to use a virtual machine or remote server to run MarkLogic to partition our resources (MarkLogic likes to use a lot of memory).
2624

27-
## What code baseline should I use?
28-
We use a [fork-and-Branch Git workflow](http://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/). The dev branch contains the latest and greatest code, while master represents the latest published version. **Always branch from DEV**.
29-
30-
Review the [jobs/gradle.properties](https://github.com/sastafford/marklogic-spring-batch/blob/master/core/gradle.properties) file to make sure that your host, port, username, and password are correct for your environment. Do not check your local version of gradle.properties.
31-
32-
## Should I use an IDE?
25+
# What code baseline should I use?
26+
We use a [fork-and-Branch Git workflow](http://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/). The dev branch contains the latest and greatest code, while master represents the latest published version. **Always branch from DEV**. If you issue a pull request, make sure to compare against the DEV branch.
3327

28+
# Should I use an IDE?
3429
Yes, it is recommended to use a Java friendly IDE to make one's life easier. Of course, you can use a simple text editor if that is your preference. The lead authors have a recent preference for [IntelliJ](https://www.jetbrains.com/idea/). We also use Gradle for our swiss army knife of building, testing, deploying, etc. One of the cool features of Gradle is the ability to create the project files for two popular IDE's, IntelliJ and Eclipse.
3530

3631
```
@@ -43,39 +38,47 @@ Yes, it is recommended to use a Java friendly IDE to make one's life easier. Of
4338

4439
The gradlew (or gradlew.bat on Windows) command is a Java program called the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) which allows you to run a gradle command without installing Gradle on your machine. If you plan to contribute (or do any type of Java development) it would be worth while to go ahead and install Gradle on your dev machine.
4540

46-
## How do I verify things are set up correctly?
47-
Once you have cloned the project locally execute the test cases. Gradle will handle downloading any dependencies that you need for this effort.
48-
49-
```
50-
gradlew testAll
51-
```
41+
# What is the structure for the project?
5242

53-
It is our policy that the dev branch tests always are 100% passing. If all tests run to completion and 100% passing then you are ready to start coding.
43+
* [core](https://github.com/sastafford/marklogic-spring-batch/tree/master/core) - contains enhancements and helper classes to the Spring Batch framework. This includes the following features
44+
* A job repository that uses MarkLogic to persist job metadata
45+
* Custom ItemReaders/Processors/Writers and tasklets that work with MarkLogic
46+
* Configuration annotations for using MarkLogic and Spring Batch together
47+
* [test](https://github.com/sastafford/marklogic-spring-batch/tree/master/test) - helper classes to assist in the testing of Spring Batch jobs written for MarkLogic.
48+
* [examples](https://github.com/sastafford/marklogic-spring-batch/tree/master/examples) - A variety of recipes and examples to guide in the creation of your own MarkLogic batch processing jobs (i.e. migrating from a RDBMS)
5449

55-
# What should I work on?
50+
# How do I set up my environment?
5651

57-
If you are new to the project the best way to contribute is to add a Job to the job library. Choose of the [job issues](https://github.com/sastafford/marklogic-spring-batch/labels/job) to get started on an assignment. If you have an example of a unique batch processing job then it would be a good idea to add it to the examples project.
52+
## Deploy your MarkLogic test database
5853

59-
# What is the structure for the project?
54+
Check the following properties file to see if there is any conflicts with your existing system.
6055

61-
There are three sub-projects for MarkLogic Spring Batch. Most contributions will be in the examples and jobs projects where the core work would be for those intimately familiar with the Spring Batch code baseline.
56+
$PROJET_ROOT/core/gradle.properties
6257

63-
* [examples](https://github.com/sastafford/marklogic-spring-batch/tree/master/examples) are the recipes for creating your own batch processing jobs (i.e. migrating from a RDBMS). Developers should use these as templates and guidelines for writing their own MarkLogic batch processing jobs.
64-
* [jobs](https://github.com/sastafford/marklogic-spring-batch/tree/master/jobs) are a library of common MarkLogic batch processing jobs to import, export, and transform.
65-
* [core](https://github.com/sastafford/marklogic-spring-batch/tree/master/core) contains all enhancements on the Spring Batch framework. This includes the jobs utility, the MarkLogic Job Repository, and any custom ItemReaders/Processors/Writers and tasklets.
58+
From the project root, run the following command. This will create a test database that is configured as a MarkLogic Job Repository.
6659

67-
# How do I test?
60+
gradlew :core:mlDeploy
6861

69-
The quality of this project is based on the tests that exercise the code. Every issue worked should be accompanied by one or more tests that test the primary use case and several edge cases. Code that is submitted without any accompanied tests will not be accepted. Before submitting a pull request, run the test suite and confirm 100% test passing with the following gradle command.
62+
Run the automated unit tests from the project root
7063

7164
```
72-
./gradlew test
65+
gradlew test
7366
```
7467

68+
The policy is the dev branch tests are 100% passing. If all tests run to completion and 100% passing then you are ready to start commiting code.
69+
70+
# What should I work on?
71+
72+
If you are new to the project the best way to contribute is to add or improve an example to the directory of examlpes. Choose of the [job issues](https://github.com/sastafford/marklogic-spring-batch/labels/example) to get started on an assignment.
73+
74+
# How do I test?
75+
76+
The quality of this project is based on the tests that exercise the code. Every issue worked should be accompanied by one or more tests that test the primary use case and several edge cases. Code that is submitted without any accompanied tests will not be accepted. Before submitting a pull request, run the test suite and confirm 100% test passing with the following gradle command.
77+
7578
# How do I deploy the MarkLogic Spring Batch artifacts?
7679

7780
## MarkLogic Spring Batch Libraries
78-
To deploy the marklogic-spring-batch core and jobs library to your local maven repository, first, increment the relevant version number in the gradle.properties file.
81+
To deploy the marklogic-spring-batch core and test library to your local maven repository, first, increment the relevant version number in the gradle.properties file.
7982

8083
It is advised to first publish artifacts to the local maven repository and run local tests before publishing out to [bintray](https://bintray.com/)
8184

@@ -89,15 +92,6 @@ Once you have verified your version then run the following command to publish to
8992
gradle bintrayUpload
9093
```
9194

92-
## MSB Command Line Utility
93-
To deploy the MarkLogic Spring Batch command line program, execute the following gradle command
94-
95-
```
96-
gradle distZip
97-
```
98-
99-
This will create the distribution archive file under ./jobs/build/distribution/jobs.zip. This can then be uploaded to the distribution website.
100-
10195
# What is the best way to ask a question?
10296
Open an issue and label it as a Question. Please don't use email. This is the best way to ask once and answer for all. If you are a MarkLogic employee, I recommend that you subscribe to the java-sig email newsgroup.
10397

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ repositories {
3838
}
3939
4040
dependencies {
41-
compile "com.marklogic:marklogic-spring-batch-core:0.6.0"
42-
testComplile "com.marklogic:marklogic-spring-batch-test:0.6.0"
41+
compile "com.marklogic:marklogic-spring-batch-core:0.7.0"
42+
testComplile "com.marklogic:marklogic-spring-batch-test:0.7.0"
4343
}
4444
```
4545

build.gradle

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
allprojects {
2-
task wrapper(type: Wrapper) {
3-
gradleVersion = '2.14'
4-
}
5-
}
6-
71
subprojects {
82
/*
93
* Not applying the bintray plugin. Couldn't get it working properly when declared
@@ -16,6 +10,7 @@ subprojects {
1610
apply plugin: "eclipse"
1711
apply plugin: "idea"
1812
apply plugin: "checkstyle"
13+
apply plugin: "maven-publish"
1914

2015
repositories {
2116
jcenter()
@@ -24,6 +19,15 @@ subprojects {
2419
mavenLocal()
2520
}
2621

22+
dependencies {
23+
compile "org.springframework.batch:spring-batch-core:3.0.7.RELEASE"
24+
compile "com.marklogic:ml-javaclient-util:2.10.0-alpha"
25+
}
26+
27+
task wrapper(type: Wrapper) {
28+
gradleVersion = '3.1'
29+
}
30+
2731
sourceCompatibility = 1.8
2832
targetCompatibility = 1.8
2933

@@ -33,10 +37,6 @@ subprojects {
3337
configFile = file("${project.rootDir}/dev-tools/checkstyle/checkstyle.xml")
3438
toolVersion = '6.19'
3539
}
36-
}
37-
38-
configure(subprojects.findAll {it.name != 'examples'}) {
39-
apply plugin: "maven-publish"
4040

4141
task sourcesJar(type: Jar, dependsOn: classes) {
4242
baseName = artifactId
@@ -66,45 +66,19 @@ configure(subprojects.findAll {it.name != 'examples'}) {
6666
}
6767
}
6868

69-
/**
70-
* Include every project that you want to be part of the msb application.
71-
*/
7269
project(':core') {
73-
dependencies {
74-
runtime "org.springframework.batch:spring-batch-core:3.0.7.RELEASE"
75-
76-
runtime fileTree(include: ['*.jar'], dir: 'lib')
77-
78-
//com.marklogic.spring.batch.Main extends com.marklogic.client.helper.LoggingObject
79-
runtime "com.marklogic:ml-javaclient-util:2.9.1"
80-
81-
//Main depends on joptsimple.OptionParser;
82-
runtime "net.sf.jopt-simple:jopt-simple:5.0.1"
83-
84-
runtime "org.springframework:spring-jdbc:4.2.6.RELEASE"
70+
task testExamples(type: GradleBuild) {
71+
buildFile = '../examples/build.gradle'
72+
tasks = [ 'test' ]
8573
}
86-
}
8774

88-
project(':test') {
89-
dependencies {
90-
compile project(':core')
91-
}
75+
test.dependsOn testExamples
9276
}
9377

94-
configure(subprojects.findAll {it.name != 'core' && it.name != "test"}) {
95-
96-
apply plugin: "application"
97-
mainClassName = "com.marklogic.spring.batch.Main"
98-
78+
project(':test') {
9979
dependencies {
10080
compile project(':core')
101-
testCompile project(':test')
10281
}
10382
}
10483

105-
task testExamples(type: GradleBuild) {
106-
buildFile = 'examples/build.gradle'
107-
tasks = [ 'test' ]
108-
}
10984

110-
task testAll(dependsOn:[':core:test', 'examples:test', 'testExamples'] )

core/build.gradle

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,49 @@
11
plugins {
2-
id "com.marklogic.ml-gradle" version "2.3.3"
3-
id "com.jfrog.bintray" version "1.6"
4-
}
5-
6-
if (System.getProperty("user.dir").endsWith("jobs")) {
7-
project.ext.smartModulePaths = ["../marklogic-spring-batch-core/src/test/ml-modules"]
8-
} else if (System.getProperty("user.dir").endsWith("marklogic-spring-batch")) {
9-
project.ext.smartModulePaths = ["marklogic-spring-batch-core/src/test/ml-modules"]
10-
} else {
11-
project.ext.smartModulePaths = ["src/test/ml-modules"]
12-
}
13-
14-
ext {
15-
mlAppConfig {
16-
modulePaths = smartModulePaths
17-
createTriggersDatabase = false
18-
}
2+
id "com.jfrog.bintray" version "1.7.1"
3+
id "com.marklogic.ml-gradle" version "2.3.4"
194
}
205

216
dependencies {
22-
compile fileTree(include: ['*.jar'], dir: 'lib')
23-
compile "org.springframework.batch:spring-batch-core:3.0.7.RELEASE"
24-
7+
compile "com.marklogic:java-client-api:4.0.0-EA3"
258
// Used by ML Job Repo implementation; depends on DataFieldMaxValueIncrementer
269
compile "org.springframework:spring-jdbc:4.2.6.RELEASE"
2710

2811
// Used by MarkLogicBatchConfiguration, which depends on Jaxb2Marshaller
2912
compile "org.springframework:spring-oxm:4.2.6.RELEASE"
3013

31-
compile("com.marklogic:ml-javaclient-util:2.9.1") {
32-
exclude group: 'com.marklogic.java-client', module: 'client-api-java'
33-
}
34-
3514
// For deploying the ML Job Repo
36-
compile "com.marklogic:ml-app-deployer:2.2.0"
15+
compile "com.marklogic:ml-app-deployer:2.3.0"
3716

3817
// For the CLI
3918
compile "net.sf.jopt-simple:jopt-simple:5.0.1"
4019

4120
testCompile "com.marklogic:ml-junit:2.6.0"
21+
22+
runtime "org.springframework.batch:spring-batch-core:3.0.7.RELEASE"
23+
24+
//com.marklogic.spring.batch.Main extends com.marklogic.client.helper.LoggingObject
25+
runtime "com.marklogic:ml-javaclient-util:2.10.0-alpha"
26+
27+
//Main depends on joptsimple.OptionParser;
28+
runtime "net.sf.jopt-simple:jopt-simple:5.0.1"
29+
30+
runtime "org.springframework:spring-jdbc:4.2.6.RELEASE"
4231
}
4332

4433
jar {
4534
manifest {
4635
attributes(
47-
'Main-Class': 'com.marklogic.spring.batch.Main'
36+
'Main-Class': 'com.marklogic.spring.batch.Main'
4837
)
4938
}
5039
}
5140

41+
ext {
42+
mlAppConfig {
43+
createTriggersDatabase = false
44+
}
45+
}
46+
5247
task deployMarkLogicJobRepository(type: JavaExec) {
5348
classpath = sourceSets.main.runtimeClasspath
5449
main = 'com.marklogic.spring.batch.Main'
-628 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Jun 01 23:09:17 EDT 2016
1+
#Fri Sep 30 20:57:34 EDT 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip

core/gradlew

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,9 @@ function splitJvmOpts() {
161161
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162162
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163163

164+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165+
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
166+
cd "$(dirname "$0")"
167+
fi
168+
164169
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

core/gradlew.bat

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ goto fail
4949
@rem Get command-line arguments, handling Windows variants
5050

5151
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
if "%@eval[2+2]" == "4" goto 4NT_args
5352

5453
:win9xME_args
5554
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
6059
if "x%~1" == "x" goto execute
6160

6261
set CMD_LINE_ARGS=%*
63-
goto execute
64-
65-
:4NT_args
66-
@rem Get arguments from the 4NT Shell from JP Software
67-
set CMD_LINE_ARGS=%$
6862

6963
:execute
7064
@rem Setup the command line

core/src/main/java/com/marklogic/client/io/MarkLogicWriteHandle.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,9 @@ public DocumentMetadataWriteHandle getMetadata() {
5353
public AbstractWriteHandle getContent() {
5454
return handle;
5555
}
56+
57+
@Override
58+
public String getTemporalDocumentURI() {
59+
return null;
60+
}
5661
}

core/src/main/java/com/marklogic/spring/batch/config/AbstractMarkLogicBatchConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* The assumption is most MarkLogic Spring Batch config classes will need at least a JobBuilderFactory,
2222
* a StepBuilderFactory, and a DatabaseClient.
2323
*/
24+
@Deprecated
2425
@EnableBatchProcessing
2526
public abstract class AbstractMarkLogicBatchConfig extends LoggingObject implements ApplicationContextAware {
2627

0 commit comments

Comments
 (0)