Repository: zest-java Updated Branches: refs/heads/develop d2e6bb8a0 -> bc55a577d
http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl b/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl new file mode 100644 index 0000000..643da47 --- /dev/null +++ b/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl @@ -0,0 +1,58 @@ +<%# + * 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 <%= packageName %>.bootstrap.connectivity; + +import <%= packageName %>.rest.security.SimpleEnroler; +import <%= packageName %>.rest.security.SimpleVerifier; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import org.apache.zest.library.restlet.assembly.RestletCrudConnectivityAssembler; +import org.apache.zest.library.restlet.resource.EntryPoint; +<% if( hasFeature('sample (heroes) web application') ) { %> +import <%= packageName %>.model.heroes.Hero; +<% } -%> + +public class RestApiModule + implements ModuleAssembler +{ + public static String NAME; + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.withDefaultUnitOfWorkFactory(); + + module.objects( SimpleVerifier.class, SimpleEnroler.class); + + new RestletCrudConnectivityAssembler().assemble( module ); + module.values( EntryPoint.class ); +<% if( hasFeature('sample (heroes) web application') ) { -%> + module.values( Hero.class ); + module.services( Hero.class ); +<% } else { -%> + module.values( /* add value types */ ); + module.services( /* add services */ ); +<% } -%> + return module; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl new file mode 100644 index 0000000..482f18d --- /dev/null +++ b/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl @@ -0,0 +1,51 @@ +<%# + * 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 <%= packageName %>.model.security; + +import java.util.Collections; +import java.util.List; +import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation; + +public class HardcodedSecurityRepositoryMixin + implements SecurityRepository +{ + + @Override + public boolean verifyPassword( String userName, String password ) + { + if( userName.equals("admin") && password.equals("secret") ) { + return true; + } + if( userName.equals("user") && password.equals("123") ) { + return true; + } + return false; + } + + @UnitOfWorkPropagation + public List<String> findRoleNamesOfUser( String name ) + { + if( "admin".equals( name ) ) + { + return Collections.singletonList("admin"); + } + return Collections.singletonList("user"); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl b/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl new file mode 100644 index 0000000..6195455 --- /dev/null +++ b/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl @@ -0,0 +1,35 @@ +<%# + * 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 <%= packageName %>.model.security; + +import java.util.List; +import org.apache.zest.api.concern.Concerns; +import org.apache.zest.api.unitofwork.concern.UnitOfWorkConcern; +import org.apache.zest.api.unitofwork.concern.UnitOfWorkPropagation; + +@Concerns( UnitOfWorkConcern.class ) +public interface SecurityRepository +{ + @UnitOfWorkPropagation + boolean verifyPassword( String user, String password ); + + @UnitOfWorkPropagation + List<String> findRoleNamesOfUser( String name ); +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl b/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl new file mode 100644 index 0000000..c0ef420 --- /dev/null +++ b/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl @@ -0,0 +1,47 @@ +<%# + * 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 <%= packageName %>.bootstrap.domain; + +import org.apache.zest.api.common.Visibility; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.LayerAssembly; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.apache.zest.bootstrap.layered.ModuleAssembler; +import <%= packageName %>.model.security.SecurityRepository; +import <%= packageName %>.model.security.HardcodedSecurityRepositoryMixin; + +public class SecurityModule + implements ModuleAssembler +{ + public static String NAME; + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.withDefaultUnitOfWorkFactory(); + module.services( SecurityRepository.class ) + .withMixins( HardcodedSecurityRepositoryMixin.class ) + .visibleIn( Visibility.application ) + .instantiateOnStartup(); + + return module; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl new file mode 100644 index 0000000..5907da1 --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl @@ -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. + * + * +-%> + +apply plugin: 'war' +apply plugin: 'jetty' + +dependencies { + compile project( ":bootstrap" ) + 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.servlet:$zestVersion" + + compile "javax.servlet:servlet-api:2.5" + compile "org.restlet.jee:org.restlet:2.3.4" + + runtime "org.apache.zest.core:org.apache.zest.core.runtime:$zestVersion" + runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4" + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl new file mode 100644 index 0000000..7fb8ef9 --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl @@ -0,0 +1,34 @@ +<%# + * 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. + * + * +-%> +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/bc55a577/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl new file mode 100644 index 0000000..7f75b20 --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl @@ -0,0 +1,23 @@ +<%# + * 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. + * + * +-%> + +// dependencies { +// compile "org.restlet.jee:org.restlet:2.3.4" +// } http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl new file mode 100644 index 0000000..f1f18bd --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl @@ -0,0 +1,27 @@ +<%# + * 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. + * + * +-%> + +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/bc55a577/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl new file mode 100644 index 0000000..cd3cf5c --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl @@ -0,0 +1,44 @@ +<%# + * 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. + * + * +-%> + +version = 1.0 + +rootProject.ext { + zestVersion = 0 +} + +allprojects() { + apply plugin: 'java' + apply plugin: 'idea' + apply plugin: 'maven' + + defaultTasks 'assemble' + + 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" + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_ ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_ b/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_ new file mode 100644 index 0000000..0087cd3 Binary files /dev/null and b/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_ differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_ ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_ b/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_ new file mode 100644 index 0000000..731cb78 --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_ @@ -0,0 +1,24 @@ +<%# + * 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. + * + * +-%> +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl b/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl new file mode 100644 index 0000000..3d06f18 --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl @@ -0,0 +1,109 @@ +<%# + * 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. + * + * +-%> +@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/bc55a577/tools/generator-zest/app/templates/buildtool/gradlew.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/gradlew.tmpl b/tools/generator-zest/app/templates/buildtool/gradlew.tmpl new file mode 100755 index 0000000..11c35cc --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/gradlew.tmpl @@ -0,0 +1,183 @@ +<%# + * 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. + * + * +-%> +#!/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/bc55a577/tools/generator-zest/app/templates/buildtool/settings.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-zest/app/templates/buildtool/settings.tmpl b/tools/generator-zest/app/templates/buildtool/settings.tmpl new file mode 100644 index 0000000..467ad09 --- /dev/null +++ b/tools/generator-zest/app/templates/buildtool/settings.tmpl @@ -0,0 +1,41 @@ +<%# + * 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. + * + * +-%> +include 'app', + 'bootstrap', + 'model', + 'rest' + +rootProject.name = '<%= projectName %>' + +validateProject(rootProject, "") + +def validateProject(project, parentName) +{ + assert project.projectDir.isDirectory() + if( new File("$project.projectDir/src/main/java").exists() ) + { + assert project.buildFile.isFile() + } + if( parentName.length() > 0 ) + println "Project: " + project.name + project.children.each { child -> + validateProject(child, project.name) + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/package.json ---------------------------------------------------------------------- diff --git a/tools/generator-zest/package.json b/tools/generator-zest/package.json new file mode 100644 index 0000000..43cb59e --- /dev/null +++ b/tools/generator-zest/package.json @@ -0,0 +1,14 @@ +{ + "name": "generator-zest", + "version": "0.1.0", + "description": "", + "files": [ + "app" + ], + "keywords": [ + "yeoman-generator" + ], + "dependencies": { + "yeoman-generator": "^0.24.1" + } +}
