polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [2/2] polygene-java git commit: Cleaned up the 'security' feature. Introduced a 'applicationtype' and starting to bind the 'Rest API' together. Slowly getting there.
Date Sun, 12 Mar 2017 12:08:05 GMT
Cleaned up the 'security' feature. Introduced a 'applicationtype' and starting to bind the 'Rest API' together. Slowly getting there.


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

Branch: refs/heads/develop
Commit: 01949a6d6625631f931def905510c0498d0e3bde
Parents: 70eeb7e
Author: niclas <niclas@spicter.com>
Authored: Sun Mar 12 20:07:56 2017 +0800
Committer: niclas <niclas@spicter.com>
Committed: Sun Mar 12 20:07:56 2017 +0800

----------------------------------------------------------------------
 .../restlet/PolygeneRestApplication.java        |  8 ---
 .../library/shiro/domain/permissions/Role.java  |  6 +-
 tools/generator-polygene/app/index.js           | 76 +++++++++-----------
 .../ConfigModule/bootstrap.tmpl                 |  2 +-
 .../templates/ConfigurationLayer/bootstrap.tmpl |  2 +-
 .../RestApiModule/DefaultEnroler.tmpl           |  6 +-
 .../RestApiModule/DefaultVerifier.tmpl          |  4 +-
 .../RestApiModule/NullEnroler.tmpl              |  2 +-
 .../RestApiModule/NullVerifier.tmpl             |  2 +-
 .../RestApiModule/bootstrap.tmpl                | 10 +--
 .../ConnectivityLayer/RestApiModule/module.js   |  2 +-
 .../RestApiModule/web.xml.tmpl                  | 46 ++++++++++++
 .../templates/ConnectivityLayer/bootstrap.tmpl  |  4 +-
 .../DomainLayer/CrudModule/bootstrap.tmpl       |  2 +-
 .../templates/DomainLayer/CrudModule/module.js  |  8 ++-
 .../DomainLayer/DomainModule/Configuration.tmpl |  2 +-
 .../DomainLayer/DomainModule/Crud.tmpl          |  2 +-
 .../DomainLayer/DomainModule/Entity.tmpl        |  2 +-
 .../DomainLayer/DomainModule/Object.tmpl        |  2 +-
 .../DomainLayer/DomainModule/Service.tmpl       |  2 +-
 .../DomainLayer/DomainModule/Transient.tmpl     |  2 +-
 .../DomainLayer/DomainModule/Value.tmpl         |  2 +-
 .../DomainLayer/DomainModule/bootstrap.tmpl     | 16 ++---
 .../SecurityModule/CryptoConfiguration.tmpl     |  7 +-
 .../SecurityModule/CryptoException.tmpl         |  2 +-
 .../SecurityModule/CryptoService.tmpl           | 33 +++++----
 .../EncryptedStringPropertyConcern.tmpl         |  2 +-
 ...ntityStoreBackedSecurityRepositoryMixin.tmpl | 60 ----------------
 .../DomainLayer/SecurityModule/Group.tmpl       | 23 ++----
 .../SecurityModule/RealmService.tmpl            | 27 +++++--
 .../SecurityModule/SecurityRepository.tmpl      | 24 ++++---
 .../DomainLayer/SecurityModule/User.tmpl        | 28 ++++----
 .../DomainLayer/SecurityModule/UserFactory.tmpl | 55 ++++++++++++++
 .../DomainLayer/SecurityModule/bootstrap.tmpl   | 32 ++++++---
 .../DomainLayer/SecurityModule/module.js        |  2 +-
 .../app/templates/DomainLayer/bootstrap.tmpl    |  4 +-
 .../CachingModule/bootstrap.tmpl                |  2 +-
 .../FileConfigurationModule/bootstrap.tmpl      |  2 +-
 .../IndexingModule/bootstrap.tmpl               |  2 +-
 .../MetricsModule/bootstrap.tmpl                |  2 +-
 .../SerializationModule/bootstrap.tmpl          |  2 +-
 .../StorageModule/bootstrap.tmpl                |  2 +-
 .../InfrastructureLayer/bootstrap.tmpl          |  2 +-
 .../templates/buildtool/gradle-bootstrap.tmpl   |  2 +-
 .../app/templates/buildtool/gradle-model.tmpl   | 12 +++-
 .../app/templates/buildtool/gradle-rest.tmpl    |  4 +-
 tools/generator-polygene/test/generator_test.js | 17 ++---
 47 files changed, 305 insertions(+), 253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
index 291cfba..4df326f 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneRestApplication.java
@@ -152,14 +152,6 @@ public abstract class PolygeneRestApplication extends org.restlet.Application
         {
             guard.setEnroler( enroler );
         }
