You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/07/17 12:46:28 UTC

[36/50] [abbrv] polygene-java git commit: Various fixes in tools/generator-polygene, fixing some things.

Various fixes in tools/generator-polygene, fixing some things.


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

Branch: refs/heads/master
Commit: 29ecdba0615c81c94f8677e01dcf802ee8387ccf
Parents: 04a0f56
Author: niclas <ni...@hedhman.org>
Authored: Fri Jul 14 22:40:56 2017 +0800
Committer: niclas <ni...@hedhman.org>
Committed: Fri Jul 14 22:40:56 2017 +0800

----------------------------------------------------------------------
 .../distributions/DistributionsPlugin.groovy    |   5 -
 .../sql/PostgreSQLEntityStoreTestSuite.java     |   2 +-
 .../DevelopmentKeyManagement.java.tmpl          | 259 -------------------
 .../RestAPIApplication/Launcher.java.tmpl       |   8 +-
 .../app/templates/RestAPIApplication/app.js     |  18 +-
 .../RestAPIApplication/bootstrap-test.tmpl      |   5 +-
 .../customUnixStartScript.txt                   | 175 -------------
 .../customUnixStartScript.txt.tmpl              | 175 +++++++++++++
 .../customWindowsStartScript.txt                |  89 -------
 .../customWindowsStartScript.txt.tmpl           |  89 +++++++
 .../RestAPIApplication/dev-keystore.p12         | Bin 0 -> 2586 bytes
 .../src/docs/yeoman_polygene.txt                |   1 -
 12 files changed, 274 insertions(+), 552 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/distributions/DistributionsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/distributions/DistributionsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/distributions/DistributionsPlugin.groovy
index bc6e796..d512d74 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/distributions/DistributionsPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/distributions/DistributionsPlugin.groovy
@@ -165,9 +165,6 @@ class DistributionsPlugin implements Plugin<Project>
       spec.exclude '**/.nb-gradle/**'        // Netbeans files
       spec.exclude '**/.nb-gradle*'          // Netbeans files
 
