Return-Path: X-Original-To: apmail-zest-commits-archive@minotaur.apache.org Delivered-To: apmail-zest-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1332C19A43 for ; Sat, 16 Apr 2016 05:38:52 +0000 (UTC) Received: (qmail 85716 invoked by uid 500); 16 Apr 2016 05:38:52 -0000 Delivered-To: apmail-zest-commits-archive@zest.apache.org Received: (qmail 85668 invoked by uid 500); 16 Apr 2016 05:38:51 -0000 Mailing-List: contact commits-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list commits@zest.apache.org Received: (qmail 85613 invoked by uid 99); 16 Apr 2016 05:38:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Apr 2016 05:38:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A22A7E032D; Sat, 16 Apr 2016 05:38:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: niclas@apache.org To: commits@zest.apache.org Date: Sat, 16 Apr 2016 05:38:54 -0000 Message-Id: <8baada61fc9646f791d12040ee4a5b18@git.apache.org> In-Reply-To: <2e0e156c059b49169e3670262add6383@git.apache.org> References: <2e0e156c059b49169e3670262add6383@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/5] zest-java git commit: Forgotten to call the super.assemble() in other serialization tests. http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html b/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html deleted file mode 100644 index 8bb0a631..0000000 --- a/tools/shell/src/etc/templates/restproject/files/app/src/test/java/__package__/package.html +++ /dev/null @@ -1,21 +0,0 @@ - - -Test directory http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_ deleted file mode 100644 index f26f7f8..0000000 --- a/tools/shell/src/etc/templates/restproject/files/bootstrap/build.gradle_ +++ /dev/null @@ -1,16 +0,0 @@ - -dependencies { - compile project( ":model" ) - compile project( ":rest" ) - - compile "org.apache.zest.core:org.apache.zest.core.spi:$zestVersion" - compile "org.apache.zest.core:org.apache.zest.core.bootstrap:$zestVersion" - - - compile "org.apache.zest.library:org.apache.zest.library.fileconfig:$zestVersion" - compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion" - compile "org.apache.zest.extension:org.apache.zest.extension.entitystore-file:$zestVersion" - compile "org.apache.zest.extension:org.apache.zest.extension.indexing-rdf:$zestVersion" - compile "org.apache.zest.extension:org.apache.zest.extension.valueserialization-jackson:$zestVersion" - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ deleted file mode 100644 index e4bffa5..0000000 --- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/config/package.html_ +++ /dev/null @@ -1 +0,0 @@ -This package contains the assembly information for the Config layer. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ deleted file mode 100644 index 21dbaa9..0000000 --- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/connectivity/package.html_ +++ /dev/null @@ -1 +0,0 @@ -This package contains the assembly information for the Connectivity layer. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ deleted file mode 100644 index 2bdc426..0000000 --- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/domain/package.html_ +++ /dev/null @@ -1 +0,0 @@ -This package contains the assembly information for the Domain layer. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ deleted file mode 100644 index cf2f9b5..0000000 --- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/main/java/__package__/bootstrap/infrastructure/package.html_ +++ /dev/null @@ -1 +0,0 @@ -This package contains the assembly information for the Infrastructure layer. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_ deleted file mode 100644 index 300838d..0000000 --- a/tools/shell/src/etc/templates/restproject/files/bootstrap/src/test/java/__package__/package.html_ +++ /dev/null @@ -1 +0,0 @@ -Tests package \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/build.gradle_ deleted file mode 100644 index 9bfbb1e..0000000 --- a/tools/shell/src/etc/templates/restproject/files/build.gradle_ +++ /dev/null @@ -1,26 +0,0 @@ - -version = 1.0 - -rootProject.ext { - // zestVersion = @@version@@ - zestVersion = 0 // 0 only during dev & testing -} - -allprojects() { - apply plugin: 'java' - apply plugin: 'idea' - apply plugin: 'maven' - - repositories { - mavenLocal() - mavenCentral() - maven { name 'restlet-repo'; url 'http://maven.restlet.org/' } - } - - - dependencies { - compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion" - testCompile "org.apache.zest.core:org.apache.zest.core.testsupport:$zestVersion" - } -} - http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_ deleted file mode 100644 index 0087cd3..0000000 Binary files a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.jar_ and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_ deleted file mode 100644 index fafa8dd..0000000 --- a/tools/shell/src/etc/templates/restproject/files/gradle/wrapper/gradle-wrapper.properties_ +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Jul 06 10:43:59 EEST 2015 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradlew.bat_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/gradlew.bat_ b/tools/shell/src/etc/templates/restproject/files/gradlew.bat_ deleted file mode 100644 index 8a0b282..0000000 --- a/tools/shell/src/etc/templates/restproject/files/gradlew.bat_ +++ /dev/null @@ -1,90 +0,0 @@ -@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 http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/gradlew_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/gradlew_ b/tools/shell/src/etc/templates/restproject/files/gradlew_ deleted file mode 100755 index 91a7e26..0000000 --- a/tools/shell/src/etc/templates/restproject/files/gradlew_ +++ /dev/null @@ -1,164 +0,0 @@ -#!/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 "$@" http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/model/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/model/build.gradle_ deleted file mode 100644 index 83f55b2..0000000 --- a/tools/shell/src/etc/templates/restproject/files/model/build.gradle_ +++ /dev/null @@ -1,7 +0,0 @@ - - -dependencies { - - compile "org.restlet.jee:org.restlet:2.3.4" - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_ b/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_ deleted file mode 100644 index 441cb85..0000000 --- a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/orders/package.html_ +++ /dev/null @@ -1 +0,0 @@ -Very simple Domain Model to showcase the features of the Restlet library \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_ b/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_ deleted file mode 100644 index bcf0ee4..0000000 --- a/tools/shell/src/etc/templates/restproject/files/model/src/main/java/__package__/model/security/package.html_ +++ /dev/null @@ -1 +0,0 @@ -Very simple Security Model to showcase the features of the Restlet library \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_ deleted file mode 100644 index 300838d..0000000 --- a/tools/shell/src/etc/templates/restproject/files/model/src/test/java/__package__/package.html_ +++ /dev/null @@ -1 +0,0 @@ -Tests package \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_ b/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_ deleted file mode 100644 index a89355a..0000000 --- a/tools/shell/src/etc/templates/restproject/files/rest/build.gradle_ +++ /dev/null @@ -1,8 +0,0 @@ - -dependencies { - compile project( ":model" ) - - compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion" - compile "org.apache.zest.library:org.apache.zest.library.restlet:$zestVersion" - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_ b/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_ deleted file mode 100644 index 249f68c..0000000 --- a/tools/shell/src/etc/templates/restproject/files/rest/src/main/java/__package__/rest/security/package.html_ +++ /dev/null @@ -1 +0,0 @@ -Package for the security handling in the Connectivity Layer \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_ deleted file mode 100644 index 300838d..0000000 --- a/tools/shell/src/etc/templates/restproject/files/rest/src/test/java/__package__/package.html_ +++ /dev/null @@ -1 +0,0 @@ -Tests package \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/build.gradle_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/singleton/files/build.gradle_ b/tools/shell/src/etc/templates/singleton/files/build.gradle_ new file mode 100644 index 0000000..9da0e88 --- /dev/null +++ b/tools/shell/src/etc/templates/singleton/files/build.gradle_ @@ -0,0 +1,24 @@ + +version = 1.0 + +rootProject.ext { + zestVersion = @@version@@ +} + +allprojects() { + apply plugin: 'java' + apply plugin: 'idea' + apply plugin: 'maven' + + repositories { + mavenLocal() + mavenCentral() + } + + + dependencies { + compile "org.apache.zest.core:org.apache.zest.core.api:$zestVersion" + testCompile "org.apache.zest.core:org.apache.zest.core.testsupport:$zestVersion" + } +} + http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_ b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_ new file mode 100644 index 0000000..0087cd3 Binary files /dev/null and b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.jar_ differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_ b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_ new file mode 100644 index 0000000..fafa8dd --- /dev/null +++ b/tools/shell/src/etc/templates/singleton/files/gradle/wrapper/gradle-wrapper.properties_ @@ -0,0 +1,6 @@ +#Mon Jul 06 10:43:59 EEST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradlew.bat_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/singleton/files/gradlew.bat_ b/tools/shell/src/etc/templates/singleton/files/gradlew.bat_ new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/tools/shell/src/etc/templates/singleton/files/gradlew.bat_ @@ -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 http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/gradlew_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/singleton/files/gradlew_ b/tools/shell/src/etc/templates/singleton/files/gradlew_ new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/tools/shell/src/etc/templates/singleton/files/gradlew_ @@ -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 "$@" http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_ b/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_ new file mode 100644 index 0000000..e071c79 --- /dev/null +++ b/tools/shell/src/etc/templates/singleton/files/src/main/java/__package__/package.html_ @@ -0,0 +1 @@ +Package for the Java source files \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_ b/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_ new file mode 100644 index 0000000..eaefd36 --- /dev/null +++ b/tools/shell/src/etc/templates/singleton/files/src/test/java/__package__/package.html_ @@ -0,0 +1 @@ +Package for testing classes. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java index a086f6a..22f8a9d 100644 --- a/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/FileUtils.java @@ -23,7 +23,6 @@ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -44,6 +43,28 @@ public class FileUtils return dir; } + public static boolean removeDir( File dir ) + { + File[] files = dir.listFiles(); + boolean success = true; + if( files != null ) + { + for( File f : files ) + { + if( f.isDirectory() ) + { + success = success && removeDir( f ); + } + else + { + success = success && f.delete(); + } + } + } + success = success && dir.delete(); + return success; + } + public static Map readPropertiesResource( String resourceName ) { ClassLoader cl = FileUtils.class.getClassLoader(); @@ -77,11 +98,14 @@ public class FileUtils public static void copyFile( File srcFile, File dest ) throws IOException { - byte[] buffer = new byte[100000]; - try(BufferedInputStream in = new BufferedInputStream( new FileInputStream(srcFile) )){ - try(BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( dest ) )){ + byte[] buffer = new byte[ 100000 ]; + try (BufferedInputStream in = new BufferedInputStream( new FileInputStream( srcFile ) )) + { + try (BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( dest ) )) + { int bytes; - while( (bytes = in.read( buffer )) != -1 ){ + while( ( bytes = in.read( buffer ) ) != -1 ) + { out.write( buffer, 0, bytes ); } out.flush(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java index 138c112..a5eeb6d 100644 --- a/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/Main.java @@ -60,20 +60,32 @@ public class Main } else { - Command command = commands.get( args[ 0 ] ); - if( command == null ) + try { - System.err.println( "Command " + args[ 0 ] + " is unknown." ); - System.err.println( "" ); - commands.get( "help" ).execute( args, input(), error() ); + executeCommand( args ); } - else + catch( HelpNeededException e ) { - command.execute( args, input(), output() ); + commands.get( "help" ).execute( args, input(), error() ); } } } + private void executeCommand( String[] args ) + { + Command command = commands.get( args[ 0 ] ); + if( command == null ) + { + System.err.println( "Command " + args[ 0 ] + " is unknown." ); + System.err.println( "" ); + commands.get( "help" ).execute( args, input(), error() ); + } + else + { + command.execute( args, input(), output() ); + } + } + private boolean contains( String[] args, String s ) { for( String arg : args ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java index 8e724f7..15368c8 100644 --- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/CreateProject.java @@ -35,7 +35,7 @@ public class CreateProject extends AbstractCommand public void execute( String[] args, BufferedReader input, PrintWriter output ) throws HelpNeededException { - if( args.length < 4 ) + if( args.length != 4 ) { throw new HelpNeededException(); } @@ -46,8 +46,8 @@ public class CreateProject extends AbstractCommand Map props = FileUtils.readPropertiesResource( "templates/" + template + "/project.properties" ); if( props == null ) { - System.err.println( "Project Template " + template + " does not exist. " ); - System.exit( 1 ); + System.err.println( "Project Template " + template + " does not exist. \n\n" ); + throw new HelpNeededException(); } props.put( "project.dir", projectDir.getAbsolutePath() ); props.put( "project.name", projectName); @@ -70,7 +70,7 @@ public class CreateProject extends AbstractCommand @Override public String description() { - return "create project"; + return "type name package\tCreates a new skeletal project in directory [name]."; } @Override http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java new file mode 100644 index 0000000..7139475 --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/DefaultProjectCreator.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project; + +import java.io.File; +import java.io.IOException; +import java.util.Map; +import org.apache.zest.tools.shell.create.project.common.ApplicationAssemblerWriter; +import org.apache.zest.tools.shell.create.project.common.ConfigLayerWriter; +import org.apache.zest.tools.shell.create.project.common.ConfigModuleWriter; +import org.apache.zest.tools.shell.create.project.common.ConnectivityLayerWriter; +import org.apache.zest.tools.shell.create.project.common.CrudModuleWriter; +import org.apache.zest.tools.shell.create.project.common.CustomerWriter; +import org.apache.zest.tools.shell.create.project.common.DomainLayerWriter; +import org.apache.zest.tools.shell.create.project.common.FileConfigurationModuleWriter; +import org.apache.zest.tools.shell.create.project.common.HardCodedSecurityRepositoryMixinWriter; +import org.apache.zest.tools.shell.create.project.common.IndexingModuleWriter; +import org.apache.zest.tools.shell.create.project.common.InfrastructureLayerWriter; +import org.apache.zest.tools.shell.create.project.common.OrderItemWriter; +import org.apache.zest.tools.shell.create.project.common.OrderModuleWriter; +import org.apache.zest.tools.shell.create.project.common.OrderWriter; +import org.apache.zest.tools.shell.create.project.common.SecurityModuleWriter; +import org.apache.zest.tools.shell.create.project.common.SecurityRepositoryWriter; +import org.apache.zest.tools.shell.create.project.common.SerializationModuleWriter; +import org.apache.zest.tools.shell.create.project.common.SettingsWriter; +import org.apache.zest.tools.shell.create.project.common.StorageModuleWriter; +import org.apache.zest.tools.shell.create.project.defaultp.ApplicationWriter; + +public class DefaultProjectCreator extends AbstractProjectCreator + implements ProjectCreator +{ + + @Override + public void create( String projectName, File projectDir, Map properties ) + throws IOException + { + super.create( projectName, projectDir, properties ); // creates the directory structures. + new ApplicationAssemblerWriter().writeClass( properties ); + new ApplicationWriter().writeClass( properties ); + new ConfigLayerWriter().writeClass( properties ); + new ConfigModuleWriter().writeClass( properties ); + new InfrastructureLayerWriter().writeClass( properties ); + new FileConfigurationModuleWriter().writeClass( properties ); + new StorageModuleWriter().writeClass( properties ); + new IndexingModuleWriter().writeClass( properties ); + new SerializationModuleWriter().writeClass( properties ); + new DomainLayerWriter().writeClass( properties ); + new OrderModuleWriter().writeClass( properties ); + new CrudModuleWriter().writeClass( properties ); + new ConnectivityLayerWriter().writeClass( properties ); + + new SecurityModuleWriter().writeClass( properties ); + new SecurityRepositoryWriter().writeClass( properties ); + new HardCodedSecurityRepositoryMixinWriter().writeClass( properties ); + new OrderWriter().writeClass( properties ); + new OrderItemWriter().writeClass( properties ); + new CustomerWriter().writeClass( properties ); + + new SettingsWriter().writeClass( properties ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java new file mode 100644 index 0000000..9e915b1 --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/NullProjectCreator.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project; + +import java.io.File; +import java.io.IOException; +import java.util.Map; + +public class NullProjectCreator extends AbstractProjectCreator + implements ProjectCreator +{ + + @Override + public void create( String projectName, File projectDir, Map properties ) + throws IOException + { + super.create( projectName, projectDir, properties ); // creates the directory structures. + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java new file mode 100644 index 0000000..299305b --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestAppProjectCreator.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project; + +import java.io.File; +import java.io.IOException; +import java.util.Map; +import org.apache.zest.tools.shell.create.project.common.ApplicationAssemblerWriter; +import org.apache.zest.tools.shell.create.project.restapp.ApplicationWriter; +import org.apache.zest.tools.shell.create.project.common.ConfigLayerWriter; +import org.apache.zest.tools.shell.create.project.common.ConfigModuleWriter; +import org.apache.zest.tools.shell.create.project.common.ConnectivityLayerWriter; +import org.apache.zest.tools.shell.create.project.common.CrudModuleWriter; +import org.apache.zest.tools.shell.create.project.common.CustomerWriter; +import org.apache.zest.tools.shell.create.project.common.DomainLayerWriter; +import org.apache.zest.tools.shell.create.project.common.FileConfigurationModuleWriter; +import org.apache.zest.tools.shell.create.project.common.HardCodedSecurityRepositoryMixinWriter; +import org.apache.zest.tools.shell.create.project.common.IndexingModuleWriter; +import org.apache.zest.tools.shell.create.project.common.InfrastructureLayerWriter; +import org.apache.zest.tools.shell.create.project.common.OrderItemWriter; +import org.apache.zest.tools.shell.create.project.common.OrderWriter; +import org.apache.zest.tools.shell.create.project.restapp.RestModuleWriter; +import org.apache.zest.tools.shell.create.project.common.OrderModuleWriter; +import org.apache.zest.tools.shell.create.project.common.SecurityModuleWriter; +import org.apache.zest.tools.shell.create.project.common.SecurityRepositoryWriter; +import org.apache.zest.tools.shell.create.project.common.SerializationModuleWriter; +import org.apache.zest.tools.shell.create.project.common.SettingsWriter; +import org.apache.zest.tools.shell.create.project.restapp.SimpleEnrolerWriter; +import org.apache.zest.tools.shell.create.project.restapp.SimpleVerifierWriter; +import org.apache.zest.tools.shell.create.project.common.StorageModuleWriter; +import org.apache.zest.tools.shell.create.project.restapp.WebXmlWriter; + +public class RestAppProjectCreator extends AbstractProjectCreator + implements ProjectCreator +{ + + @Override + public void create( String projectName, File projectDir, Map properties ) + throws IOException + { + super.create( projectName, projectDir, properties ); // creates the directory structures. + new ApplicationAssemblerWriter().writeClass( properties ); + new ConfigLayerWriter().writeClass( properties ); + new ConfigModuleWriter().writeClass( properties ); + new InfrastructureLayerWriter().writeClass( properties ); + new FileConfigurationModuleWriter().writeClass( properties ); + new StorageModuleWriter().writeClass( properties ); + new IndexingModuleWriter().writeClass( properties ); + new SerializationModuleWriter().writeClass( properties ); + new DomainLayerWriter().writeClass( properties ); + new OrderModuleWriter().writeClass( properties ); + new CrudModuleWriter().writeClass( properties ); + new ConnectivityLayerWriter().writeClass( properties ); + new RestModuleWriter().writeClass( properties ); + + new ApplicationWriter().writeClass( properties ); + new SimpleEnrolerWriter().writeClass( properties ); + new SimpleVerifierWriter().writeClass( properties ); + + new SecurityModuleWriter().writeClass( properties ); + new SecurityRepositoryWriter().writeClass( properties ); + new HardCodedSecurityRepositoryMixinWriter().writeClass( properties ); + new OrderWriter().writeClass( properties ); + new OrderItemWriter().writeClass( properties ); + new CustomerWriter().writeClass( properties ); + + new SettingsWriter().writeClass( properties ); + new WebXmlWriter().writeClass( properties ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java deleted file mode 100644 index 513eb74..0000000 --- a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/RestProjectCreator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.tools.shell.create.project; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import org.apache.zest.tools.shell.create.project.restapp.ApplicationAssemblerWriter; -import org.apache.zest.tools.shell.create.project.restapp.ApplicationWriter; -import org.apache.zest.tools.shell.create.project.restapp.ConfigLayerWriter; -import org.apache.zest.tools.shell.create.project.restapp.ConfigModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.ConnectivityLayerWriter; -import org.apache.zest.tools.shell.create.project.restapp.CrudModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.CustomerWriter; -import org.apache.zest.tools.shell.create.project.restapp.DomainLayerWriter; -import org.apache.zest.tools.shell.create.project.restapp.FileConfigurationModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.HardCodedSecurityRepositoryMixinWriter; -import org.apache.zest.tools.shell.create.project.restapp.IndexingModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.InfrastructureLayerWriter; -import org.apache.zest.tools.shell.create.project.restapp.OrderItemWriter; -import org.apache.zest.tools.shell.create.project.restapp.OrderWriter; -import org.apache.zest.tools.shell.create.project.restapp.RestModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.OrderModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.SecurityModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.SecurityRepositoryWriter; -import org.apache.zest.tools.shell.create.project.restapp.SerializationModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.SettingsWriter; -import org.apache.zest.tools.shell.create.project.restapp.SimpleEnrolerWriter; -import org.apache.zest.tools.shell.create.project.restapp.SimpleVerifierWriter; -import org.apache.zest.tools.shell.create.project.restapp.StorageModuleWriter; -import org.apache.zest.tools.shell.create.project.restapp.WebXmlWriter; - -public class RestProjectCreator extends AbstractProjectCreator - implements ProjectCreator -{ - - @Override - public void create( String projectName, - File projectDir, - Map properties - ) - throws IOException - { - super.create( projectName, projectDir, properties ); // creates the directory structures. - new ApplicationAssemblerWriter().writeClass( properties ); - new ConfigLayerWriter().writeClass( properties ); - new ConfigModuleWriter().writeClass( properties ); - new InfrastructureLayerWriter().writeClass( properties ); - new FileConfigurationModuleWriter().writeClass( properties ); - new StorageModuleWriter().writeClass( properties ); - new IndexingModuleWriter().writeClass( properties ); - new SerializationModuleWriter().writeClass( properties ); - new DomainLayerWriter().writeClass( properties ); - new OrderModuleWriter().writeClass( properties ); - new CrudModuleWriter().writeClass( properties ); - new ConnectivityLayerWriter().writeClass( properties ); - new RestModuleWriter().writeClass( properties ); - - new ApplicationWriter().writeClass( properties ); - new SimpleEnrolerWriter().writeClass( properties ); - new SimpleVerifierWriter().writeClass( properties ); - - new SecurityModuleWriter().writeClass( properties ); - new SecurityRepositoryWriter().writeClass( properties ); - new HardCodedSecurityRepositoryMixinWriter().writeClass( properties ); - new OrderWriter().writeClass( properties ); - new OrderItemWriter().writeClass( properties ); - new CustomerWriter().writeClass( properties ); - - new SettingsWriter().writeClass( properties ); - new WebXmlWriter().writeClass( properties ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java new file mode 100644 index 0000000..4cf990a --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/SingletonProjectCreator.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project; + +import java.io.File; +import java.io.IOException; +import java.util.Map; +import org.apache.zest.tools.shell.create.project.singleton.SingletonApplicationAssemblerWriter; + +public class SingletonProjectCreator extends AbstractProjectCreator + implements ProjectCreator +{ + + @Override + public void create( String projectName, File projectDir, Map properties ) + throws IOException + { + super.create( projectName, projectDir, properties ); // creates the directory structures. + new SingletonApplicationAssemblerWriter().writeClass( properties ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java new file mode 100644 index 0000000..0ab880a --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ApplicationAssemblerWriter.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project.common; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; + +public class ApplicationAssemblerWriter +{ + + public void writeClass( Map properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".bootstrap;" ); + pw.println(); + pw.println( "import java.io.IOException;" ); + pw.println( "import java.nio.file.Files;" ); + pw.println( "import java.nio.file.Path;" ); + pw.println( "import java.nio.file.Paths;" ); + pw.println( "import java.util.function.Function;" ); + pw.println(); + pw.println( "import org.apache.zest.api.structure.Application;" ); + pw.println( "import org.apache.zest.api.structure.Module;\n" ); + pw.println( "import org.apache.zest.bootstrap.ApplicationAssembly;" ); + pw.println( "import org.apache.zest.bootstrap.AssemblyException;" ); + pw.println( "import org.apache.zest.bootstrap.LayerAssembly;" ); + pw.println( "import org.apache.zest.bootstrap.ModuleAssembly;" ); + pw.println( "import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler;" ); + pw.println(); + pw.println( "import " + rootPackage + ".bootstrap.connectivity.ConnectivityLayer;" ); + pw.println( "import " + rootPackage + ".bootstrap.domain.DomainLayer;" ); + pw.println( "import " + rootPackage + ".bootstrap.config.ConfigurationLayer;" ); + pw.println( "import " + rootPackage + ".bootstrap.infrastructure.InfrastructureLayer;" ); + pw.println(); + pw.print( "public class " ); + pw.print( projectName ); + pw.println( "ApplicationAssembler extends LayeredApplicationAssembler" ); + pw.println( "{" ); + pw.print( " private static final String NAME = \"" ); + pw.print( projectName ); + pw.println( "\";" ); + pw.println( " private static final String VERSION = \"1.0.alpha\";" ); + pw.println(); + pw.print(" public "); + pw.print( projectName ); + pw.println("ApplicationAssembler( Application.Mode mode )"); + pw.println(" throws AssemblyException"); + pw.println(" {"); + pw.println(" super( NAME, VERSION, mode );"); + pw.println(" }"); + pw.println(); + pw.println(" @Override"); + pw.println(" protected void assembleLayers( ApplicationAssembly assembly )"); + pw.println(" throws AssemblyException"); + pw.println(" {"); + pw.println(" LayerAssembly configLayer = createLayer( ConfigurationLayer.class );"); + pw.println(" ModuleAssembly configModule = assemblerOf( ConfigurationLayer.class ).configModule();"); + pw.println(" LayerAssembly domainLayer = createLayer( DomainLayer.class );"); + pw.println(" Function typeFinder = DomainLayer.typeFinder();"); + pw.println(" LayerAssembly infraLayer = new InfrastructureLayer( configModule, typeFinder ).assemble( assembly.layer( InfrastructureLayer.NAME ) );"); + pw.println(" LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );"); + pw.println(" connectivityLayer.uses( domainLayer );"); + pw.println(" domainLayer.uses( infraLayer );"); + pw.println(" infraLayer.uses( configLayer );"); + pw.println(" }"); + pw.println("}"); + } + } + + private PrintWriter createPrinter( Map properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/"; + String classname = properties.get( "project.name" ) + "ApplicationAssembler"; + File projectDir = new File( properties.get( "project.dir" ) ); + return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) )); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java new file mode 100644 index 0000000..e79ae20 --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigLayerWriter.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project.common; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; + +public class ConfigLayerWriter +{ + + public void writeClass( Map properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".bootstrap.config;" ); + pw.println(); + pw.println( + "import org.apache.zest.bootstrap.AssemblyException;\n" + + "import org.apache.zest.bootstrap.LayerAssembly;\n" + + "import org.apache.zest.bootstrap.ModuleAssembly;\n" + + "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" + + "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" + + "\n" + + "public class ConfigurationLayer extends LayeredLayerAssembler\n" + + " implements LayerAssembler\n" + + "{\n" + + " public static final String NAME = \"Configuration Layer\";\n" + + " private ModuleAssembly configModule;\n" + + "\n" + + " @Override\n" + + " public LayerAssembly assemble( LayerAssembly layer )\n" + + " throws AssemblyException\n" + + " {\n" + + " configModule = createModule( layer, ConfigModule.class );\n" + + " return layer;\n" + + " }\n" + + "\n" + + " public ModuleAssembly configModule()\n" + + " {\n" + + " return configModule;\n" + + " }\n" + + "}\n" + ); + } + } + + private PrintWriter createPrinter( Map properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/config/"; + String classname = "ConfigurationLayer"; + File projectDir = new File( properties.get( "project.dir" ) ); + return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java new file mode 100644 index 0000000..0c792e3 --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConfigModuleWriter.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project.common; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; + +public class ConfigModuleWriter +{ + + public void writeClass( Map properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".bootstrap.config;" ); + pw.println(); + pw.println( + "import org.apache.zest.api.common.Visibility;\n" + + "import org.apache.zest.bootstrap.AssemblyException;\n" + + "import org.apache.zest.bootstrap.LayerAssembly;\n" + + "import org.apache.zest.bootstrap.ModuleAssembly;\n" + + "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" + + "import org.apache.zest.entitystore.memory.MemoryEntityStoreService;\n" + + "import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;\n" + + "import org.apache.zest.valueserialization.jackson.JacksonValueSerializationAssembler;\n" + + "\n" + + "public class ConfigModule\n" + + " implements ModuleAssembler\n" + + "{\n" + + " @Override\n" + + " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" + + " throws AssemblyException\n" + + " {\n" + + " module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );\n" + + " new JacksonValueSerializationAssembler().visibleIn( Visibility.layer ).assemble( module );\n" + + " module.services( UuidIdentityGeneratorService.class ).visibleIn( Visibility.layer );\n" + + " return module;\n" + + " }\n" + + "}\n"); + } + } + + private PrintWriter createPrinter( Map properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/config/"; + String classname = "ConfigModule"; + File projectDir = new File( properties.get( "project.dir" ) ); + return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java new file mode 100644 index 0000000..98ea384 --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/ConnectivityLayerWriter.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project.common; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; + +public class ConnectivityLayerWriter +{ + + public void writeClass( Map properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".bootstrap.connectivity;" ); + pw.println(); + pw.println( + "import org.apache.zest.bootstrap.AssemblyException;\n" + + "import org.apache.zest.bootstrap.LayerAssembly;\n" + + "import org.apache.zest.bootstrap.layered.LayerAssembler;\n" + + "import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;\n" + + "\n" + + "public class ConnectivityLayer extends LayeredLayerAssembler\n" + + " implements LayerAssembler\n" + + "{\n" + + " public static String NAME;\n" + + "\n" + + " @Override\n" + + " public LayerAssembly assemble( LayerAssembly layer )\n" + + " throws AssemblyException\n" + + " {\n" + + " createModule( layer, RestModule.class );\n" + + " return layer;\n" + + " }\n" + + "}\n" + ); + } + } + + private PrintWriter createPrinter( Map properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/connectivity/"; + String classname = "ConnectivityLayer"; + File projectDir = new File( properties.get( "project.dir" ) ); + return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java new file mode 100644 index 0000000..3d8904e --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CrudModuleWriter.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project.common; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; + +public class CrudModuleWriter +{ + + public void writeClass( Map properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".bootstrap.domain;" ); + pw.println(); + pw.println( + "import org.apache.zest.bootstrap.AssemblyException;\n" + + "import org.apache.zest.bootstrap.LayerAssembly;\n" + + "import org.apache.zest.bootstrap.ModuleAssembly;\n" + + "import org.apache.zest.bootstrap.layered.ModuleAssembler;\n" + + "import org.apache.zest.library.restlet.assembly.CrudServiceAssembler;\n" + + "\n" + + "public class CrudModule\n" + + " implements ModuleAssembler\n" + + "{\n" + + " @Override\n" + + " public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )\n" + + " throws AssemblyException\n" + + " {\n" + + " module.withDefaultUnitOfWorkFactory();\n" + + " new CrudServiceAssembler().assemble( module );\n" + + " return module;\n" + + " }\n" + + "}\n" + ); + } + } + + private PrintWriter createPrinter( Map properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/bootstrap/domain/"; + String classname = "CrudModule"; + File projectDir = new File( properties.get( "project.dir" ) ); + return new PrintWriter( new FileWriter( new File( projectDir, "bootstrap/src/main/java/" + packagename + classname + ".java" ) ) ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0accd2cf/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java new file mode 100644 index 0000000..accc7e6 --- /dev/null +++ b/tools/shell/src/main/java/org/apache/zest/tools/shell/create/project/common/CustomerWriter.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.zest.tools.shell.create.project.common; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; + +public class CustomerWriter +{ + + public void writeClass( Map properties ) + throws IOException + { + String rootPackage = properties.get( "root.package" ); + String projectName = properties.get( "project.name" ); + try (PrintWriter pw = createPrinter( properties )) + { + pw.print( "package " ); + pw.print( properties.get( "root.package" ) ); + pw.println( ".model.orders;" ); + pw.println(); + pw.println("import java.time.ZonedDateTime;"); + pw.println("import org.apache.zest.api.entity.Identity;"); + pw.println("import org.apache.zest.api.property.Property;"); + pw.println(); + pw.println( + "public interface Customer extends Identity\n" + + "{\n" + + " Property name();\n\n" + + " Property address();\n\n" + + " Property city();\n\n" + + " Property country();\n\n" + + " Property phone();\n\n" + + " Property registered();\n\n" + + "}\n"); + } + } + + private PrintWriter createPrinter( Map properties ) + throws IOException + { + String packagename = properties.get( "root.package" ).replaceAll( "\\.", "/" ) + "/model/orders/"; + String classname = "Customer"; + File projectDir = new File( properties.get( "project.dir" ) ); + return new PrintWriter( new FileWriter( new File( projectDir, "model/src/main/java/" + packagename + classname + ".java" ) ) ); + } +}