Update recipe-accessing-data-mongodb to use Spring Data Kay SR8 This recipe is built against branch 'virgo-blueprint3' which features Spring 5 and Gemini Blueprint 3.0.0.M01.
diff --git a/recipe-accessing-data-mongodb/build.gradle b/recipe-accessing-data-mongodb/build.gradle index e23dae3..6b729ce 100644 --- a/recipe-accessing-data-mongodb/build.gradle +++ b/recipe-accessing-data-mongodb/build.gradle
@@ -6,9 +6,12 @@ maven { url "https://plugins.gradle.org/m2/" } + maven { + url "http://build.eclipse.org/rt/virgo/gradle/bundles" + } } dependencies { - classpath "gradle.plugin.org.eclipse.virgo.bundlor:bundlor-plugin:0.2" + classpath "org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor.gradle.plugin:1.1.3.M01" classpath "gradle.plugin.com.eclipsesource.dockerizor:dockerizor:0.9.1" classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3' }
diff --git a/recipe-accessing-data-mongodb/gradle.properties b/recipe-accessing-data-mongodb/gradle.properties index f6ebff2..63c4da6 100644 --- a/recipe-accessing-data-mongodb/gradle.properties +++ b/recipe-accessing-data-mongodb/gradle.properties
@@ -5,6 +5,12 @@ springframeworkVersion = 4.3.18.RELEASE # Spring Data Ingalls SR13 -mongoJavaDriverVersion = 2.14.3 -springDataCommonsVersion = 1.13.13.RELEASE -springDataMongodbVersion = 1.10.13.RELEASE +#mongoJavaDriverVersion = 2.14.3 +#springDataCommonsVersion = 1.13.13.RELEASE +#springDataMongodbVersion = 1.10.13.RELEASE + +# Spring Data Kay SR8 +mongoJavaDriverVersion = 3.8.0 +mongodbDriverReactivestreamsVersion = 1.9.0 +springDataCommonsVersion = 2.0.8.RELEASE +springDataMongodbVersion = 2.0.8.RELEASE
diff --git a/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/src/main/resources/META-INF/spring/applicationContext.xml b/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/src/main/resources/META-INF/spring/applicationContext.xml index 0cff26e..df31a93 100644 --- a/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/src/main/resources/META-INF/spring/applicationContext.xml +++ b/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/src/main/resources/META-INF/spring/applicationContext.xml
@@ -1,20 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> -<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xmlns:mongo="http://www.springframework.org/schema/data/mongo" - xmlns="http://www.springframework.org/schema/beans" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd - http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd" > +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:mongo="http://www.springframework.org/schema/data/mongo" + xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-2.0.xsd"> <!-- tag::configuration[] --> <context:property-placeholder location="classpath:mongodb.properties" /> - <mongo:db-factory dbname="recipes" host="${mongodb.host:localhost}:${mongodb.port:27017}" /><!--1 --> - <mongo:template /> + <mongo:mongo-client host="${mongodb.host:localhost}" port="${mongodb.port:27017}"/> + <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> + <constructor-arg ref="mongoClient"/> + <constructor-arg name="databaseName" value="recipe"/> + </bean> + <mongo:repositories base-package="org.eclipse.virgo.samples.recipe.data.mongodb" /> - <context:component-scan base-package="org.eclipse.virgo.samples.recipe.data.mongodb" /><!--4 --> + <context:component-scan base-package="org.eclipse.virgo.samples.recipe.data.mongodb" /> <!-- end::configuration[] --> </beans>
diff --git a/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/template.mf b/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/template.mf index 3f7a76d..e18e43d 100644 --- a/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/template.mf +++ b/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/template.mf
@@ -5,9 +5,10 @@ Import-Bundle: org.springframework.aop, org.springframework.beans, org.springframework.core, - org.springframework.data.core, + org.springframework.transaction, + org.springframework.data.commons, org.springframework.data.mongodb Excluded-Imports: org.springframework.* -Import-Package: com.mongodb;version="[2.14.3,3)", +Import-Package: com.mongodb;version="[3.8,4)", javax.annotation;version="0", org.aopalliance.aop;version="1"
diff --git a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-app/build.gradle b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-app/build.gradle index 363ee56..a3dadf3 100644 --- a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-app/build.gradle +++ b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-app/build.gradle
@@ -5,7 +5,7 @@ pickupFiles = ['recipe-accessing-data-mongodb.plan'] virgoVersion = 'latest' - hudsonJobName = 'virgo-master' + hudsonJobName = 'virgo-blueprint3' virgoHome = '/home/virgo/virgo-recipe-accessing-data-mongodb' }
diff --git a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/build.gradle b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/build.gradle index 85f7d6b..6a6d4c3 100644 --- a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/build.gradle +++ b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/build.gradle
@@ -5,7 +5,7 @@ createLocalCopy = true virgoVersion = 'latest' - hudsonJobName = 'virgo-master' + hudsonJobName = 'virgo-blueprint3' virgoHome = '/home/virgo/virgo-recipe-accessing-data-mongodb-runtime' } @@ -16,8 +16,99 @@ //tag::dependencies[] dependencies { + repositoryUsr 'org.reactivestreams:reactive-streams:1.0.2' repositoryUsr "org.mongodb:mongo-java-driver:${mongoJavaDriverVersion}" - repositoryUsr "org.springframework.data:spring-data-commons:${springDataCommonsVersion}" - repositoryUsr "org.springframework.data:spring-data-mongodb:${springDataMongodbVersion}" + repositoryUsr "org.mongodb:mongodb-driver-async:${mongoJavaDriverVersion}" + repositoryUsr 'org.mongodb:mongodb-driver-reactivestreams:${mongodbDriverReactivestreamsVersion}' + + // repositoryUsr "org.springframework.data:spring-data-commons:${springDataCommonsVersion}" +// repositoryUsr "org.springframework.data:spring-data-mongodb:${springDataMongodbVersion}" + + // Spring Data 2.0.8+ doesn't provide OSGi metadata + repositoryUsr files("org.springframework.data.commons-${springDataCommonsVersion}/build/org.springframework.data.commons-${springDataCommonsVersion}.jar") + repositoryUsr files("org.springframework.data.mongodb-${springDataMongodbVersion}/build/org.springframework.data.mongodb-${springDataMongodbVersion}.jar") } //end::dependencies[] + +// OSGi-ify 3rd party dependencies + +subprojects { + apply plugin: 'base' + + repositories { + mavenCentral() + maven { + url "http://build.eclipse.org/rt/virgo/gradle/bundles" + } + } + + configurations { + bundlorRuntime + + sourceBundle + } + + dependencies { + bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor.commandline:1.1.3.M01') + bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor:1.1.3.M01') + bundlorRuntime('org.eclipse.virgo.bundlor:org.eclipse.virgo.bundlor.blint:1.1.3.M01') + } + + def artifactName = project.name.split('-')[0] + def artifactVersion = project.name.split('-')[1] + + task createBuildDir() { + doLast() { + file(project.buildDir).mkdir() + } + } + + def outputFile = new File(file(project.buildDir), "${project.name}.jar") + + task bundlor(type: JavaExec, dependsOn: createBuildDir) { + + classpath = configurations.bundlorRuntime + + // template.mf based on + // * https://github.com/spring-projects/spring-data-commons/blob/1.13.x/template.mf + // * https://github.com/spring-projects/spring-data-mongodb/blob/1.10.x/spring-data-mongodb/template.mf + + // versions taken from + // * https://github.com/spring-projects/spring-data-build/blob/2.0.8.RELEASE/parent/pom.xml + // * https://github.com/spring-projects/spring-data-commons/blob/2.0.8.RELEASE/pom.xml + // * https://github.com/spring-projects/spring-data-mongodb/blob/2.0.8.RELEASE/pom.xml + main = 'org.eclipse.virgo.bundlor.commandline.Bundlor' + args '-D', "version=${artifactVersion}" + args '-D', "guava=19" + args '-D', "jackson=2.9.6" + args '-D', "javaslang=2.0.6" + args '-D', "jodatime=2.9.9" + args '-D', "jsonpath=2.4.0" + args '-D', "mongo=3.5.0" + args '-D', "mongodbDriverReactivestreamsVersion=${mongodbDriverReactivestreamsVersion}" + args '-D', "objenesis=2.6" + args '-D', "querydsl=4.1.1" + args '-D', "scala=2.11.7" + args '-D', "slf4j=1.7.25" + args '-D', "spring=5.0.7.RELEASE" + args '-D', "springHateoas=0.24.0" + args '-D', "springDataCommonsVersion=${springDataCommonsVersion}" + args '-D', "threetenbp=1.3.6" + args '-D', "validation=1.1.0.Final" + args '-D', "vavr=0.9.2" + args '-D', "xmlbeam=1.4.15" + args '-i', "${-> configurations.sourceBundle[0]}" // lazy GString to resolve the configuration at runtime + args '-m', "${artifactName}.mf" + args '-o', outputFile + + doFirst() { + println "Processing ${-> configurations.sourceBundle[0]} with ${artifactName}.mf" + } + + doLast() { + + } + } + + dockerize.dependsOn bundlor +}
diff --git a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.commons-2.0.8.RELEASE/build.gradle b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.commons-2.0.8.RELEASE/build.gradle new file mode 100644 index 0000000..1ea1f2f --- /dev/null +++ b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.commons-2.0.8.RELEASE/build.gradle
@@ -0,0 +1,3 @@ +dependencies { + sourceBundle 'org.springframework.data:spring-data-commons:2.0.8.RELEASE' +}
diff --git a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.commons-2.0.8.RELEASE/org.springframework.data.commons.mf b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.commons-2.0.8.RELEASE/org.springframework.data.commons.mf new file mode 100644 index 0000000..6626f49 --- /dev/null +++ b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.commons-2.0.8.RELEASE/org.springframework.data.commons.mf
@@ -0,0 +1,58 @@ +Bundle-SymbolicName: org.springframework.data.commons +Bundle-Name: Spring Data Commons +Bundle-Vendor: Eclipse Virgo +Bundle-Version: ${version} +Bundle-ManifestVersion: 2 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Excluded-Imports: + lombok.* +Import-Package: + sun.reflect;version="0";resolution:=optional +Import-Template: + com.fasterxml.jackson.*;version="${jackson:[=.=.=,+1.0.0)}";resolution:=optional, + com.google.common.*;version="${guava:[=.=.=,+10.0.0)}";resolution:=optional, + com.jayway.jsonpath.*;version="${jsonpath:[=.=.=,+1.0.0]}";resolution:=optional, + com.querydsl.*;version="${querydsl:[=.=.=,+1.0.0)}";resolution:=optional, + io.vavr.*;version="${vavr:[=.=.=,+1.0.0)}";resolution:=optional, + javaslang.*;version="${javaslang:[=.=.=,+1.0.0)}";resolution:=optional, + javax.annotation.*;version="[1.3,2.0.0)";resolution:=optional, + javax.enterprise.*;version="[1.0.0,2.0.0)";resolution:=optional, + javax.inject.*;version="[1.0.0,2.0.0)";resolution:=optional, + javax.servlet.*;version="[2.5.0, 4.0.0)";resolution:=optional, + javax.xml.bind.*;version="0";resolution:=optional, + javax.xml.transform.*;version="0";resolution:=optional, + javax.xml.parsers.*;version="0";resolution:=optional, + net.minidev.json.*;version="${jsonpath:[=.=.=,+1.0.0)}";resolution:=optional, + org.aopalliance.*;version="[1.0.0, 2.0.0)";resolution:=optional, + org.joda.time.*;version="${jodatime:[=.=.=,+1.0.0)}";resolution:=optional, + org.springframework.aop.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.asm.*;version="${spring:[=.=.=,+2.0.0)}", + org.springframework.beans.*;version="${spring:[=.=.=,+2.0.0)}", + org.springframework.cglib.*;version="${spring:[=.=.=,+2.0.0)}", + org.springframework.core.*;version="${spring:[=.=.=,+2.0.0)}", + org.springframework.context.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.dao.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.expression.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.format.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.http.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.lang.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.oxm.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.scheduling.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.stereotype.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.transaction.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.util.*;version="${spring:[=.=.=,+2.0.0)}", + org.springframework.validation.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.web.*;version="${spring:[=.=.=,+2.0.0)}";resolution:=optional, + org.springframework.hateoas.*;version="${springHateoas:[=.=.=,+1.0.0)}";resolution:=optional, + org.slf4j.*;version="${slf4j:[=.=.=,+1.0.0)}", + org.threeten.bp.*;version="${threetenbp:[=.=.=,+1.0.0)}";resolution:=optional, + org.reactivestreams.*;version="0";resolution:=optional, + org.w3c.dom.*;version="0", + org.xml.sax.*;version="0";resolution:=optional, + org.xmlbeam.*;version="${xmlbeam:[=.=.=,+1.0.0)}";resolution:=optional, + scala.*;version="${scala:[=.=.=,+1.0.0)}";resolution:=optional, + io.reactivex.*;version="0";resolution:=optional, + reactor.*;version="0";resolution:=optional, + rx.*;version="0";resolution:=optional, + kotlin.*;version="0";resolution:=optional +DynamicImport-Package: *
diff --git a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.mongodb-2.0.8.RELEASE/build.gradle b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.mongodb-2.0.8.RELEASE/build.gradle new file mode 100644 index 0000000..b3a1cfd --- /dev/null +++ b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.mongodb-2.0.8.RELEASE/build.gradle
@@ -0,0 +1,3 @@ +dependencies { + sourceBundle 'org.springframework.data:spring-data-mongodb:2.0.8.RELEASE' +}
diff --git a/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.mongodb-2.0.8.RELEASE/org.springframework.data.mongodb.mf b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.mongodb-2.0.8.RELEASE/org.springframework.data.mongodb.mf new file mode 100644 index 0000000..fedbb79 --- /dev/null +++ b/recipe-accessing-data-mongodb/recipe-accessing-data-mongodb-runtime/org.springframework.data.mongodb-2.0.8.RELEASE/org.springframework.data.mongodb.mf
@@ -0,0 +1,57 @@ +Bundle-SymbolicName: org.springframework.data.mongodb +Bundle-Name: Spring Data MongoDB Support +Bundle-Vendor: Eclipse Virgo +Bundle-ManifestVersion: 2 +Excluded-Imports: + lombok.* +Import-Package: + sun.reflect;version="0";resolution:=optional +Import-Template: + com.fasterxml.jackson.*;version="${jackson:[=.=.=,+1.0.0)}";resolution:=optional, + com.google.common.*;version="${guava:[=.=.=,+10.0.0)}";resolution:=optional, + com.mongodb;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.async.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.bulk.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.client.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.connection.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.diagnostics.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.event.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.gridfs.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.lang.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.management.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.operation.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.selector.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.session.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.util.*;version="${mongo:[=.=.=,+1.0.0)}", + com.mongodb.reactivestreams.*;version="${mongodbDriverReactivestreamsVersion:[=.=.=,+1.0.0)}", + com.querydsl.*;version="${querydsl:[=.=.=,+1.0.0)}";resolution:=optional, + javax.annotation.*;version="0", + javax.enterprise.*;version="[1.0.0,2.0.0)";resolution:=optional, + javax.tools.*;version="0", + javax.net.*;version="0", + javax.validation.*;version="${validation:[=.=.=.=,+1.0.0)}";resolution:=optional, + javax.xml.bind.*;version=0, + org.aopalliance.*;version="[1.0.0, 2.0.0)";resolution:=optional, + org.bson.*;version="0", + org.objenesis.*;version="${objenesis:[=.=.=, +1.0.0)}";resolution:=optional, + org.slf4j.*;version="${slf4j:[=.=.=,+1.0.0)}", + org.springframework.asm.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.aop.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.beans.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.cglib.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.context.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.core.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.dao.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.expression.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.jmx.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.lang.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.objenesis.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.util.*;version="${spring:[=.=.=.=,+1.0.0)}", + org.springframework.data.*;version="${springDataCommonsVersion:[=.=.=.=,+1.0.0)}", + org.w3c.dom.*;version="0", + reactor.*;version="0";resolution:=optional, + org.reactivestreams.*;version="0";resolution:=optional, + org.jetbrains.*;version="0";resolution:=optional, + kotlin.*;version="0";resolution:=optional +Export-Template: + org.springframework.data.mongodb.*;version="${version}"
diff --git a/recipe-accessing-data-mongodb/settings.gradle b/recipe-accessing-data-mongodb/settings.gradle index aff841b..659a394 100644 --- a/recipe-accessing-data-mongodb/settings.gradle +++ b/recipe-accessing-data-mongodb/settings.gradle
@@ -1,4 +1,7 @@ include 'org.eclipse.virgo.samples.recipe.data.mongodb' +include 'recipe-accessing-data-mongodb-runtime:org.springframework.data.commons-2.0.8.RELEASE' +include 'recipe-accessing-data-mongodb-runtime:org.springframework.data.mongodb-2.0.8.RELEASE' + include 'recipe-accessing-data-mongodb-runtime' include 'recipe-accessing-data-mongodb-app'
diff --git a/recipe-accessing-data-mongodb/src/docs/asciidoc/08_dockerize_recipe.adoc b/recipe-accessing-data-mongodb/src/docs/asciidoc/08_dockerize_recipe.adoc index 3e35458..37602f7 100644 --- a/recipe-accessing-data-mongodb/src/docs/asciidoc/08_dockerize_recipe.adoc +++ b/recipe-accessing-data-mongodb/src/docs/asciidoc/08_dockerize_recipe.adoc
@@ -25,7 +25,7 @@ [source,sh] ---- -$ docker run --rm -it --net=recipe_nw --name mongodb mongo:3.4.3 +$ docker run --rm -it --net=recipe_nw --name mongodb mongo:4.0.0 ---- then run the application with the environment variable `mongodb.host` set to the container name used in the command above: