Update recipe-accessing-data-mongodb

* Bump to Gradle wrapper 4.6
* Update dockerizor to 0.9.1
* Code cleanup
diff --git a/recipe-accessing-data-mongodb/build.gradle b/recipe-accessing-data-mongodb/build.gradle
index 5ca56fd..bc8ad75 100644
--- a/recipe-accessing-data-mongodb/build.gradle
+++ b/recipe-accessing-data-mongodb/build.gradle
@@ -1,3 +1,5 @@
+import static org.gradle.api.tasks.wrapper.Wrapper.DistributionType
+
 buildscript {
 	repositories {
 		mavenCentral()
@@ -7,12 +9,24 @@
 	}
 	dependencies {
 		classpath "gradle.plugin.org.eclipse.virgo.bundlor:bundlor-plugin:0.2"
-		classpath "gradle.plugin.com.eclipsesource.dockerizor:dockerizor:0.8.2"
+		classpath "gradle.plugin.com.eclipsesource.dockerizor:dockerizor:0.9.1"
 		classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
 	}
 }
 
-apply plugin: 'org.asciidoctor.convert'
+ext {
+	// Eclipse Mars.1 bundle from Maven Central provided by Tycho
+	equinoxVersion            = "3.10.101.v20150820-1432"
+	// Eclipse Mars.1 bundle from Maven Central provided by Birt
+	osgiServicesVersion       = "3.5.0.v20150519-2006"
+
+	junitVersion              = "4.12"
+
+	virgoProjects = [
+		project(':org.eclipse.virgo.samples.recipe.data.mongodb'),
+	]
+	dockerProjects = subprojects.findAll { it.name.contains('-runtime') || it.name.contains('-app') }
+}
 
 ext.virgoProjects = [
 	project(':org.eclipse.virgo.samples.recipe.data.mongodb'),
@@ -37,44 +51,18 @@
 	apply plugin: 'java'
 	apply plugin: 'eclipse'
 	apply plugin: 'eclipse-wtp'
-
-	repositories {
-	    mavenCentral()
-	}
-
-	sourceCompatibility = '1.8'
-	targetCompatibility = '1.8'
+	apply plugin: 'idea'
 
 	compileJava {
-		options.encoding = 'utf-8'
-		options.fork = true
-		doFirst {
-			options.forkOptions.with {
-				executable = 'java'
-				jvmArgs = [
-					'-cp',
-					configurations.ecj.asPath,
-					'org.eclipse.jdt.internal.compiler.batch.Main',
-					'-warn:-unused'
-				]
-			}
-		}
+		sourceCompatibility = 1.8
+		targetCompatibility = 1.8
+		options.encoding = 'UTF-8'
 	}
 
 	compileTestJava {
-		options.encoding = 'utf-8'
-		options.fork = true
-		doFirst {
-			options.forkOptions.with {
-				executable = 'java'
-				jvmArgs = [
-					'-cp',
-					configurations.ecj.asPath,
-					'org.eclipse.jdt.internal.compiler.batch.Main',
-					'-warn:-unused'
-				]
-			}
-		}
+		sourceCompatibility = 1.8
+		targetCompatibility = 1.8
+		options.encoding = 'UTF-8'
 	}
 
 	eclipse {
@@ -95,8 +83,6 @@
 			}
 		}
 	}
-
-	configurations {  ecj { } }
 }
 
 configure(virgoProjects) {
@@ -142,15 +128,21 @@
 	dockerizor {
 		maintainer = 'Florian Waibel <fwaibel@eclipsesource.com>'
 
-		createLocalCopy = System.properties['local.build'] == 'true'
-		removeAdminConsole = System.properties['local.build'] != 'true'
-        removeSplash = System.properties['local.build'] != 'true'
+		javaImage = 'openjdk:8u171-jre-alpine3.7'
+
+		removeSplash = false
+		removeAdminConsole = false
 	}
 
 	dockerize.dependsOn configurations.repositoryExt
 	dockerize.dependsOn configurations.repositoryUsr
 }
 
-task wrapper(type: Wrapper) {
-    gradleVersion = '3.1'
+configure(rootProject) {
+	apply plugin: 'org.asciidoctor.gradle.asciidoctor'
+
+	wrapper {
+		gradleVersion = '4.6' // CQ 16848
+		distributionType = DistributionType.BIN
+	}
 }
diff --git a/recipe-accessing-data-mongodb/gradle.properties b/recipe-accessing-data-mongodb/gradle.properties
index 7320cc2..76aafb2 100644
--- a/recipe-accessing-data-mongodb/gradle.properties
+++ b/recipe-accessing-data-mongodb/gradle.properties
@@ -1,17 +1,9 @@
 version = 0.3.0.BUILD-SNAPSHOT
 
-springframeworkVersion = 4.2.9.RELEASE
+# These values are used by bundlor and cannot be moved to build.gradle
 
-# Eclipse Mars.1 bundle from Maven Central provided by Tycho
-# org.eclipse.osgi_3.10.101.v20150820-1432.jar
-equinoxVersion = 3.10.101.v20150820-1432
-# Eclipse Mars.1 bundle from Maven Central provided by Birt
-# org.eclipse.osgi.services_3.5.0.v20150519-2006.jar
-osgiServicesVersion = 3.5.0.v20150519-2006
+springframeworkVersion = 4.2.9.RELEASE
 
 mongoJavaDriverVersion = 2.14.3
 springDataCommonsVersion = 1.12.8.RELEASE
 springDataMongodbVersion = 1.9.8.RELEASE
-
-# test dependencies
-junitVersion = 4.12
diff --git a/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.jar b/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.jar
index 13372ae..f6b961f 100644
--- a/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.jar
+++ b/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.properties b/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.properties
index 3996521..bf3de21 100644
--- a/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.properties
+++ b/recipe-accessing-data-mongodb/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Wed Feb 01 15:45:43 CET 2017
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
diff --git a/recipe-accessing-data-mongodb/gradlew b/recipe-accessing-data-mongodb/gradlew
index 9d82f78..cccdd3d 100755
--- a/recipe-accessing-data-mongodb/gradlew
+++ b/recipe-accessing-data-mongodb/gradlew
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
 
 ##############################################################################
 ##
@@ -6,42 +6,6 @@
 ##
 ##############################################################################
 
-# 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
-
 # Attempt to set APP_HOME
 # Resolve links: $0 may be a link
 PRG="$0"
@@ -60,6 +24,46 @@
 APP_HOME="`pwd -P`"
 cd "$SAVED" >/dev/null
 
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# 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
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
 
 # Determine the Java command to use to start the JVM.
@@ -85,7 +89,7 @@
 fi
 
 # Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
     MAX_FD_LIMIT=`ulimit -H -n`
     if [ $? -eq 0 ] ; then
         if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -150,11 +154,19 @@
     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=("$@")
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
 }
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
 
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+  cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/recipe-accessing-data-mongodb/gradlew.bat b/recipe-accessing-data-mongodb/gradlew.bat
index aec9973..e95643d 100644
--- a/recipe-accessing-data-mongodb/gradlew.bat
+++ b/recipe-accessing-data-mongodb/gradlew.bat
@@ -8,14 +8,14 @@
 @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 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=

+

 @rem Find java.exe

 if defined JAVA_HOME goto findJavaFromJavaHome

 

@@ -46,10 +46,9 @@
 goto fail

 

 :init

-@rem Get command-line arguments, handling Windowz variants

+@rem Get command-line arguments, handling Windows 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.

@@ -60,11 +59,6 @@
 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

diff --git a/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/build.gradle b/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/build.gradle
index 6b251c0..00fb72b 100644
--- a/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/build.gradle
+++ b/recipe-accessing-data-mongodb/org.eclipse.virgo.samples.recipe.data.mongodb/build.gradle
@@ -1,5 +1,3 @@
 dependencies {
-    ecj group: "org.eclipse.jdt.core.compiler", name: "ecj", version: "4.4.2"
-
 	compile "org.springframework.data:spring-data-mongodb:${springDataMongodbVersion}"
 }
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 7464190..0cff26e 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,11 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns:aop="http://www.springframework.org/schema/aop"
     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/aop http://www.springframework.org/schema/aop/spring-aop.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" >
 
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 ec80833..3f7a76d 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
@@ -4,6 +4,7 @@
 Bundle-SymbolicName: org.eclipse.virgo.samples.recipe.data.mongodb
 Import-Bundle: org.springframework.aop,
  org.springframework.beans,
+ org.springframework.core,
  org.springframework.data.core,
  org.springframework.data.mongodb
 Excluded-Imports: org.springframework.*
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 47576cf..363ee56 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
@@ -4,6 +4,9 @@
 
 	pickupFiles = ['recipe-accessing-data-mongodb.plan']
 
+	virgoVersion = 'latest'
+	hudsonJobName = 'virgo-master'
+
 	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 d4a4c29..85f7d6b 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
@@ -2,6 +2,11 @@
 	repository = 'virgo-recipe/accessing-data-mongodb-runtime'
     description = 'Virgo Recipe MongoDB (runtime-only) created with Gradle Plugin: com.eclipsesource.dockerizor'
 
+	createLocalCopy = true
+
+	virgoVersion = 'latest'
+	hudsonJobName = 'virgo-master'
+
 	virgoHome = '/home/virgo/virgo-recipe-accessing-data-mongodb-runtime'
 }