You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/08/21 10:53:30 UTC

[1/2] zest-java git commit: ZEST-158 - Adding a project creator based on Yeoman

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"
+  }
+}


[2/2] zest-java git commit: ZEST-158 - Adding a project creator based on Yeoman

Posted by ni...@apache.org.
 ZEST-158 - Adding a project creator based on Yeoman


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/bc55a577
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/bc55a577
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/bc55a577

Branch: refs/heads/develop
Commit: bc55a577d1b1feabfda27280a278adc234e59fa3
Parents: d2e6bb8
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sun Aug 21 18:52:51 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sun Aug 21 18:53:23 2016 +0800

----------------------------------------------------------------------
 tools/generator-zest/app/index.js               | 321 +++++++++++++++++++
 .../app/templates/ConfigModule/bootstrap.tmpl   |  43 +++
 .../templates/ConfigurationLayer/bootstrap.tmpl |  46 +++
 .../templates/ConnectivityLayer/bootstrap.tmpl  |  41 +++
 .../app/templates/CrudModule/bootstrap.tmpl     |  39 +++
 .../app/templates/DomainLayer/bootstrap.tmpl    |  46 +++
 .../FileConfigurationModule/bootstrap.tmpl      |  41 +++
 .../templates/FileStorageModule/bootstrap.tmpl  |  53 +++
 .../app/templates/Heroes/Hero.tmpl              |  28 ++
 .../app/templates/Heroes/app.tmpl               | 103 ++++++
 .../app/templates/Heroes/bootstrap.tmpl         |  68 ++++
 .../app/templates/Heroes/web.tmpl               |  54 ++++
 .../Heroes/webapp/app/app.component.css         |  34 ++
 .../Heroes/webapp/app/app.component.ts          |  37 +++
 .../Heroes/webapp/app/dashboard.component.css   |  67 ++++
 .../Heroes/webapp/app/dashboard.component.html  |  15 +
 .../Heroes/webapp/app/dashboard.component.ts    |  31 ++
 .../Heroes/webapp/app/hero-detail.component.css |  36 +++
 .../webapp/app/hero-detail.component.html       |  16 +
 .../Heroes/webapp/app/hero-detail.component.ts  |  34 ++
 .../templates/Heroes/webapp/app/hero.service.ts |  22 ++
 .../app/templates/Heroes/webapp/app/hero.ts     |  11 +
 .../Heroes/webapp/app/heroes.component.css      |  66 ++++
 .../Heroes/webapp/app/heroes.component.html     |  21 ++
 .../Heroes/webapp/app/heroes.component.ts       |  39 +++
 .../app/templates/Heroes/webapp/app/main.ts     |  16 +
 .../templates/Heroes/webapp/app/mock-heroes.ts  |  21 ++
 .../app/templates/Heroes/webapp/index.html      |  41 +++
 .../app/templates/Heroes/webapp/styles.css      | 149 +++++++++
 .../InfrastructureLayer/bootstrap.tmpl          |  55 ++++
 .../JacksonSerializationModule/bootstrap.tmpl   |  55 ++++
 .../templates/NoCachingModule/bootstrap.tmpl    |  46 +++
 .../templates/RdfIndexingModule/bootstrap.tmpl  |  52 +++
 .../HardcodedSecurityRepositoryMixin.tmpl       |  54 ++++
 .../RestApiModule/SecurityRepository.tmpl       |  36 +++
 .../templates/RestApiModule/SimpleEnroler.tmpl  |  52 +++
 .../templates/RestApiModule/SimpleVerifier.tmpl |  46 +++
 .../app/templates/RestApiModule/bootstrap.tmpl  |  58 ++++
 .../HardcodedSecurityRepositoryMixin.tmpl       |  51 +++
 .../SecurityModule/SecurityRepository.tmpl      |  35 ++
 .../app/templates/SecurityModule/bootstrap.tmpl |  47 +++
 .../app/templates/buildtool/gradle-app.tmpl     |  39 +++
 .../templates/buildtool/gradle-bootstrap.tmpl   |  34 ++
 .../app/templates/buildtool/gradle-model.tmpl   |  23 ++
 .../app/templates/buildtool/gradle-rest.tmpl    |  27 ++
 .../app/templates/buildtool/gradle-root.tmpl    |  44 +++
 .../app/templates/buildtool/gradle-wrapper.jar_ | Bin 0 -> 51348 bytes
 .../buildtool/gradle-wrapper.properties_        |  24 ++
 .../app/templates/buildtool/gradlew-bat.tmpl    | 109 +++++++
 .../app/templates/buildtool/gradlew.tmpl        | 183 +++++++++++
 .../app/templates/buildtool/settings.tmpl       |  41 +++
 tools/generator-zest/package.json               |  14 +
 52 files changed, 2664 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/index.js b/tools/generator-zest/app/index.js