-      // Polygene Generator files
-      spec.exclude 'tools/generator-polygene/app/templates/**/*.txt'
-
       spec.into '.'
     }
     def srcDistSupplementaryFilesCopySpec = project.copySpec { CopySpec spec ->
@@ -291,8 +288,6 @@ class DistributionsPlugin implements Plugin<Project>
         'manual/**/jquery*.js',
         // W3C XML Schemas - W3C Software License
         'samples/rental/src/main/resources/*.xsd',
-        // Polygene Generator Heroes Templates - MIT
-        'tools/generator-polygene/app/templates/Heroes/**',
       ]
     } as Action<RatTask> )
     project.tasks.create( TaskNames.INSPECT_SOURCE_DIST ) { Task task ->

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java
index d1dd952..41669f2 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java
@@ -44,7 +44,7 @@ public class PostgreSQLEntityStoreTestSuite extends EntityStoreTestSuite
 {
     @ClassRule
     public static final DockerRule DOCKER = new DockerRule( "postgres",
-                                                            3000L,
+                                                            10000L,
                                                             "PostgreSQL init process complete; ready for start up." );
 
     @Override

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/DevelopmentKeyManagement.java.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/DevelopmentKeyManagement.java.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/DevelopmentKeyManagement.java.tmpl
deleted file mode 100644
index d724253..0000000
--- a/tools/generator-polygene/app/templates/RestAPIApplication/DevelopmentKeyManagement.java.tmpl
+++ /dev/null
@@ -1,259 +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 <%= polygene.packageName %>.app;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.math.BigInteger;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.Provider;
-import java.security.PublicKey;
-import java.security.Security;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import javax.net.ssl.KeyManagerFactory;
-import javax.security.auth.x500.X500Principal;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.x500.X500Name;
-import org.bouncycastle.asn1.x509.BasicConstraints;
-import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
-import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
-import org.bouncycastle.jce.X509KeyUsage;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
-import org.bouncycastle.operator.ContentSigner;
-import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
-import org.bouncycastle.pkcs.PKCS10CertificationRequest;
-import org.bouncycastle.pkcs.PKCS10CertificationRequestBuilder;
-import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder;
-
-import static <%= polygene.packageName %>.bootstrap.connectivity.HttpServerModule.*;
-
-/**
- * This class creates self-signed SSL certificate into the security/ directory.
- * <p>
- * NOTE: This is for use in development only. For production setup, please use better tooling.
- * </p>
- */
-class DevelopmentKeyManagement
-{
-    private static final String COMMON_NAME = "<%= polygene.packageName %>";
-    private static final int RSA_KEY_LEN = 4096;
-
-    static void initializeKeyStore()
-    {
-        @SuppressWarnings( "unused" )
-        KeyStore trustStore = loadKeyStore( new File(TRUSTSTORE_FILENAME), TRUSTSTORE_TYPE, KS_PASSWORD );
-
-        File keyFile = new File( SERVER_KEYSTORE_FILENAME );
-        KeyStore keyStore = loadKeyStore( keyFile, SERVER_KEYSTORE_TYPE, KS_PASSWORD );
-        initializeKeyManager( keyStore, KS_PASSWORD );
-        createKeyStoreData( keyStore, keyFile, SERVER_KEYSTORE_TYPE, KS_PASSWORD );
-    }
-
-    private static KeyStore loadKeyStore( File keyFile, String type, String password )
-    {
-        if( !keyFile.exists() )
-        {
-            createKeyStore(keyFile, type, password);
-        }
-        try( FileInputStream fis = new FileInputStream( keyFile ) )
-        {
-            KeyStore ks = KeyStore.getInstance( type );
-            char[] pwd = password.toCharArray();
-            ks.load( fis, pwd );
-            return ks;
-        }
-        catch( Exception e )
-        {
-            throw new AssemblyException( "Unable to create keystore.", e );
-        }
-    }
-
-    @SuppressWarnings( "ResultOfMethodCallIgnored" )
-    private static void createKeyStore( File keyFile, String type, String password )
-        throws AssemblyException
-    {
-        if( !keyFile.getParentFile().exists() )
-        {
-            keyFile.getParentFile().mkdirs();
-        }
-        try( FileOutputStream fos = new FileOutputStream( keyFile ) )
-        {
-            KeyStore ks = KeyStore.getInstance( type );
-            char[] pwd = password.toCharArray();
-            ks.load( null, pwd );
-            ks.store( fos, pwd );
-        }
-        catch( Exception e )
-        {
-            throw new AssemblyException( "Unable to create keystore.", e );
-        }
-    }
-
-    private static void initializeKeyManager( KeyStore keyStore, String password )
-    {
-        try
-        {
-            KeyManagerFactory kmf = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm() );
-            kmf.init( keyStore, password.toCharArray() );
-        }
-        catch( NoSuchAlgorithmException | KeyStoreException | UnrecoverableKeyException e )
-        {
-            throw new AssemblyException( "Unable to initialize KeyManager.", e );
-        }
-    }
-
-    private static void createKeyStoreData( KeyStore keyStore, File keyFile, String type, String password )
-    {
-        try
-        {
-            if( keyStore.getCertificate( COMMON_NAME ) != null )
-            {
-                return;
-            }
-            KeyPair keyPair = generateKeyPair();
-            X509Certificate certificate = selfSignedCertificate( keyPair, COMMON_NAME, 30 );
-            keyStore.setCertificateEntry( COMMON_NAME, certificate );
-            storeKeyStore(keyStore, keyFile, password, type);
-
-            System.out.println("Created Self-signed certificated:");
-            System.out.println(convertCertificateToPEM( certificate ));
-        }
-        catch( KeyStoreException e )
-        {
-            throw new AssemblyException( "Unable to store certificate in keystore.", e );
-        }
-    }
-
-    private static void storeKeyStore( KeyStore keyStore, File keyFile, String password, String type )
-    {
-        try( FileOutputStream fos = new FileOutputStream( keyFile ) )
-        {
-            KeyStore ks = KeyStore.getInstance( type );
-            char[] pwd = password.toCharArray();
-            ks.load( null, pwd );
-            ks.store( fos, pwd );
-        }
-        catch( Exception e )
-        {
-            throw new AssemblyException( "Unable to create keystore.", e );
-        }
-    }
-
-    private static KeyPair generateKeyPair()
-    {
-        try
-        {
-            KeyPairGenerator keyGen = KeyPairGenerator.getInstance( "RSA" );
-            keyGen.initialize( RSA_KEY_LEN );
-            return keyGen.generateKeyPair();
-        }
-        catch( NoSuchAlgorithmException e )
-        {
-            throw new AssemblyException( "RSA encryption is not available on this system.", e );
-        }
-    }
-
-    @SuppressWarnings( "unused" )
-    private static PKCS10CertificationRequest generateCSR( KeyPair pair, String subjectDN )
-    {
-        try
-        {
-            X500Principal subject = new X500Principal( "CN=" + subjectDN );
-            PublicKey publicKey = pair.getPublic();
-            PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder( subject, publicKey );
-            JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder( "SHA256withRSA" );
-            ContentSigner signer = csBuilder.build( pair.getPrivate() );
-            return p10Builder.build( signer );
-        }
-        catch( Exception e )
-        {
-            throw new AssemblyException( "Unable to generate Certificate Signing Request", e );
-        }
-    }
-
-    private static String convertCertificateToPEM( X509Certificate signedCertificate )
-    {
-        try( StringWriter signedCertificatePEMDataStringWriter = new StringWriter() )
-        {
-            JcaPEMWriter pemWriter = new JcaPEMWriter( signedCertificatePEMDataStringWriter );
-            pemWriter.writeObject( signedCertificate );
-            pemWriter.close();
-            return signedCertificatePEMDataStringWriter.toString();
-        }
-        catch( IOException e )
-        {
-            throw new AssemblyException( "Unable to convert certificate to PEM string.", e );
-        }
-    }
-
-    private static X509Certificate selfSignedCertificate( KeyPair keyPair, String subjectDN, @SuppressWarnings( "SameParameterValue" ) int days )
-    {
-        try
-        {
-            Provider bcProvider = new BouncyCastleProvider();
-            Security.addProvider( bcProvider );
-
-            long now = System.currentTimeMillis();
-            Date startDate = new Date( now );
-            Date endDate = new Date( now + days * 25 * 3_600_000L );
-
-            X500Name dnName = new X500Name( "CN=" + subjectDN );
-            BigInteger certSerialNumber = new BigInteger( Long.toString( now ) );
-            String signatureAlgorithm = "SHA256WithRSA"; // <-- Use appropriate signature algorithm based on your keyPair algorithm.
-            ContentSigner contentSigner = new JcaContentSignerBuilder( signatureAlgorithm ).build( keyPair.getPrivate() );
-            JcaX509v3CertificateBuilder certBuilder =
-                new JcaX509v3CertificateBuilder( dnName, certSerialNumber, startDate, endDate, dnName, keyPair.getPublic() );
-
-            // Basic Constraints
-            certBuilder.addExtension(
-                new ASN1ObjectIdentifier( "2.5.29.19" ),
-                true,
-                new BasicConstraints( true ) ); // Basic Constraints is usually marked as critical.
-
-            // Key Usage constraints
-            certBuilder.addExtension(
-                new ASN1ObjectIdentifier( "2.5.29.15" ),
-                true,
-                new X509KeyUsage(
-                    X509KeyUsage.digitalSignature |
-                    X509KeyUsage.keyCertSign |
-                    X509KeyUsage.nonRepudiation |
-                    X509KeyUsage.keyEncipherment |
-                    X509KeyUsage.dataEncipherment ) );
-
-            return new JcaX509CertificateConverter().setProvider( bcProvider ).getCertificate( certBuilder.build( contentSigner ) );
-        }
-        catch( Exception e )
-        {
-            throw new AssemblyException( "Unable to self-sign certificate.", e );
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl
index 40d3dfd..ad03b15 100644
--- a/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl
@@ -45,13 +45,7 @@ public class <%= polygene.name %>Launcher extends PolygeneRestApplicationLaunche
     protected LayeredApplicationAssembler createApplicationAssembler()
         throws AssemblyException
     {
-<% if( polygene.hasFeature( 'security' ) ) {
-%>        if( mode == Application.Mode.development )
-        {
-            DevelopmentKeyManagement.initializeKeyStore();
-        }
-<% }
-%>        return new <%= polygene.name %>ApplicationAssembler( name, version, mode, none -> {} );
+        return new <%= polygene.name %>ApplicationAssembler( name, version, mode, none -> {} );
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/app.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/app.js b/tools/generator-polygene/app/templates/RestAPIApplication/app.js
index 610b9af..03ddff9 100644
--- a/tools/generator-polygene/app/templates/RestAPIApplication/app.js
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/app.js
@@ -33,10 +33,8 @@ module.exports = {
             'app/src/main/java/' + p.javaPackageDir + '/app/' + p.name + 'Launcher.java');
 
         if (p.hasFeature('security')) {
-            p.copyTemplate(p.ctx,
-                'RestAPIApplication/DevelopmentKeyManagement.java.tmpl',
-                'app/src/main/java/' + p.javaPackageDir + '/app/DevelopmentKeyManagement.java');
             p.copyToConfig(p.ctx, 'RestAPIApplication/web-shiro.ini.tmpl', 'web-shiro.ini');
+            p.copyToConfig(p.ctx, 'RestAPIApplication/dev-keystore.p12', 'security/keystore-' + p.name + '.p12');
         }
 
         p.copyTemplate(p.ctx,
@@ -51,15 +49,13 @@ module.exports = {
             'RestAPIApplication/SETUP.tmpl',
             'SETUP.txt');
 
-        p.ctx.fs.copy(
-            p.ctx.templatePath('RestAPIApplication/customUnixStartScript.txt'),
-            p.ctx.destinationPath('app/src/scripts/customUnixStartScript.txt')
-        );
+        p.copyTemplate(p.ctx,
+            'RestAPIApplication/customUnixStartScript.txt.tmpl',
+            'app/src/scripts/customUnixStartScript.txt.tmpl');
 
-        p.ctx.fs.copy(
-            p.ctx.templatePath('RestAPIApplication/customWindowsStartScript.txt'),
-            p.ctx.destinationPath('app/src/scripts/customWindowsStartScript.txt')
-        );
+        p.copyTemplate(p.ctx,
+            'RestAPIApplication/customWindowsStartScript.txt.tmpl',
+            'app/src/scripts/customWindowsStartScript.txt.tmpl');
     }
 };
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
index 59d6751..a0cad7a 100644
--- a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
@@ -91,10 +91,7 @@ public class BootstrapTest
             protected LayeredApplicationAssembler createApplicationAssembler()
                 throws AssemblyException
             {
-<% if( polygene.hasFeature( 'security' ) ) {
-%>                DevelopmentKeyManagement.initializeKeyStore();
-<% }
-%>                return new <%= polygene.name %>ApplicationAssembler( "LaunchTest", "0", Application.Mode.development, BootstrapTest.this::setupTest )
+                return new <%= polygene.name %>ApplicationAssembler( "LaunchTest", "0", Application.Mode.development, BootstrapTest.this::setupTest )
                 {
                     @Override
                     protected void onModelCreated( ApplicationDescriptor model )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt b/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt
deleted file mode 100644
index fd23f57..0000000
--- a/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-##  ${applicationName} start up script for UN*X
-##
-##############################################################################
-
-# default to 'development' mode
-if [ -z \$APP_MODE ] ; then
-    export APP_MODE=development
-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\"`/${appHomeRelativePath}" >/dev/null
-APP_HOME="`pwd -P`"
-cd "\$SAVED" >/dev/null
-
-APP_NAME="${applicationName}"
-APP_BASE_NAME=`basename "\$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script.
-DEFAULT_JVM_OPTS=${defaultJvmOpts}
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
-    echo "\$*"
-}
-
-die () {
-    echo
-    echo "\$*"
-    echo
-    exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
-  CYGWIN* )
-    cygwin=true
-    ;;
-  Darwin* )
-    darwin=true
-    ;;
-  MINGW* )
-    msys=true
-    ;;
-  NONSTOP* )
-    nonstop=true
-    ;;
-esac
-
-CLASSPATH=\$APP_HOME/config/\$APP_MODE:$classpath
-
-# 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" -a "\$nonstop" = "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"`
-    JAVACMD=`cygpath --unix "\$JAVACMD"`
-
-    # 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
-
-# Escape application args
-save () {
-    for i do printf %s\\\\n "\$i" | sed "s/'/'\\\\\\\\''/g;1s/^/'/;\\\$s/\\\$/' \\\\\\\\/" ; done
-    echo " "
-}
-APP_ARGS=\$(save "\$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- \$DEFAULT_JVM_OPTS \$JAVA_OPTS \$${optsEnvironmentVar} <% if ( appNameSystemProperty ) { %>"\"-D${appNameSystemProperty}=\$APP_BASE_NAME\"" <% } %>-classpath "\"\$CLASSPATH\"" ${mainClassName} "\$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "\$(uname)" = "Darwin" ] && [ "\$HOME" = "\$PWD" ]; then
-  cd "\$(dirname "\$0")"
-fi
-
-exec "\$JAVACMD" "\$@"

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt.tmpl
new file mode 100644
index 0000000..e2867fd
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/customUnixStartScript.txt.tmpl
@@ -0,0 +1,175 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+##  ${applicationName} start up script for UN*X
+##
+##############################################################################
+
+# default to 'development' mode
+if [ -z \$APP_MODE ] ; then
+    export APP_MODE=development
+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\"`/${appHomeRelativePath}" >/dev/null
+APP_HOME="`pwd -P`"
+cd "\$SAVED" >/dev/null
+
+APP_NAME="${applicationName}"
+APP_BASE_NAME=`basename "\$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script.
+DEFAULT_JVM_OPTS=${defaultJvmOpts}
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "\$*"
+}
+
+die () {
+    echo
+    echo "\$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=\$APP_HOME/config/\$APP_MODE:$classpath
+
+# 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" -a "\$nonstop" = "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"`
+    JAVACMD=`cygpath --unix "\$JAVACMD"`
+
+    # 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
+
+# Escape application args
+save () {
+    for i do printf %s\\\\n "\$i" | sed "s/'/'\\\\\\\\''/g;1s/^/'/;\\\$s/\\\$/' \\\\\\\\/" ; done
+    echo " "
+}
+APP_ARGS=\$(save "\$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- \$DEFAULT_JVM_OPTS \$JAVA_OPTS \$${optsEnvironmentVar} <%% if ( appNameSystemProperty ) { %>"\"-D${appNameSystemProperty}=\$APP_BASE_NAME\"" <%% } %>-classpath "\"\$CLASSPATH\"" ${mainClassName} "\$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "\$(uname)" = "Darwin" ] && [ "\$HOME" = "\$PWD" ]; then
+  cd "\$(dirname "\$0")"
+fi
+
+exec "\$JAVACMD" "\$@"

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt b/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt
deleted file mode 100644
index e891013..0000000
--- a/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem  ${applicationName} startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.\
-
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%${appHomeRelativePath}
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=${defaultJvmOpts}
-
-@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 Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto setmode
-
-set CMD_LINE_ARGS=%*
-
-:setmode
-if "x%APP_MODE%" <> "x" goto execute
-set APP_MODE=development
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\\config\\%APP_MODE%;$classpath
-
-@rem Execute ${applicationName}
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %${optsEnvironmentVar}% <% if ( appNameSystemProperty ) { %>"-D${appNameSystemProperty}=%APP_BASE_NAME%"<% } %> -classpath "%CLASSPATH%" ${mainClassName} %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable ${exitEnvironmentVar} if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if  not "" == "%${exitEnvironmentVar}%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt.tmpl
new file mode 100644
index 0000000..8f262bc
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/customWindowsStartScript.txt.tmpl
@@ -0,0 +1,89 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  ${applicationName} startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.\
+
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%${appHomeRelativePath}
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=${defaultJvmOpts}
+
+@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 Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto setmode
+
+set CMD_LINE_ARGS=%*
+
+:setmode
+if "x%APP_MODE%" <> "x" goto execute
+set APP_MODE=development
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\\config\\%APP_MODE%;$classpath
+
+@rem Execute ${applicationName}
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %${optsEnvironmentVar}% <%% if ( appNameSystemProperty ) { %>"-D${appNameSystemProperty}=%APP_BASE_NAME%"<%% } %> -classpath "%CLASSPATH%" ${mainClassName} %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable ${exitEnvironmentVar} if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%${exitEnvironmentVar}%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/app/templates/RestAPIApplication/dev-keystore.p12
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/dev-keystore.p12 b/tools/generator-polygene/app/templates/RestAPIApplication/dev-keystore.p12
new file mode 100644
index 0000000..2225309
Binary files /dev/null and b/tools/generator-polygene/app/templates/RestAPIApplication/dev-keystore.p12 differ

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/29ecdba0/tools/generator-polygene/src/docs/yeoman_polygene.txt
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/src/docs/yeoman_polygene.txt b/tools/generator-polygene/src/docs/yeoman_polygene.txt
index 388aea2..85e50a7 100644
--- a/tools/generator-polygene/src/docs/yeoman_polygene.txt
+++ b/tools/generator-polygene/src/docs/yeoman_polygene.txt
@@ -359,7 +359,6 @@ we will create a complete project, like this
    create bootstrap/src/main/java/com/sensetif/sink/bootstrap/connectivity/ConnectivityLayer.java
    create rest/src/main/java/com/sensetif/sink/rest/FloodRestApplication.java
    create app/src/main/java/com/sensetif/sink/app/FloodLauncher.java
-   create app/src/main/java/com/sensetif/sink/app/DevelopmentKeyManagement.java
    create app/src/main/config/development/web-shiro.ini
    create app/src/main/config/qa/web-shiro.ini
    create app/src/main/config/staging/web-shiro.ini