-
-        // In the future, look into JAAS approach.
-//        Configuration jaasConfig = Configuration.getConfiguration();
-//        JaasVerifier verifier = new JaasVerifier( "BasicJaasAuthenticationApplication");
-//        verifier.setConfiguration( jaasConfig);
-//        verifier.setUserPrincipalClassName("com.sun.security.auth.UserPrincipal");
-//        guard.setVerifier(verifier);
-
         return createInterceptors( guard );
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/libraries/shiro-core/src/main/java/org/apache/polygene/library/shiro/domain/permissions/Role.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/main/java/org/apache/polygene/library/shiro/domain/permissions/Role.java b/libraries/shiro-core/src/main/java/org/apache/polygene/library/shiro/domain/permissions/Role.java
index d111795..85c7b02 100644
--- a/libraries/shiro-core/src/main/java/org/apache/polygene/library/shiro/domain/permissions/Role.java
+++ b/libraries/shiro-core/src/main/java/org/apache/polygene/library/shiro/domain/permissions/Role.java
@@ -32,7 +32,7 @@ import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
 
 @Mixins( Role.Mixin.class )
 public interface Role
-        extends EntityComposite
+    extends EntityComposite
 {
 
     Property<String> name();
@@ -42,8 +42,8 @@ public interface Role
 
     RoleAssignment assignTo( RoleAssignee assignee );
 
-    public abstract class Mixin
-            implements Role
+    abstract class Mixin
+        implements Role
     {
 
         @Structure

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
index 583edbf..b1a12c1 100644
--- a/tools/generator-polygene/app/index.js
+++ b/tools/generator-polygene/app/index.js
@@ -59,8 +59,8 @@ module.exports = generators.Base.extend(
                 polygene = importModel(this.options.import);
                 polygene.name = polygene.name ? polygene.name : firstUpper(this.appname);
                 polygene.packageName = polygene.packageName ? polygene.packageName : ("com.acme." + this.appname);
-                polygene.singletonApp = false;  // not supported yet
-                polygene.features = polygene.features ? polygene.features : ['rest api'];
+                polygene.applicationtype = "Rest API";
+                polygene.features = polygene.features ? polygene.features : [];
                 polygene.modules = polygene.modules ? polygene.modules : {};
                 polygene.indexing = polygene.indexing ? polygene.indexing : null;
                 polygene.entitystore = polygene.entitystore ? polygene.entitystore : null;
@@ -91,6 +91,16 @@ module.exports = generators.Base.extend(
                         },
                         {
                             type: 'list',
+                            name: 'applicationtype',
+                            choices: [
+                                'Command Line',
+                                'Rest API'
+                            ],
+                            message: 'what type of application do you want to create?',
+                            default: polygene.applicationtype ? polygene.applicationtype : "Rest API"
+                        },
+                        {
+                            type: 'list',
                             name: 'entitystore',
                             choices: [
                                 'Cassandra',
@@ -162,7 +172,6 @@ module.exports = generators.Base.extend(
                             type: 'checkbox',
                             name: 'features',
                             choices: [
-                                'rest api'
                                 , 'security'
                                 // ,'version migration'
                                 // ,'logging'
@@ -188,22 +197,22 @@ module.exports = generators.Base.extend(
                         this.log('Caching:', answers.caching);
                         this.log('Serialization:', answers.serialization);
                         this.log('Features:', answers.features);
-                        polygene.name = answers.name;
-                        polygene.entitystore = answers.entitystore;
-                        polygene.indexing = answers.indexing;
-                        polygene.caching = answers.caching;
-                        polygene.serialization = answers.serialization;
-                        polygene.metrics = answers.metrics;
-                        polygene.packageName = answers.packageName;
-                        polygene.features = answers.features;
-                        polygene.javaPackageDir = polygene.javaPackageDir ? polygene.javaPackageDir : polygene.packageName.replace(/[.]/g, '/');
-                        polygene.singletonApp = false;
+                        polygene = answers;
+                        // polygene.name = answers.name;
+                        // polygene.entitystore = answers.entitystore;
+                        // polygene.indexing = answers.indexing;
+                        // polygene.caching = answers.caching;
+                        // polygene.serialization = answers.serialization;
+                        // polygene.metrics = answers.metrics;
+                        // polygene.packageName = answers.packageName;
+                        // polygene.features = answers.features;
                     }.bind(this)
                 );
             }
         },
 
         writing: function () {
+            polygene.javaPackageDir = polygene.packageName.replace(/[.]/g, '/');
             polygene.ctx = this;
             fs.readdir(__dirname + "/templates", function (err, files) {
                 files.forEach(function (directory) {
@@ -222,23 +231,6 @@ module.exports = generators.Base.extend(
     }
 );
 
-
-function hasEntityStore(esType) {
-    return polygene.entitystore === esType;
-}
-
-function hasIndexing(indexingType) {
-    return polygene.indexing === indexingType;
-}
-
-function hasCaching(cachingType) {
-    return polygene.caching === cachingType;
-}
-
-function hasSerialization(serializer) {
-    return polygene.serialization === serializer;
-}
-
 function hasFeature(feature) {
     return polygene.features.indexOf(feature) >= 0;
 }
@@ -248,14 +240,14 @@ function firstUpper(text) {
 }
 
 function importModel(filename) {
-    if ( typeof filename !== 'string' ) {
+    if (typeof filename !== 'string') {
         filename = "./model.json";
     }
     return JSON.parse(fs.readFileSync(filename, 'utf8'));
 }
 
 function exportModel(filename) {
-    if ( typeof filename !== 'string' ) {
+    if (typeof filename !== 'string') {
         filename = "exported-model.json";
     }
     delete polygene.current;
@@ -273,11 +265,7 @@ function assignFunctions(polygene) {
             ctx.templatePath(from),
             ctx.destinationPath(to),
             {
-                packageName: polygene.packageName,
                 hasFeature: hasFeature,
-                hasEntityStore: hasEntityStore,
-                hasIndexing: hasIndexing,
-                hasCaching: hasCaching,
                 firstUpper: firstUpper,
                 polygene: polygene
             }
@@ -380,32 +368,32 @@ function assignFunctions(polygene) {
                 state.push('Property' + '<' + polygene.typeNameOnly(prop.type) + "> " + prop.name + "();")
                 imported[prop.type] = imported[prop.type];
                 var yamlDefault;
-                if( prop.type === "java.lang.String" ) {
+                if (prop.type === "java.lang.String") {
                     yamlDefault = '""';
                 }
-                else if( prop.type === "java.lang.Boolean" ) {
+                else if (prop.type === "java.lang.Boolean") {
                     yamlDefault = 'false';
                 }
-                else if( prop.type === "java.lang.Long" ) {
+                else if (prop.type === "java.lang.Long") {
                     yamlDefault = '0';
                 }
-                else if( prop.type === "java.lang.Integer" ) {
+                else if (prop.type === "java.lang.Integer") {
                     yamlDefault = '0';
                 }
-                else if( prop.type === "java.lang.Double" ) {
+                else if (prop.type === "java.lang.Double") {
                     yamlDefault = '0.0';
                 }
-                else if( prop.type === "java.lang.Float" ) {
+                else if (prop.type === "java.lang.Float") {
                     yamlDefault = '0.0';
                 }
                 else {
                     yamlDefault = '\n    # TODO: complex configuration type. ';
                 }
-                yaml.push( prop.name + " : " + yamlDefault);
+                yaml.push(prop.name + " : " + yamlDefault);
             }
         } else {
             state.push('Property<String> name();    // TODO: remove sample property')
-            yaml.push( 'name : "sample config value"' );
+            yaml.push('name : "sample config value"');
         }
         current.state = state;
         current.yaml = yaml;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
index 0c925da..37eecfa 100644
--- a/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.config;
+package <%= polygene.packageName %>.bootstrap.config;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
index bb81a83..d83ae32 100644
--- a/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.config;
+package <%= polygene.packageName %>.bootstrap.config;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultEnroler.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultEnroler.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultEnroler.tmpl
index c469137..31d4588 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultEnroler.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultEnroler.tmpl
@@ -16,8 +16,8 @@
  *  limitations under the License.
  *
  *
--%>
-package <%= packageName %>.rest.security;
+%>
+package <%= polygene.packageName %>.rest.security;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -27,7 +27,7 @@ import org.restlet.Application;
 import org.restlet.data.ClientInfo;
 import org.restlet.security.Enroler;
 import org.restlet.security.Role;
-import <%= packageName %>.model.security.SecurityRepository;
+import <%= polygene.packageName %>.model.security.SecurityRepository;
 
 
 public class DefaultEnroler

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultVerifier.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultVerifier.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultVerifier.tmpl
index 256b39d..e31e240 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultVerifier.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/DefaultVerifier.tmpl
@@ -17,12 +17,12 @@
  *
  *
 -%>
-package <%= packageName %>.rest.security;
+package <%= polygene.packageName %>.rest.security;
 
 import org.apache.polygene.api.injection.scope.Service;
 import org.restlet.security.SecretVerifier;
 import org.restlet.security.Verifier;
-import <%= packageName %>.model.security.SecurityRepository;
+import <%= polygene.packageName %>.model.security.SecurityRepository;
 
 public class DefaultVerifier extends SecretVerifier
     implements Verifier

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
index 8076289..c24ddce 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullEnroler.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.rest.security;
+package <%= polygene.packageName %>.rest.security;
 
 import org.restlet.data.ClientInfo;
 import org.restlet.security.Enroler;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
index e7af254..5d6b349 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/NullVerifier.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.rest.security;
+package <%= polygene.packageName %>.rest.security;
 
 import org.restlet.security.SecretVerifier;
 import org.restlet.security.Verifier;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
index d2ad313..0594546 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/bootstrap.tmpl
@@ -17,14 +17,14 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.connectivity;
+package <%= polygene.packageName %>.bootstrap.connectivity;
 
 <% if( hasFeature('security') ) { %>
-import <%= packageName %>.rest.security.DefaultEnroler;
-import <%= packageName %>.rest.security.DefaultVerifier;
+import <%= polygene.packageName %>.rest.security.DefaultEnroler;
+import <%= polygene.packageName %>.rest.security.DefaultVerifier;
 <% } else { %>
-import <%= packageName %>.rest.security.NullEnroler;
-import <%= packageName %>.rest.security.NullVerifier;
+import <%= polygene.packageName %>.rest.security.NullEnroler;
+import <%= polygene.packageName %>.rest.security.NullVerifier;
 <% } %>
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
index 8524da3..4a2af7d 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/module.js
@@ -2,7 +2,7 @@
 module.exports = {
 
     write: function (p) {
-        if (p.hasFeature("rest api")) {
+        if (p.applicationtype === 'Rest API') {
             p.copyTemplate(p.ctx,
                 'ConnectivityLayer/RestApiModule/bootstrap.tmpl',
                 'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/connectivity/RestApiModule.java');

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/web.xml.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/web.xml.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/web.xml.tmpl
new file mode 100644
index 0000000..d650933
--- /dev/null
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/RestApiModule/web.xml.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.
+  ~
+  ~
+%><?xml version="1.0" encoding="UTF-8"?>
+<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><%= polygene.name %></display-name>
+<% if( polygene.hasFeature( "security" ) { %>
+    <listener>
+        <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
+    </listener>
+<% } %>
+<% if( polygene.hasFeature( "security" ) { %>
+    <filter>
+        <filter-name>ShiroFilter</filter-name>
+        <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
+    </filter>
+<% } %>
+<% if( polygene.hasFeature( "security" ) { %>
+    <-- Filter all web requests.  This filter mapping is typically declared
+        before all others to ensure any other filters are secured as well: -->
+    <filter-mapping>
+        <filter-name>ShiroFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+<% } %>
+
+</web-app>

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
index 941e77e..efe2d4d 100644
--- a/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.connectivity;
+package <%= polygene.packageName %>.bootstrap.connectivity;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
@@ -33,7 +33,7 @@ public class ConnectivityLayer extends LayeredLayerAssembler
     public LayerAssembly assemble( LayerAssembly layer )
         throws AssemblyException
     {
-<% if( hasFeature('rest api') ) { %>
+<% if( polygene.applicationtype === 'Rest API' ) { %>
         createModule( layer, RestApiModule.class );
 <% } -%>
         return layer;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/CrudModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/CrudModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/CrudModule/bootstrap.tmpl
index 0877723..2c50918 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/CrudModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/CrudModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.domain;
+package <%= polygene.packageName %>.bootstrap.domain;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/CrudModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/CrudModule/module.js b/tools/generator-polygene/app/templates/DomainLayer/CrudModule/module.js
index acc509a..6c930d9 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/CrudModule/module.js
+++ b/tools/generator-polygene/app/templates/DomainLayer/CrudModule/module.js
@@ -2,8 +2,10 @@
 module.exports = {
 
     write: function (p) {
-        p.copyTemplate(p.ctx,
-            'DomainLayer/CrudModule/bootstrap.tmpl',
-            'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/domain/CrudModule.java');
+        if( p.applicationtype === 'Rest API' ) {
+            p.copyTemplate(p.ctx,
+                'DomainLayer/CrudModule/bootstrap.tmpl',
+                'bootstrap/src/main/java/' + p.javaPackageDir + '/bootstrap/domain/CrudModule.java');
+        }
     }
 };

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
index 071ee7b..b5ab022 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Configuration.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.<%= polygene.current.name %>;
+package <%= polygene.packageName %>.model.<%= polygene.current.name %>;
 
 import org.apache.polygene.api.property.Property;
 <%

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
index df53506..2abd6b3 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Crud.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.<%= polygene.current.name %>;
+package <%= polygene.packageName %>.model.<%= polygene.current.name %>;
 
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
index df53506..2abd6b3 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Entity.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.<%= polygene.current.name %>;
+package <%= polygene.packageName %>.model.<%= polygene.current.name %>;
 
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Object.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Object.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Object.tmpl
index 9ff4e00..d51cdf5 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Object.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Object.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.<%= polygene.current.name %>;
+package <%= polygene.packageName %>.model.<%= polygene.current.name %>;
 
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.injection.scope.Uses;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
index 5710441..67c989b 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Service.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.<%= polygene.current.name %>;
+package <%= polygene.packageName %>.model.<%= polygene.current.name %>;
 
 import org.apache.polygene.api.configuration.Configuration;
 import org.apache.polygene.api.injection.scope.Structure;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
index 1fae121..ffb1660 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Transient.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.<%= polygene.current.name %>;
+package <%= polygene.packageName %>.model.<%= polygene.current.name %>;
 
 import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.api.mixin.Mixins;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
index 34a95b0..3d3baea 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/Value.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.<%= polygene.current.name %>;
+package <%= polygene.packageName %>.model.<%= polygene.current.name %>;
 
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
index 17b391a..092d683 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.domain;
+package <%= polygene.packageName %>.bootstrap.domain;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
@@ -25,32 +25,32 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.layered.ModuleAssembler;
 
 <% for( var idx in polygene.current.cruds) {
-%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.cruds[idx].name + ";" %>
+%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.cruds[idx].name + ";" %>
 <%
 }
 
 for( var idx in polygene.current.values) {
-%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.values[idx].name + ";" %>
+%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.values[idx].name + ";" %>
 <%
 }
 for( var idx in polygene.current.entities) {
-%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.entities[idx].name + ";" %>
+%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.entities[idx].name + ";" %>
 <%
 }
 
 for( var idx in polygene.current.transients) {
-%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.transients[idx].name + ";" %>
+%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.transients[idx].name + ";" %>
 <%
 }
 
 for( var idx in polygene.current.objects) {
-%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.objects[idx].name + ";" %>
+%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.objects[idx].name + ";" %>
 <%
 }
 
 for( var idx in polygene.current.services) {
-%><%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.current.services[idx].name + ";" %>
-<%= "import " + packageName + ".model." + polygene.current.name + "." + polygene.configurationClassName(polygene.current.services[idx].name) + ";" %>
+%><%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.current.services[idx].name + ";" %>
+<%= "import " + polygene.packageName + ".model." + polygene.current.name + "." + polygene.configurationClassName(polygene.current.services[idx].name) + ";" %>
 <%
 } %>
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoConfiguration.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoConfiguration.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoConfiguration.tmpl
index 89883a2..3262390 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoConfiguration.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoConfiguration.tmpl
@@ -17,18 +17,19 @@
  *
  *
 -%>
-package <%= packageName %>.model.security;
+package <%= polygene.packageName %>.model.security;
 
+import org.apache.polygene.api.configuration.ConfigurationComposite;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.common.Optional;
 
-public class CryptoConfiguration
+public interface CryptoConfiguration extends ConfigurationComposite
 {
     @Optional
     Property<String> digestAlgorithm();
 
     @Optional
-    Property<String> digestAlgorithm();
+    Property<String> encryptionAlgorithm();
 
     Property<String> secret1();
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoException.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoException.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoException.tmpl
index 00ec8f8..d6e8d38 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoException.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoException.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.security;
+package <%= polygene.packageName %>.model.security;
 
 public class CryptoException extends RuntimeException
 {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoService.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoService.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoService.tmpl
index 4bc72c2..588e70d 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoService.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/CryptoService.tmpl
@@ -17,13 +17,15 @@
  *
  *
 -%>
-package <%= packageName %>.model.security;
+package <%= polygene.packageName %>.model.security;
 
 import java.security.MessageDigest;
-import java.crypto.Cipher;
-import java.crypto.spec.IvParameterSpec;
-import java.crypto.spec.SecretKeySpec;
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
 
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.configuration.Configuration;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
 
@@ -34,31 +36,35 @@ public interface CryptoService
 
     String decrypt( String encrypted );
 
-    class CryptoMixin
+    class Mixin
         implements CryptoService
     {
-        private byte[] keyBytes;
-        private byte[] ivBytes;
+        private SecretKeySpec key;
+        private IvParameterSpec ivSpec;
         private Cipher cipher;
         private MessageDigest digest;
 
-        public CryptoMixin(Configuration<CryptoConfiguration> configuration)
+        public Mixin( @This Configuration<CryptoConfiguration> configuration)
             throws Exception
         {
-            CryptoConfiguration config = configuration.configuration().get();
+            CryptoConfiguration config = configuration.get();
             String digestAlgorithm = config.digestAlgorithm().get();
             if( digestAlgorithm == null )
+            {
                 digestAlgorithm = "SHA-1";
-            digest = MessageDigest.getInstance(  );
+            }
+            digest = MessageDigest.getInstance( digestAlgorithm );
             byte[] keyBytes = hashed( config.secret1().get() );
             byte[] ivBytes = hashed( config.secret2().get() );
 
-            SecretKeySpec key = new SecretKeySpec(keyBytes, "DES");
-            IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
+            key = new SecretKeySpec(keyBytes, "DES");
+            ivSpec = new IvParameterSpec(ivBytes);
 
             String encryptionAlgorithm = config.encryptionAlgorithm().get();
             if( encryptionAlgorithm == null )
+            {
                 encryptionAlgorithm = "AES";
+            }
             cipher = Cipher.getInstance( encryptionAlgorithm );
         }
 
@@ -88,7 +94,8 @@ public interface CryptoService
                 cipher.init(Cipher.DECRYPT_MODE, key, ivSpec);
 
                 byte[] encrypted = encryptedString.getBytes();
-                byte[] decrypted = new byte[cipher.getOutputSize(enc_len)];
+                int enc_len = encrypted.length;
+                byte[] decrypted = new byte[cipher.getOutputSize(encrypted.length)];
                 int dec_len = cipher.update(encrypted, 0, enc_len, decrypted, 0);
                 dec_len += cipher.doFinal(decrypted, dec_len);
                 return new String( decrypted, 0, dec_len );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EncryptedStringPropertyConcern.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EncryptedStringPropertyConcern.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EncryptedStringPropertyConcern.tmpl
index 4083a39..5db973c 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EncryptedStringPropertyConcern.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EncryptedStringPropertyConcern.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.model.security;
+package <%= polygene.packageName %>.model.security;
 
 import org.apache.polygene.api.concern.ConcernOf;
 import org.apache.polygene.api.property.Property;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EntityStoreBackedSecurityRepositoryMixin.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EntityStoreBackedSecurityRepositoryMixin.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EntityStoreBackedSecurityRepositoryMixin.tmpl
deleted file mode 100644
index 56c4a5c..0000000
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/EntityStoreBackedSecurityRepositoryMixin.tmpl
+++ /dev/null
@@ -1,60 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
--%>
-package <%= packageName %>.model.security;
-
-import java.util.Collections;
-import java.util.List;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-
-public class EntityStoreBackedSecurityRepositoryMixin
-    implements SecurityRepository
-{
-    @Structure
-    private UnitOfWorkFactory uowf;
-
-    @Override
-    @UnitOfWorkPropagation
-    public boolean verifyPassword( String userName, String password )
-    {
-        Identity identity = new StringIdentity("User-" + userName );
-        User user = uow.currentUnitOfWork(User.class, identity );
-
-        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/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/Group.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/Group.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/Group.tmpl
index 8e0aba8..ea212d2 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/Group.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/Group.tmpl
@@ -16,26 +16,11 @@
  *  limitations under the License.
  *
  *
--%>
-package <%= packageName %>.model.security;
+%>
+package <%= polygene.packageName %>.model.security;
 
-import org.apache.polygene.api.injection.scope.This;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
+import org.apache.polygene.library.shiro.domain.permissions.RoleAssignee;
 
-@Mixins( { Group.Mixin } )
-public interface Group
+public interface Group extends RoleAssignee
 {
-    interface State
-    {
-        Property<String> password();
-    }
-
-    class Mixin
-        implements Group
-    {
-        @This
-        private State state;        // Sample reference to hidden property
-
-    }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/RealmService.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/RealmService.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/RealmService.tmpl
index 875f35b..106975f 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/RealmService.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/RealmService.tmpl
@@ -17,15 +17,23 @@
  *
  *
 -%>
-package <%= packageName %>.model.security;
+package <%= polygene.packageName %>.model.security;
 
-@Mixins( MyRealmMixin.class )
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceActivation;
+
+import org.apache.shiro.authc.credential.DefaultPasswordService;
+import org.apache.shiro.authc.credential.PasswordMatcher;
+import org.apache.shiro.authc.credential.PasswordService;
+import org.apache.shiro.realm.Realm;
+import org.apache.shiro.realm.SimpleAccountRealm;
+
+@Mixins( RealmService.Mixin.class )
 public interface RealmService
-        extends Realm, ServiceComposite, ServiceActivation
+        extends Realm, ServiceActivation
 {
-    class Mixin
-        extends SimpleAccountRealm
-        implements ServiceActivation
+    class Mixin extends SimpleAccountRealm
+            implements ServiceActivation
     {
 
         private final PasswordService passwordService;
@@ -42,8 +50,13 @@ public interface RealmService
         public void activateService()
                 throws Exception
         {
-             // Create a test account
+            // Create a test account
             addAccount( "foo", passwordService.encryptPassword( "bar" ) );
         }
+
+        public void passivateService()
+                throws Exception
+        {
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/SecurityRepository.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/SecurityRepository.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/SecurityRepository.tmpl
index 5910c7c..06eb69c 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/SecurityRepository.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/SecurityRepository.tmpl
@@ -17,18 +17,24 @@
  *
  *
 -%>
-package <%= packageName %>.model.security;
+package <%= polygene.packageName %>.model.security;
 
+import java.util.Collections;
 import java.util.List;
 import org.apache.polygene.api.concern.Concerns;
 import org.apache.polygene.api.identity.Identity;
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
 import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
 import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.subject.Subject;
 
 @Concerns( UnitOfWorkConcern.class )
-@Mixins( { SecurityRepository.EntiyStoreBackedMixin.class } )
+@Mixins( { SecurityRepository.ShiroBackedSecurityRepositoryMixin.class } )
 public interface SecurityRepository
 {
     @UnitOfWorkPropagation
@@ -38,7 +44,7 @@ public interface SecurityRepository
     List<String> findRoleNamesOfUser( String name );
 
 
-    class EntityStoreBackedSecurityRepositoryMixin
+    class ShiroBackedSecurityRepositoryMixin
         implements SecurityRepository
     {
         @Structure
@@ -48,16 +54,18 @@ public interface SecurityRepository
         @UnitOfWorkPropagation
         public boolean verifyPassword( String userName, String password )
         {
-            Identity identity = new StringIdentity("User-" + userName );
-            User user = uow.currentUnitOfWork(User.class, identity );
-            return user.verify( password );
+            Subject currentUser = SecurityUtils.getSubject();
+            return currentUser.isAuthenticated();
         }
 
         @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/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/User.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/User.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/User.tmpl
index 32f2db1..08db130 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/User.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/User.tmpl
@@ -16,36 +16,36 @@
  *  limitations under the License.
  *
  *
--%>
-package <%= packageName %>.model.security;
+%>
+package <%= polygene.packageName %>.model.security;
 
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.concern.Concerns;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
+import org.apache.polygene.library.shiro.domain.passwords.PasswordSecurable;
+import org.apache.polygene.library.shiro.domain.permissions.RoleAssignee;
 
-@Mixins( { User.Mixin } )
-public interface User
+@Mixins( { User.GroupsMixin.class } )
+public interface User extends PasswordSecurable, RoleAssignee
 {
+    boolean isMemberOf( Group group );
 
     interface State
     {
-        @Concerns( EncryptedStringPropertyConcern.class )
-        Property<String> password();
-
         ManyAssociation<Group> memberOf();
     }
 
-    class Mixin
+    abstract class GroupsMixin
         implements User
     {
-        @Service
-        private HashingService hashing;
-
         @This
         private State state;
 
-
+        public boolean isMemberOf( Group group )
+        {
+            return state.memberOf().contains( group );
+        }
     }
-
-
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/UserFactory.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/UserFactory.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/UserFactory.tmpl
new file mode 100644
index 0000000..298950e
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/UserFactory.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 <%= polygene.packageName %>.model.security;
+
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+
+import org.apache.shiro.authc.credential.PasswordService;
+
+@Mixins( UserFactory.Mixin.class )
+public interface UserFactory
+{
+
+    User createNewUser( String username, String password );
+
+    class Mixin
+        implements UserFactory
+    {
+        @Structure
+        private UnitOfWorkFactory uowf;
+
+        @Service
+        private PasswordService passwordService;
+
+        @Override
+        public User createNewUser( String username, String password )
+        {
+            EntityBuilder<User> userBuilder = uowf.currentUnitOfWork().newEntityBuilder( User.class );
+            User user = userBuilder.instance();
+            user.subjectIdentifier().set( username );
+            user.password().set( passwordService.encryptPassword( password ) );
+            return userBuilder.newInstance();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/bootstrap.tmpl
index 7513044..e60c563 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/bootstrap.tmpl
@@ -17,17 +17,21 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.domain;
+package <%= polygene.packageName %>.bootstrap.domain;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.shiro.assembly.PasswordDomainAssembler;
+import org.apache.polygene.library.shiro.assembly.PermissionsDomainAssembler;
 import org.apache.polygene.library.shiro.assembly.StandaloneShiroAssembler;
-
-import <%= packageName %>.model.security.SecurityRepository;
-import <%= packageName %>.model.security.HardcodedSecurityRepositoryMixin;
+import org.apache.polygene.library.shiro.ini.ShiroIniConfiguration;
+import <%= polygene.packageName %>.model.security.RealmService;
+import <%= polygene.packageName %>.model.security.SecurityRepository;
+import <%= polygene.packageName %>.model.security.User;
+import <%= polygene.packageName %>.model.security.UserFactory;
 
 public class SecurityModule
     implements ModuleAssembler
@@ -39,15 +43,27 @@ public class SecurityModule
         throws AssemblyException
     {
         module.services( SecurityRepository.class )
-            .withMixins( HardcodedSecurityRepositoryMixin.class )
             .visibleIn( Visibility.application )
             .instantiateOnStartup();
 
-        new StandaloneShiroAssembler().
-            withConfig( configModule, Visibility.layer ).
-            assemble( module );
+        new StandaloneShiroAssembler()
+            .withConfig( module, Visibility.layer )
+            .assemble( module );
         module.services( RealmService.class );
 
+        module.forMixin( ShiroIniConfiguration.class )
+            .declareDefaults()
+            .iniResourcePath().set( "classpath:standalone-shiro.ini" );
+
+        new PasswordDomainAssembler()
+            .withConfig( module, Visibility.layer )
+            .assemble( module );
+
+        new PermissionsDomainAssembler().assemble( module );
+
+        module.entities( User.class );
+        module.services( UserFactory.class );
+
         return module;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/module.js b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/module.js
index 5d21aaa..1ba7360 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/module.js
+++ b/tools/generator-polygene/app/templates/DomainLayer/SecurityModule/module.js
@@ -11,11 +11,11 @@ module.exports = {
             copyFile(p, "CryptoException");
             copyFile(p, "CryptoService");
             copyFile(p, "EncryptedStringPropertyConcern");
-            copyFile(p, "EntityStoreBackedSecurityRepositoryMixin");
             copyFile(p, "Group");
             copyFile(p, "RealmService");
             copyFile(p, "SecurityRepository");
             copyFile(p, "User");
+            copyFile(p, "UserFactory");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
index 68be6f3..638941f 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.domain;
+package <%= polygene.packageName %>.bootstrap.domain;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
@@ -31,7 +31,7 @@ public class DomainLayer extends LayeredLayerAssembler
     public LayerAssembly assemble( LayerAssembly layer )
         throws AssemblyException
     {
-<% if( hasFeature( 'rest api' ) ) {
+<% if( polygene.applicationtype === 'Rest API' ) {
 %>        createModule( layer, CrudModule.class );<%
 }
 for( var mod in polygene.modules ) {%>

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl
index 4945277..d9d86a9 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/CachingModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.infrastructure;
+package <%= polygene.packageName %>.bootstrap.infrastructure;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl
index ab2ad2c..380cc19 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/FileConfigurationModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.infrastructure;
+package <%= polygene.packageName %>.bootstrap.infrastructure;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
index c7e1975..6648c9f 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/IndexingModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.infrastructure;
+package <%= polygene.packageName %>.bootstrap.infrastructure;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
index a4d3919..d06c9cc 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.infrastructure;
+package <%= polygene.packageName %>.bootstrap.infrastructure;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
index 62b3586..f75dc3a 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.infrastructure;
+package <%= polygene.packageName %>.bootstrap.infrastructure;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
index 997fe3b..5cde992 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.infrastructure;
+package <%= polygene.packageName %>.bootstrap.infrastructure;
 
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl
index d02d6a9..cead6b3 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl
@@ -17,7 +17,7 @@
  *
  *
 -%>
-package <%= packageName %>.bootstrap.infrastructure;
+package <%= polygene.packageName %>.bootstrap.infrastructure;
 
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
index bc0a651..fa3630a 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
@@ -26,7 +26,7 @@ dependencies {
 
 
   compile "org.apache.polygene.libraries:org.apache.polygene.library.fileconfig:$polygeneVersion"
-<% if( hasFeature( 'rest api' ) ) { %>
+<% if( polygene.applicationtype === 'Rest API' ) { %>
   compile "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
 <% } %>
   compile "org.apache.polygene.extensions:org.apache.polygene.extension.entitystore-<%= polygene.entitystore.toLowerCase() %>:$polygeneVersion"

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl
index 7f75b20..7b7243a 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl
@@ -18,6 +18,12 @@
  *
 -%>
 
-// dependencies {
-//   compile "org.restlet.jee:org.restlet:2.3.4"
-// }
+dependencies {
+
+<% if( hasFeature( 'security' ) ) {
+%>    compile "org.apache.polygene.libraries:org.apache.polygene.library.shiro-core:$polygeneVersion"
+<% } %>
+<% if( polygene.applicationtype === 'Rest API' ) {
+%>    compile "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
+<% } %>
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
index 82afa09..d07ac02 100644
--- a/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
@@ -22,6 +22,8 @@ dependencies {
   compile project( ":model" )
 
   compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
-  compile "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
+<% if( polygene.applicationtype === 'Rest API' ) {
+%>    compile "org.apache.polygene.libraries:org.apache.polygene.library.restlet:$polygeneVersion"
+<% } %>
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/01949a6d/tools/generator-polygene/test/generator_test.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/test/generator_test.js b/tools/generator-polygene/test/generator_test.js
index 07b9c84..d5f2b58 100644
--- a/tools/generator-polygene/test/generator_test.js
+++ b/tools/generator-polygene/test/generator_test.js
@@ -5,17 +5,8 @@ var shell = require('shelljs');
 
 //See http://yeoman.io/authoring/testing.html
 
-describe('polygene-generator-defaults', function () {
-    this.timeout(10000);
-    it('generates a Gradle buildable Apache Polygene project', function () {
-        return helpers.run(path.join(__dirname, '../app'))
-            .withPrompts({
-                name: 'test-project',
-                packageName: 'org.apache.polygene.generator.test'
-            })
-            .then(buildAndVerify);
-    });
-});
+// test with all defaults first.
+test();
 
 var entityStores = [
     'Cassandra',
@@ -104,7 +95,7 @@ entityStores.forEach(function (entitystore) {
 });
 
 function test(entityStore, indexing, serialization, caching, metrics, features) {
-    describe('polygene-generator-default-and-' + entityStore.toLowerCase() + "-entitystore", function () {
+    describe('polygene-generator', function () {
         this.timeout(10000);
         it('generates a Gradle buildable Apache Polygene project with '
             + entityStore + 'EntityStore, '
@@ -115,10 +106,10 @@ function test(entityStore, indexing, serialization, caching, metrics, features)
             + ' and ' + features + '.',
             function () {
                 return helpers.run(path.join(__dirname, '../app'))
+                    .inDir(path.join(__dirname, '../build/test-project'))
                     .withPrompts({
                         name: 'test-project',
                         packageName: 'org.apache.polygene.generator.test',
-
                         entitystore: entityStore,
                         serialization: serialization,
                         indexing: indexing,


Mime
View raw message