new file mode 100644
index 0000000..4935e0e
--- /dev/null
+++ b/tools/generator-zest/app/index.js
@@ -0,0 +1,321 @@
+/*
+ *  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.
+ *
+ *
+ */
+
+var generators = require( 'yeoman-generator' );
+
+var zest = {};
+
+module.exports = generators.Base.extend(
+    {
+        // The name `constructor` is important here
+        constructor: function ()
+        {
+            // Calling the super constructor is important so our generator is correctly set up
+            generators.Base.apply( this, arguments );
+
+            // this.option( 'coffee' ); // This method adds support for a `--coffee` flag
+        },
+
+        method1: function ()
+        {
+            console.log( 'method 1 just ran' );
+        },
+        method2: function ()
+        {
+            console.log( 'method 2 just ran' );
+        },
+        prompting: function ()
+        {
+            return this.prompt(
+                [
+                    {
+                        type: 'input',
+                        name: 'name',
+                        message: 'Your project name',
+                        default: firstUpper( this.appname )
+                    },
+                    {
+                        type: 'input',
+                        name: 'packagename',
+                        message: 'Java package name',
+                        default: this.appname // Default to current folder name
+                    },
+                    {
+                        type: 'list',
+                        name: 'entitystore',
+                        choices: [
+                            'file',
+                            'geode',
+                            'hazelcast',
+                            'jclouds',
+                            'jdbm',
+                            'leveldb',
+                            'in-memory',
+                            'mongodb',
+                            'preferences',
+                            'redis',
+                            'riak',
+                            'sql'
+                        ],
+                        message: 'Which entity store do you want to use?'
+                    },
+                    {
+                        type: 'list',
+                        name: 'indexing',
+                        choices: [
+                            'rdf',
+                            'elasticsearch',
+                            'solr',
+                            'sql'
+                        ],
+                        message: 'Which caching system do you want to use?'
+                    },
+                    {
+                        type: 'list',
+                        name: 'caching',
+                        choices: [
+                            'none',
+                            'memcache',
+                            'ehcache'
+                        ],
+                        message: 'Which serialization system do you want to use?'
+                    },
+                    {
+                        type: 'list',
+                        name: 'serialization',
+                        choices: [
+                            'jackson',
+                            'stax',
+                            'org.json'
+                        ],
+                        message: 'Which indexing system do you want to use?'
+                    },
+                    {
+                        type: 'checkbox',
+                        name: 'features',
+                        choices: [
+                            'rest api',
+                            // 'reindexer',
+                            // 'metrics',
+                            // 'jmx',
+                            // 'version migration',
+                            'sample (heroes) web application'
+                        ],
+                        message: 'Other features?'
+                    }
+                ]
+            ).then( function ( answers )
+                    {
+                        this.log( 'app name', answers.name );
+                        this.log( 'Entity Stores:', answers.entitystore );
+                        this.log( 'Indexing:', answers.indexing );
+                        this.log( 'Caching:', answers.caching );
+                        this.log( 'Serialization:', answers.serialization );
+                        this.log( 'Features:', answers.features );
+                        zest = answers;
+                        zest.javaPackageDir = zest.packagename.replace( '.', '/' );
+                        zest.singletonApp = false;
+                        zest.entitystore = firstUpper( zest.entitystore );
+                        zest.indexing = firstUpper( zest.indexing );
+                        zest.caching = firstUpper( zest.caching );
+                        zest.serialization = firstUpper( zest.serialization );
+                        if( hasFeature( 'sample (heroes) web application' ) )
+                        {
+                            zest.features.push( 'rest api' );
+                        }
+                    }.bind( this )
+            );
+        },
+
+        writing: function ()
+        {
+            copyZestBootstrap( this, "config", "ConfigurationLayer", !zest.singeltonApp );
+            copyZestBootstrap( this, "infrastructure", "InfrastructureLayer", !zest.singeltonApp );
+            copyZestBootstrap( this, "domain", "DomainLayer", !zest.singeltonApp );
+            copyZestBootstrap( this, "connectivity", "ConnectivityLayer", !zest.singeltonApp );
+
+            copyZestBootstrap( this, "config", "ConfigModule", true );
+
+            copyZestBootstrap( this, "infrastructure", "FileConfigurationModule", true );
+
+            copyZestBootstrap( this, "infrastructure", "FileStorageModule", hasEntityStore( 'File' ) );
+            copyZestBootstrap( this, "infrastructure", "GeodeStorageModule", hasEntityStore( 'Geode' ) );
+            copyZestBootstrap( this, "infrastructure", "HazelcastStorageModule", hasEntityStore( 'Hazelcast' ) );
+            copyZestBootstrap( this, "infrastructure", "JCloudsStorageModule", hasEntityStore( 'Jclouds' ) );
+            copyZestBootstrap( this, "infrastructure", "JdbmStorageModule", hasEntityStore( 'Jdbm' ) );
+            copyZestBootstrap( this, "infrastructure", "LevelDbStorageModule", hasEntityStore( 'Leveldb' ) );
+            copyZestBootstrap( this, "infrastructure", "InMemoryStorageModule", hasEntityStore( 'Memory' ) );
+            copyZestBootstrap( this, "infrastructure", "MongoDbStorageModule", hasEntityStore( 'Mongodb' ) );
+            copyZestBootstrap( this, "infrastructure", "PreferencesStorageModule", hasEntityStore( 'Preferences' ) );
+            copyZestBootstrap( this, "infrastructure", "RedisStorageModule", hasEntityStore( 'Redis' ) );
+            copyZestBootstrap( this, "infrastructure", "RiakStorageModule", hasEntityStore( 'Riak' ) );
+            copyZestBootstrap( this, "infrastructure", "SqlStorageModule", hasEntityStore( 'Sql' ) );
+
+            copyZestBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) );
+            copyZestBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) );
+            copyZestBootstrap( this, "infrastructure", "SolrIndexingModule", hasIndexing( 'Solr' ) );
+            copyZestBootstrap( this, "infrastructure", "SqlIndexingModule", hasIndexing( 'Sql' ) );
+
+            copyZestBootstrap( this, "infrastructure", "NoCachingModule", hasCaching( 'none' ) );
+            copyZestBootstrap( this, "infrastructure", "MemcacheCachingModule", hasCaching( 'Memcache' ) );
+            copyZestBootstrap( this, "infrastructure", "EhCacheCachingModule", hasCaching( 'Ehcache' ) );
+
+            copyZestBootstrap( this, "infrastructure", "JacksonSerializationModule", hasSerialization( 'Jackson' ) );
+            copyZestBootstrap( this, "infrastructure", "StaxSerializationModule", hasSerialization( 'Stax' ) );
+            copyZestBootstrap( this, "infrastructure", "OrgJsonSerializationModule", hasSerialization( 'Orgjson' ) );
+
+            copyZestBootstrap( this, "connectivity", "RestApiModule", hasFeature( 'rest api' ) );
+            copyZestBootstrap( this, "infrastructure", "ReindexerModule", hasFeature( 'reindexer' ) );
+            copyZestBootstrap( this, "infrastructure", "MetricsModule", hasFeature( 'metrics' ) );
+            copyZestBootstrap( this, "infrastructure", "JmxModule", hasFeature( 'jmx' ) );
+            copyZestBootstrap( this, "infrastructure", "MigrationModule", hasFeature( 'version migration' ) );
+
+            copyZestBootstrap( this, "domain", "CrudModule", true );
+            copyHeroesSampleApp( this );
+            copyZestDomain( this, "security", "RestApiModule", "SecurityRepository", hasFeature( 'rest api' ) );
+
+            copyRestFeature( this, hasFeature( 'rest api' ) );
+
+            this.fs.copyTpl( this.templatePath( 'buildtool/gradle-app.tmpl' ), this.destinationPath( 'app/build.gradle' ), {} );
+            this.fs.copyTpl( this.templatePath( 'buildtool/gradle-bootstrap.tmpl' ), this.destinationPath( 'bootstrap/build.gradle' ), {} );
+            this.fs.copyTpl( this.templatePath( 'buildtool/gradle-model.tmpl' ), this.destinationPath( 'model/build.gradle' ), {} );
+            this.fs.copyTpl( this.templatePath( 'buildtool/gradle-rest.tmpl' ), this.destinationPath( 'rest/build.gradle' ), {} );
+            this.fs.copyTpl( this.templatePath( 'buildtool/gradle-root.tmpl' ), this.destinationPath( 'build.gradle' ), {} );
+            this.fs.copyTpl( this.templatePath( 'buildtool/settings.tmpl' ), this.destinationPath( 'settings.gradle' ), {projectName: zest.name} );
+            this.fs.copyTpl( this.templatePath( 'buildtool/gradlew.tmpl' ), this.destinationPath( 'gradlew' ), {} );
+            this.fs.copyTpl( this.templatePath( 'buildtool/gradlew-bat.tmpl' ), this.destinationPath( 'gradlew.bat' ), {} );
+            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.jar_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.jar' ) );
+            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.properties_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.properties' ) );
+        }
+    }
+);
+
+function copyZestBootstrap( ctx, layer, moduleName, condition )
+{
+    if( condition )
+    {
+        copyTemplate( ctx,
+                      moduleName + '/bootstrap.tmpl',
+                      'bootstrap/src/main/java/' + zest.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java' );
+    }
+}
+
+function copyZestApp( ctx, name, condition )
+{
+    if( condition )
+    {
+        copyTemplate( ctx,
+                      name + '/bootstrap.tmpl',
+                      'bootstrap/src/main/java/' + zest.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java' );
+
+        copyTemplate( ctx,
+                      name + '/app.tmpl',
+                      'app/src/main/java/' + zest.javaPackageDir + '/app/' + name + '.java' );
+
+        copyTemplate( ctx,
+                      name + '/webapp/',
+                      'app/src/main/webapp/' );
+    }
+}
+
+function copyZestDomain( ctx, model, module, clazz, condition )
+{
+    if( condition )
+    {
+        copyTemplate( ctx,
+                      module + '/' + clazz + '.tmpl',
+                      'model/src/main/java/' + zest.javaPackageDir + '/model/' + model + '/' + clazz + '.java' );
+    }
+}
+
+function copyRestFeature( ctx, condition )
+{
+    if( condition )
+    {
+        copyZestBootstrap( ctx, "domain", "SecurityModule", true );
+
+        copyTemplate( ctx,
+                      'RestApiModule/SimpleEnroler.tmpl',
+                      'rest/src/main/java/' + zest.javaPackageDir + '/rest/security/SimpleEnroler.java' );
+
+        copyTemplate( ctx,
+                      'RestApiModule/SimpleVerifier.tmpl',
+                      'rest/src/main/java/' + zest.javaPackageDir + '/rest/security/SimpleVerifier.java' );
+
+        copyTemplate( ctx,
+                      'RestApiModule/HardcodedSecurityRepositoryMixin.tmpl',
+                      'model/src/main/java/' + zest.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java' );
+    }
+}
+
+function copyHeroesSampleApp( ctx )
+{
+    copyZestDomain( ctx, "heroes", "Heroes", "Hero", hasFeature( 'sample (heroes) web application' ) );
+    copyZestApp( ctx, "Heroes", hasFeature( 'sample (heroes) web application' ) );
+    copyTemplate( ctx,
+                  'Heroes/web.tmpl',
+                  'app/src/main/webapp/WEB-INF/web.xml' );
+}
+
+function copyTemplate( ctx, from, to )
+{
+    ctx.fs.copyTpl(
+        ctx.templatePath( from ),
+        ctx.destinationPath( to ),
+        {
+            packageName: zest.packagename,
+            hasFeature: hasFeature,
+            hasEntityStore: hasEntityStore,
+            hasIndexing: hasIndexing,
+            hasCaching: hasCaching,
+            zest: zest
+        }
+    );
+}
+
+function hasEntityStore( esType )
+{
+    return zest.entitystore === esType;
+}
+
+function hasIndexing( indexingType )
+{
+    return zest.indexing === indexingType;
+}
+
+function hasCaching( cachingType )
+{
+    return zest.caching === cachingType;
+}
+
+function hasSerialization( serializer )
+{
+    return zest.serialization === serializer;
+}
+
+function hasFeature( feature )
+{
+    return zest.features.indexOf( feature ) >= 0;
+}
+
+function firstUpper( text )
+{
+    return text.charAt( 0 ).toUpperCase() + text.substring( 1 );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl b/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl
new file mode 100644
index 0000000..cbad162
--- /dev/null
+++ b/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl
@@ -0,0 +1,43 @@
+<%#
+ *  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.config;
+
+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 org.apache.zest.entitystore.memory.MemoryEntityStoreService;
+import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;
+import org.apache.zest.valueserialization.jackson.JacksonValueSerializationAssembler;
+
+public class ConfigModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );
+        new JacksonValueSerializationAssembler().visibleIn( Visibility.layer ).assemble( module );
+        module.services( UuidIdentityGeneratorService.class ).visibleIn( Visibility.layer );
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl
new file mode 100644
index 0000000..fd6cad0
--- /dev/null
+++ b/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  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.config;
+
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.LayerAssembly;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.layered.LayerAssembler;
+import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConfigurationLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static String NAME;
+    private ModuleAssembly configModule;
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        configModule = createModule( layer, ConfigModule.class );
+        return layer;
+    }
+
+    public ModuleAssembly configModule()
+    {
+        return configModule;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.tmpl
new file mode 100644
index 0000000..88bfeea
--- /dev/null
+++ b/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.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.
+ *
+ *
+-%>
+package <%= packageName %>.bootstrap.connectivity;
+
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.LayerAssembly;
+import org.apache.zest.bootstrap.layered.LayerAssembler;
+import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConnectivityLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static String NAME;
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+<% if( hasFeature('rest api') ) { %>
+        createModule( layer, RestApiModule.class );
+<% } -%>
+        return layer;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/CrudModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/CrudModule/bootstrap.tmpl b/tools/generator-zest/app/templates/CrudModule/bootstrap.tmpl
new file mode 100644
index 0000000..4db1a06
--- /dev/null
+++ b/tools/generator-zest/app/templates/CrudModule/bootstrap.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.
+ *
+ *
+-%>
+package <%= packageName %>.bootstrap.domain;
+
+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.CrudServiceAssembler;
+
+public class CrudModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.withDefaultUnitOfWorkFactory();
+        new CrudServiceAssembler().assemble( module );
+        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/DomainLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/DomainLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/DomainLayer/bootstrap.tmpl
new file mode 100644
index 0000000..1d8afe2
--- /dev/null
+++ b/tools/generator-zest/app/templates/DomainLayer/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  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 java.util.function.Function;
+import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.structure.Module;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.LayerAssembly;
+import org.apache.zest.bootstrap.layered.LayerAssembler;
+import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;
+
+public class DomainLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    @Override
+    public LayerAssembly assemble(LayerAssembly layer)
+        throws AssemblyException
+    {
+        createModule( layer, CrudModule.class );
+        createModule( layer, SecurityModule.class );
+        return layer;
+    }
+
+    public static Function<Application, Module> typeFinder()
+    {
+        return application -> application.findModule( "Domain Layer", "Assets Module" );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.tmpl b/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.tmpl
new file mode 100644
index 0000000..4bb1d37
--- /dev/null
+++ b/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.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.
+ *
+ *
+-%>
+package <%= packageName %>.bootstrap.infrastructure;
+
+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 org.apache.zest.library.fileconfig.FileConfigurationAssembler;
+
+public class FileConfigurationModule
+    implements ModuleAssembler
+{
+    public static String NAME;
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        new FileConfigurationAssembler().visibleIn( Visibility.layer ).assemble( module );
+        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/FileStorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/FileStorageModule/bootstrap.tmpl b/tools/generator-zest/app/templates/FileStorageModule/bootstrap.tmpl
new file mode 100644
index 0000000..0f71243
--- /dev/null
+++ b/tools/generator-zest/app/templates/FileStorageModule/bootstrap.tmpl
@@ -0,0 +1,53 @@
+<%#
+ *  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.infrastructure;
+
+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 org.apache.zest.entitystore.file.assembly.FileEntityStoreAssembler;
+
+public class FileStorageModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "File Storage Module";
+    private final ModuleAssembly configModule;
+
+    public FileStorageModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.withDefaultUnitOfWorkFactory();
+
+        new FileEntityStoreAssembler()
+            .visibleIn( Visibility.application  )
+            .withConfig( configModule, Visibility.application )
+            .identifiedBy( "filestore" )
+            .assemble( module );
+        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/Heroes/Hero.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/Hero.tmpl b/tools/generator-zest/app/templates/Heroes/Hero.tmpl
new file mode 100644
index 0000000..f0b3f2e
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/Hero.tmpl
@@ -0,0 +1,28 @@
+<%#
+ *  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.heroes;
+
+import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.property.Property;
+
+public interface Hero extends Identity
+{
+    Property<String> name();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/app.tmpl b/tools/generator-zest/app/templates/Heroes/app.tmpl
new file mode 100644
index 0000000..f3771bc
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/app.tmpl
@@ -0,0 +1,103 @@
+<%#
+ *  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 %>.app;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import org.apache.zest.api.structure.Application;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler;
+import org.apache.zest.library.restlet.ZrestApplication;
+import org.restlet.Context;
+import org.restlet.routing.Filter;
+import org.restlet.routing.Router;
+import org.restlet.security.Enroler;
+import org.restlet.security.Verifier;
+
+import <%= packageName %>.bootstrap.HeroesApplicationAssembler;
+import <%= packageName %>.bootstrap.connectivity.ConnectivityLayer;
+import <%= packageName %>.bootstrap.connectivity.RestApiModule;
+import <%= packageName %>.model.heroes.Hero;
+import <%= packageName %>.rest.security.SimpleEnroler;
+import <%= packageName %>.rest.security.SimpleVerifier;
+
+public class Heroes extends ZrestApplication
+{
+
+    public Heroes( Context context )
+        throws AssemblyException
+    {
+        super( context );
+    }
+
+    @Override
+    protected void addRoutes( Router router )
+    {
+        addResourcePath( "heroes", Hero.class, "/" );
+    }
+
+    @Override
+    protected LayeredApplicationAssembler createApplicationAssembler( String mode )
+        throws AssemblyException
+    {
+        if( mode != null )
+        {
+            return new HeroesApplicationAssembler( Application.Mode.valueOf( mode ) );
+        }
+        return new HeroesApplicationAssembler( Application.Mode.production );
+    }
+
+    @Override
+    protected Verifier createVerifier()
+    {
+        return newObject( SimpleVerifier.class );
+    }
+
+    @Override
+    protected Enroler createEnroler()
+    {
+        return newObject( SimpleEnroler.class, this );
+    }
+
+    @Override
+    protected String getConnectivityLayer()
+    {
+        return ConnectivityLayer.NAME;
+    }
+
+    @Override
+    protected String getConnectivityModule()
+    {
+        return RestApiModule.NAME;
+    }
+
+    private <T> T newObject( Class<T> type, Object... uses )
+    {
+        try
+        {
+            T instamce = type.newInstance();
+            objectFactory.injectTo( instamce, uses );
+            return instamce;
+        }
+        catch( Exception e )
+        {
+            throw new UndeclaredThrowableException( e );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl b/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl
new file mode 100644
index 0000000..4baa1f2
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl
@@ -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 <%= packageName %>.bootstrap;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.function.Function;
+
+import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.structure.Module;
+
+import org.apache.zest.bootstrap.ApplicationAssembly;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.LayerAssembly;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler;
+
+import <%= packageName %>.bootstrap.connectivity.ConnectivityLayer;
+import <%= packageName %>.bootstrap.domain.DomainLayer;
+import <%= packageName %>.bootstrap.config.ConfigurationLayer;
+import <%= packageName %>.bootstrap.infrastructure.InfrastructureLayer;
+
+public class HeroesApplicationAssembler extends LayeredApplicationAssembler
+{
+    private static final String NAME = "Heroes";
+    private static final String VERSION = "1.0.alpha";
+
+    public HeroesApplicationAssembler( Application.Mode mode )
+    throws AssemblyException
+    {
+        super( NAME, VERSION, mode );
+    }
+
+    @Override
+    protected void assembleLayers( ApplicationAssembly assembly )
+        throws AssemblyException
+    {
+        LayerAssembly configLayer = createLayer( ConfigurationLayer.class );
+        ModuleAssembly configModule = assemblerOf( ConfigurationLayer.class ).configModule();
+        LayerAssembly domainLayer = createLayer( DomainLayer.class );
+        Function<Application, Module> typeFinder = DomainLayer.typeFinder();
+        LayerAssembly infraLayer = new InfrastructureLayer( configModule, typeFinder ).assemble( assembly.layer( InfrastructureLayer.NAME ) );
+        LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );
+        connectivityLayer.uses( domainLayer );
+        domainLayer.uses( infraLayer );
+        infraLayer.uses( configLayer );
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/web.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/web.tmpl b/tools/generator-zest/app/templates/Heroes/web.tmpl
new file mode 100644
index 0000000..eb26db5
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/web.tmpl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<%#
+  ~  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.
+  ~
+  ~
+%>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+  <display-name><%= zest.name %></display-name>
+
+
+  <servlet>
+    <servlet-name>Restlet</servlet-name>
+    <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
+    <init-param>
+      <param-name>org.apache.zest.runtime.mode</param-name>
+      <param-value>development</param-value>
+    </init-param>
+    <init-param>
+      <!-- Application class name -->
+      <param-name>org.restlet.application</param-name>
+      <param-value><%= packageName %>.app.Heroes</param-value>
+    </init-param>
+    <init-param>
+      <!-- Protocols to be bound to-->
+      <param-name>org.restlet.clients</param-name>
+      <param-value>HTTP HTTPS</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>Restlet</servlet-name>
+    <url-pattern>/api/1/*</url-pattern>
+  </servlet-mapping>
+
+</web-app>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css
new file mode 100755
index 0000000..cb651f5
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css
@@ -0,0 +1,34 @@
+nav a {
+  padding: 5px 10px;
+  text-decoration: none;
+  margin-top: 10px;
+  display: inline-block;
+  background-color: #eee;
+  border-radius: 4px;
+}
+nav a:visited, a:link {
+  color: #607D8B;
+}
+nav a:hover {
+  color: #039be5;
+  background-color: #CFD8DC;
+}
+nav a.router-link-active {
+  color: #039be5;
+}
+h1 {
+  font-size: 1.2em;
+  color: #999;
+  margin-bottom: 0;
+}
+h2 {
+  font-size: 2em;
+  margin-top: 0;
+  padding-top: 0;
+}
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts
new file mode 100755
index 0000000..222874b
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts
@@ -0,0 +1,37 @@
+import {Component} from 'angular2/core';
+import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
+import {HeroesComponent} from './heroes.component';
+import {HeroDetailComponent} from './hero-detail.component';
+import {DashboardComponent} from './dashboard.component';
+import {HeroService} from './hero.service';
+
+@Component({
+  selector: 'my-app',
+  template: `
+    <h1>{{title}}</h1>
+    <nav>
+      <a [routerLink]="['Dashboard']">Dashboard</a>
+      <a [routerLink]="['Heroes']">Heroes</a>
+    </nav>
+    <router-outlet></router-outlet>
+  `,
+  styleUrls: ['app/app.component.css'],
+  directives: [ROUTER_DIRECTIVES],
+  providers: [HeroService]
+})
+@RouteConfig([
+  // {path: '/', redirectTo: ['Dashboard'] },
+  {path: '/dashboard', name: 'Dashboard', component: DashboardComponent, useAsDefault: true},
+  {path: '/heroes', name: 'Heroes', component: HeroesComponent},
+  {path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent}
+])
+export class AppComponent {
+  title = 'Tour of Heroes';
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css
new file mode 100755
index 0000000..b9d3215
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css
@@ -0,0 +1,67 @@
+[class*='col-'] {
+  float: left;
+}
+*, *:after, *:before {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+h3 {
+  text-align: center; margin-bottom: 0;
+}
+[class*='col-'] {
+  padding-right: 20px;
+  padding-bottom: 20px;
+}
+[class*='col-']:last-of-type {
+  padding-right: 0;
+}
+.grid {
+  margin: 0;
+}
+.col-1-4 {
+  width: 25%;
+}
+.module {
+	padding: 20px;
+	text-align: center;
+	color: #eee;
+	max-height: 120px;
+	min-width: 120px;
+	background-color: #607D8B;
+	border-radius: 2px;
+}
+h4 {
+  position: relative;
+}
+.module:hover {
+  background-color: #EEE;
+  cursor: pointer;
+  color: #607d8b;
+}
+.grid-pad {
+  padding: 10px 0;
+}
+.grid-pad > [class*='col-']:last-of-type {
+  padding-right: 20px;
+}
+@media (max-width: 600px) {
+	.module {
+	  font-size: 10px;
+	  max-height: 75px; }
+}
+@media (max-width: 1024px) {
+	.grid {
+	  margin: 0;
+	}
+	.module {
+	  min-width: 60px;
+	}
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html
new file mode 100755
index 0000000..3fc7517
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html
@@ -0,0 +1,15 @@
+<h3>Top Heroes</h3>
+<div class="grid grid-pad">
+  <div *ngFor="#hero of heroes" class="col-1-4" (click)="gotoDetail(hero)">
+    <div class="module hero">
+      <h4>{{hero.name}}</h4>
+    </div>
+  </div>
+</div>
+
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts
new file mode 100755
index 0000000..c8160d1
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts
@@ -0,0 +1,31 @@
+import {Component, OnInit} from 'angular2/core';
+import {Router} from 'angular2/router';
+import {Hero} from './hero';
+import {HeroService} from './hero.service';
+
+@Component({
+  selector: 'my-dashboard',
+  templateUrl: 'app/dashboard.component.html',
+  styleUrls: ['app/dashboard.component.css']
+})
+export class DashboardComponent implements OnInit {
+  heroes: Hero[] = [];
+
+  constructor(private _heroService: HeroService, private _router: Router) { }
+
+  ngOnInit() {
+    this._heroService.getHeroes().then(heroes => this.heroes = heroes.slice(1,5));
+  }
+
+  gotoDetail(hero: Hero) {
+    let link = ['HeroDetail', { id: hero.id }];
+    this._router.navigate(link);
+  }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css
new file mode 100755
index 0000000..2a0e285
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css
@@ -0,0 +1,36 @@
+label {
+  display: inline-block;
+  width: 3em;
+  margin: .5em 0;
+  color: #607D8B;
+  font-weight: bold;
+}
+input {
+  height: 2em;
+  font-size: 1em;
+  padding-left: .4em;
+}
+button {
+  margin-top: 20px;
+  font-family: Arial;
+  background-color: #eee;
+  border: none;
+  padding: 5px 10px;
+  border-radius: 4px;
+  cursor: pointer; cursor: hand;
+}
+button:hover {
+  background-color: #cfd8dc;
+}
+button:disabled {
+  background-color: #eee;
+  color: #ccc; 
+  cursor: auto;
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html
new file mode 100755
index 0000000..1e85e75
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html
@@ -0,0 +1,16 @@
+<div *ngIf="hero">
+	<h2>{{hero.name}} details!</h2>
+	<div>
+		<label>id: </label>{{hero.id}}</div>
+	<div>
+		<label>name: </label>
+		<input [(ngModel)]="hero.name" placeholder="name"/>
+	</div>
+	<button (click)="goBack()">Back</button>
+</div>
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts
new file mode 100755
index 0000000..0181847
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts
@@ -0,0 +1,34 @@
+import {Component, OnInit} from 'angular2/core';
+import {RouteParams} from 'angular2/router';
+
+import {Hero} from './hero';
+import {HeroService} from './hero.service';
+
+@Component({
+  selector: 'my-hero-detail',
+  templateUrl: 'app/hero-detail.component.html',
+  styleUrls: ['app/hero-detail.component.css']
+})
+export class HeroDetailComponent implements OnInit {
+  hero: Hero;
+
+  constructor(private _heroService: HeroService,
+    private _routeParams: RouteParams) {
+  }
+
+  ngOnInit() {
+    let id = +this._routeParams.get('id');
+    this._heroService.getHero(id).then(hero => this.hero = hero);
+  }
+
+  goBack() {
+    window.history.back();
+  }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts
new file mode 100755
index 0000000..aee78a1
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts
@@ -0,0 +1,22 @@
+import {Injectable} from 'angular2/core';
+import {HEROES}     from './mock-heroes';
+
+@Injectable()
+export class HeroService {
+  getHeroes() {
+    return Promise.resolve(HEROES);
+  }
+
+	getHero(id: number) {
+    return Promise.resolve(HEROES).then(
+      heroes => heroes.filter(hero => hero.id === id)[0]
+    );
+  }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts
new file mode 100755
index 0000000..812726c
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts
@@ -0,0 +1,11 @@
+export class Hero {
+	id: number;
+	name: string;
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css
new file mode 100755
index 0000000..98e7ecc
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css
@@ -0,0 +1,66 @@
+.selected {
+  background-color: #CFD8DC !important;
+  color: white;
+}
+.heroes {
+  margin: 0 0 2em 0;
+  list-style-type: none;
+  padding: 0;
+  width: 15em;
+}
+.heroes li {
+  cursor: pointer;
+  position: relative;
+  left: 0;
+  background-color: #EEE;
+  margin: .5em;
+  padding: .3em 0;
+  height: 1.6em;
+  border-radius: 4px;
+}
+.heroes li:hover {
+  color: #607D8B;
+  background-color: #DDD;
+  left: .1em;
+}
+.heroes li.selected:hover {
+  background-color: #BBD8DC !important;
+  color: white;
+}
+.heroes .text {
+  position: relative;
+  top: -3px;
+}
+.heroes .badge {
+  display: inline-block;
+  font-size: small;
+  color: white;
+  padding: 0.8em 0.7em 0 0.7em;
+  background-color: #607D8B;
+  line-height: 1em;
+  position: relative;
+  left: -1px;
+  top: -4px;
+  height: 1.8em;
+  margin-right: .8em;
+  border-radius: 4px 0 0 4px;
+}
+button {
+  font-family: Arial;
+  background-color: #eee;
+  border: none;
+  padding: 5px 10px;
+  border-radius: 4px;
+  cursor: pointer;
+  cursor: hand;
+}
+button:hover {
+  background-color: #cfd8dc;
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html
new file mode 100755
index 0000000..0688e6a
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html
@@ -0,0 +1,21 @@
+<div>
+  <h2>My Heroes</h2>
+  <ul class="heroes">
+    <li *ngFor="#hero of heroes"
+      [class.selected]="hero === selectedHero"
+      (click)="onSelect(hero)">
+      <span class="badge">{{hero.id}}</span> {{hero.name}}
+    </li>
+  </ul>
+  <div *ngIf="selectedHero">
+    <h2>{{selectedHero.name | uppercase}} is my hero</h2>
+    <button (click)="gotoDetail()">View Details</button>
+  </div>
+</div>
+
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts
new file mode 100755
index 0000000..0002025
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts
@@ -0,0 +1,39 @@
+import {Component, OnInit} from 'angular2/core';
+import {Router} from 'angular2/router';
+import {HeroService} from './hero.service';
+import {HeroDetailComponent} from './hero-detail.component';
+import {Hero} from './hero';
+
+@Component({
+  selector: 'my-heroes',
+  templateUrl: 'app/heroes.component.html',
+  styleUrls: ['app/heroes.component.css'],
+  directives: [HeroDetailComponent]
+})
+export class HeroesComponent implements OnInit {
+  heroes: Hero[];
+  selectedHero: Hero;
+
+  constructor(private _heroService: HeroService, private _router: Router) { }
+
+  getHeroes() {
+    this._heroService.getHeroes().then(heroes => this.heroes = heroes);
+  }
+
+  gotoDetail() {
+    this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]);
+  }
+
+  ngOnInit() {
+    this.getHeroes();
+  }
+
+  onSelect(hero: Hero) { this.selectedHero = hero; }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts
new file mode 100755
index 0000000..95e2d0b
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts
@@ -0,0 +1,16 @@
+import {bootstrap} from 'angular2/platform/browser';
+import {ROUTER_PROVIDERS} from 'angular2/router';
+import {HeroService} from './hero.service';
+import {AppComponent} from './app.component';
+
+bootstrap(AppComponent, [
+  ROUTER_PROVIDERS,
+  HeroService
+]);
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts
new file mode 100755
index 0000000..673cf53
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts
@@ -0,0 +1,21 @@
+import { Hero } from './hero';
+
+export var HEROES: Hero[] = [
+	{"id": 11, "name": "Mr. Nice"},
+	{"id": 12, "name": "Narco"},
+	{"id": 13, "name": "Bombasto"},
+	{"id": 14, "name": "Celeritas"},
+	{"id": 15, "name": "Magneta"},
+	{"id": 16, "name": "RubberMan"},
+	{"id": 17, "name": "Dynama"},
+	{"id": 18, "name": "Dr IQ"},
+	{"id": 19, "name": "Magma"},
+	{"id": 20, "name": "Tornado"}
+];
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/index.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/index.html b/tools/generator-zest/app/templates/Heroes/webapp/index.html
new file mode 100755
index 0000000..753dd48
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/index.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script>document.write('<base href="' + document.location + '" />');</script>
+    <title>Angular 2 Tour of Heroes</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <link rel="stylesheet" href="styles.css">
+
+    <!-- IE required polyfills, in this exact order -->
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system-polyfills.js"></script>
+    <script src="https://npmcdn.com/angular2@2.0.0-beta.15/es6/dev/src/testing/shims_for_IE.js"></script>
+   
+    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system.js"></script>
+    <script src="https://npmcdn.com/typescript@1.8.10/lib/typescript.js"></script>
+    <script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script>
+    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script>
+    <script src="https://code.angularjs.org/2.0.0-beta.15/router.dev.js"></script>
+    <script>
+      System.config({
+        transpiler: 'typescript', 
+        typescriptOptions: { emitDecoratorMetadata: true }, 
+        packages: {'app': {defaultExtension: 'ts'}} 
+      });
+        System.import('app/main')
+              .then(null, console.error.bind(console));
+    </script>
+  </head>
+
+  <body>
+    <my-app>Loading...</my-app>
+  </body>
+</html>
+
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/Heroes/webapp/styles.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/styles.css b/tools/generator-zest/app/templates/Heroes/webapp/styles.css
new file mode 100755
index 0000000..1774fd6
--- /dev/null
+++ b/tools/generator-zest/app/templates/Heroes/webapp/styles.css
@@ -0,0 +1,149 @@
+/* Master Styles */
+h1 {
+  color: #369; 
+  font-family: Arial, Helvetica, sans-serif;   
+  font-size: 250%;
+}
+h2, h3 { 
+  color: #444;
+  font-family: Arial, Helvetica, sans-serif;   
+  font-weight: lighter;
+}
+body { 
+  margin: 2em; 
+}
+body, input[text], button { 
+  color: #888; 
+  font-family: Cambria, Georgia; 
+}
+a {
+  cursor: pointer;
+  cursor: hand;
+}
+button {
+  font-family: Arial;
+  background-color: #eee;
+  border: none;
+  padding: 5px 10px;
+  border-radius: 4px;
+  cursor: pointer;
+  cursor: hand;
+}
+button:hover {
+  background-color: #cfd8dc;
+}
+button:disabled {
+  background-color: #eee;
+  color: #aaa; 
+  cursor: auto;
+}
+
+/* Navigation link styles */
+nav a {
+  padding: 5px 10px;
+  text-decoration: none;
+  margin-top: 10px;
+  display: inline-block;
+  background-color: #eee;
+  border-radius: 4px;
+}
+nav a:visited, a:link {
+  color: #607D8B;
+}
+nav a:hover {
+  color: #039be5;
+  background-color: #CFD8DC;
+}
+nav a.router-link-active {
+  color: #039be5;
+}
+
+/* items class */
+.items {
+  margin: 0 0 2em 0;
+  list-style-type: none;
+  padding: 0;
+  width: 24em;
+}
+.items li {
+  cursor: pointer;
+  position: relative;
+  left: 0;
+  background-color: #EEE;
+  margin: .5em;
+  padding: .3em 0;
+  height: 1.6em;
+  border-radius: 4px;
+}
+.items li:hover {
+  color: #607D8B;
+  background-color: #DDD;
+  left: .1em;
+}
+.items li.selected:hover {
+  background-color: #BBD8DC;
+  color: white;
+}
+.items .text {
+  position: relative;
+  top: -3px;
+}
+.items {
+  margin: 0 0 2em 0;
+  list-style-type: none;
+  padding: 0;
+  width: 24em;
+}
+.items li {
+  cursor: pointer;
+  position: relative;
+  left: 0;
+  background-color: #EEE;
+  margin: .5em;
+  padding: .3em 0;
+  height: 1.6em;
+  border-radius: 4px;
+}
+.items li:hover {
+  color: #607D8B;
+  background-color: #DDD;
+  left: .1em;
+}
+.items li.selected {
+  background-color: #CFD8DC;
+  color: white;
+}
+
+.items li.selected:hover {
+  background-color: #BBD8DC;
+}
+.items .text {
+  position: relative;
+  top: -3px;
+}
+.items .badge {
+  display: inline-block;
+  font-size: small;
+  color: white;
+  padding: 0.8em 0.7em 0 0.7em;
+  background-color: #607D8B;
+  line-height: 1em;
+  position: relative;
+  left: -1px;
+  top: -4px;
+  height: 1.8em;
+  margin-right: .8em;
+  border-radius: 4px 0 0 4px;
+}
+
+/* everywhere else */
+* { 
+  font-family: Arial, Helvetica, sans-serif; 
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
new file mode 100644
index 0000000..61d4def
--- /dev/null
+++ b/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
@@ -0,0 +1,55 @@
+<%#
+ *  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.infrastructure;
+
+import java.util.function.Function;
+import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.structure.Module;
+import org.apache.zest.bootstrap.AssemblyException;
+import org.apache.zest.bootstrap.LayerAssembly;
+import org.apache.zest.bootstrap.ModuleAssembly;
+import org.apache.zest.bootstrap.layered.LayerAssembler;
+import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;
+
+public class InfrastructureLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static final String NAME = "Infrastructure Layer";
+    private final ModuleAssembly configModule;
+    private final Function<Application, Module> typeFinder;
+
+    public InfrastructureLayer( ModuleAssembly configModule, Function<Application, Module> typeFinder )
+    {
+        this.configModule = configModule;
+        this.typeFinder = typeFinder;
+    }
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        createModule( layer, FileConfigurationModule.class );
+
+        new <%= zest.entitystore %>StorageModule( configModule ).assemble( layer, layer.module( <%= zest.entitystore %>StorageModule.NAME ) );
+        new <%= zest.indexing %>IndexingModule( configModule ).assemble( layer, layer.module( <%= zest.indexing %>IndexingModule.NAME ) );
+        new <%= zest.serialization %>SerializationModule( typeFinder ).assemble( layer, layer.module( <%= zest.serialization %>SerializationModule.NAME ) );
+        return layer;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl b/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl
new file mode 100644
index 0000000..1210cde
--- /dev/null
+++ b/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl
@@ -0,0 +1,55 @@
+<%#
+ *  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.infrastructure;
+
+import java.util.function.Function;
+import org.apache.zest.api.common.Visibility;
+import org.apache.zest.api.structure.Application;
+import org.apache.zest.api.structure.Module;
+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.spi.uuid.UuidIdentityGeneratorService;
+import org.apache.zest.valueserialization.jackson.JacksonValueSerializationAssembler;
+
+public class JacksonSerializationModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Jackson Serialization Module";
+    private final Function<Application, Module> typeFinder;
+
+    public JacksonSerializationModule( Function<Application, Module> typeFinder )
+    {
+        this.typeFinder = typeFinder;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        new JacksonValueSerializationAssembler()
+            .visibleIn( Visibility.application )
+            .withValuesModuleFinder( typeFinder )
+            .assemble( module );
+        module.services( UuidIdentityGeneratorService.class ).visibleIn( Visibility.layer );
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl b/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl
new file mode 100644
index 0000000..895af43
--- /dev/null
+++ b/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  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.infrastructure;
+
+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 org.apache.zest.entitystore.file.assembly.FileEntityStoreAssembler;
+
+public class NoCachingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "No Caching Module";
+    private final ModuleAssembly configModule;
+
+    public NoCachingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        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/RdfIndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RdfIndexingModule/bootstrap.tmpl b/tools/generator-zest/app/templates/RdfIndexingModule/bootstrap.tmpl
new file mode 100644
index 0000000..dd37698
--- /dev/null
+++ b/tools/generator-zest/app/templates/RdfIndexingModule/bootstrap.tmpl
@@ -0,0 +1,52 @@
+<%#
+ *  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.infrastructure;
+
+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 org.apache.zest.index.rdf.assembly.RdfNativeSesameStoreAssembler;
+import org.apache.zest.library.rdf.repository.NativeConfiguration;
+
+public class RdfIndexingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Rdf Indexing Module";
+    private final ModuleAssembly configModule;
+
+    public RdfIndexingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.withDefaultUnitOfWorkFactory();
+
+        configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
+        new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module );
+        return module;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
new file mode 100644
index 0000000..ffa13a9
--- /dev/null
+++ b/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
@@ -0,0 +1,54 @@
+<%#
+ *  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/RestApiModule/SecurityRepository.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/SecurityRepository.tmpl b/tools/generator-zest/app/templates/RestApiModule/SecurityRepository.tmpl
new file mode 100644
index 0000000..be799ee
--- /dev/null
+++ b/tools/generator-zest/app/templates/RestApiModule/SecurityRepository.tmpl
@@ -0,0 +1,36 @@
+<%#
+ *  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/RestApiModule/SimpleEnroler.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/SimpleEnroler.tmpl b/tools/generator-zest/app/templates/RestApiModule/SimpleEnroler.tmpl
new file mode 100644
index 0000000..f3268ea
--- /dev/null
+++ b/tools/generator-zest/app/templates/RestApiModule/SimpleEnroler.tmpl
@@ -0,0 +1,52 @@
+<%#
+ *  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 %>.rest.security;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.zest.api.injection.scope.Service;
+import org.apache.zest.api.injection.scope.Uses;
+import org.restlet.Application;
+import org.restlet.data.ClientInfo;
+import org.restlet.security.Enroler;
+import org.restlet.security.Role;
+import <%= packageName %>.model.security.SecurityRepository;
+
+
+public class SimpleEnroler
+    implements Enroler
+{
+    @Service
+    private SecurityRepository repository;
+
+    @Uses
+    private Application application;
+
+    @Override
+    public void enrole( ClientInfo clientInfo )
+    {
+        org.restlet.security.User user = clientInfo.getUser();
+        String name = user.getName();
+        List<String> roleList = repository.findRoleNamesOfUser( name );
+        List<Role> restletRoles = new ArrayList<>();
+        roleList.stream().map( roleName -> Role.get( application, roleName ) );
+        clientInfo.setRoles( restletRoles );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/bc55a577/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl b/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl
new file mode 100644
index 0000000..dda1796
--- /dev/null
+++ b/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  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 %>.rest.security;
+
+import org.apache.zest.api.injection.scope.Service;
+import org.restlet.security.SecretVerifier;
+import org.restlet.security.Verifier;
+import <%= packageName %>.model.security.SecurityRepository;
+
+public class SimpleVerifier extends SecretVerifier
+    implements Verifier
+{
+    @Service
+    private SecurityRepository repository;
+
+    @Override
+    public int verify( String user, char[] secret )
+    {
+        if( user == null || secret == null )
+        {
+            return RESULT_UNKNOWN;
+        }
+        if( repository.verifyPassword( user, String.valueOf( secret ) ) )
+        {
+            return RESULT_VALID;
+        }
+        return RESULT_INVALID;
+    }
+}