[maven-release-plugin] copy for tag turbine-webapp-4.0-1.0.1

git-svn-id: https://svn.apache.org/repos/asf/turbine/maven/archetypes/tags/turbine-webapp-4.0-1.0.1@1775114 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/turbine-webapp-4.0/LICENSE b/turbine-webapp-4.0/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/turbine-webapp-4.0/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
diff --git a/turbine-webapp-4.0/NOTICE b/turbine-webapp-4.0/NOTICE
new file mode 100644
index 0000000..a43064b
--- /dev/null
+++ b/turbine-webapp-4.0/NOTICE
@@ -0,0 +1,5 @@
+Turbine Webapp Component
+Copyright 2006-2016 The Apache Software Foundation.
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/turbine-webapp-4.0/pom.xml b/turbine-webapp-4.0/pom.xml
new file mode 100644
index 0000000..ab0c389
--- /dev/null
+++ b/turbine-webapp-4.0/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>

+<!--

+ Licensed to the Apache Software Foundation (ASF) under one

+ or more contributor license agreements.  See the NOTICE file

+ distributed with this work for additional information

+ regarding copyright ownership.  The ASF licenses this file

+ to you under the Apache License, Version 2.0 (the

+ "License"); you may not use this file except in compliance

+ with the License.  You may obtain a copy of the License at

+

+   http://www.apache.org/licenses/LICENSE-2.0

+

+ Unless required by applicable law or agreed to in writing,

+ software distributed under the License is distributed on an

+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+ KIND, either express or implied.  See the License for the

+ specific language governing permissions and limitations

+ under the License.

+-->

+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

+

+  <modelVersion>4.0.0</modelVersion>

+    <parent>

+    <groupId>org.apache</groupId>

+    <artifactId>apache</artifactId>

+    <version>18</version>

+  </parent>

+  <groupId>org.apache.turbine</groupId>

+  <artifactId>turbine-webapp-4.0</artifactId>

+  <version>1.0.1</version>

+  <packaging>maven-archetype</packaging>

+

+  <name>Archetype - Turbine 4.0M2 WebApp</name>

+  <description>This archetype sets up a web application project based on Apache Turbine 4.0M2</description>

+  <url>http://turbine.apache.org</url>

+

+  <inceptionYear>2011</inceptionYear>

+

+  <scm>

+    <connection>scm:svn:http://svn.apache.org/repos/asf/turbine/maven/archetypes/tags/turbine-webapp-4.0-1.0.1</connection>

+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/turbine/maven/archetypes/tags/turbine-webapp-4.0-1.0.1</developerConnection>

+    <url>http://svn.apache.org/viewvc/turbine/maven/archetypes/tags/turbine-webapp-4.0-1.0.1</url>

+  </scm>

+  

+<build>

+    <extensions>

+      <extension>

+        <groupId>org.apache.maven.archetype</groupId>

+        <artifactId>archetype-packaging</artifactId>

+        <version>2.4</version>

+      </extension>

+    </extensions>

+

+    <pluginManagement>

+      <plugins>

+        <plugin>

+          <artifactId>maven-archetype-plugin</artifactId>

+          <version>2.4</version>

+        </plugin>

+      </plugins>

+    </pluginManagement>

+  </build>

+

+</project>

diff --git a/turbine-webapp-4.0/src/changes/changes.xml b/turbine-webapp-4.0/src/changes/changes.xml
new file mode 100644
index 0000000..c231563
--- /dev/null
+++ b/turbine-webapp-4.0/src/changes/changes.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<document>
+  <properties>
+    <title>Changes</title>
+    <author email="tv@apache.org">Thomas Vandahl</author>
+  </properties>
+
+  <body>
+   <release version="1.0.1" date="in Subversion">
+       <action dev="gk" type="add">
+       Password change action, Check anonymous login
+      </action>
+      <action dev="gk" type="update">
+       JNDI Jetty Update
+      </action>
+      <action dev="tv" type="add">
+       Add testing in place with "integration-test"
+      </action>
+      <action dev="tv" type="update">
+       Turbine annotations, use auto detect Torque adapter
+      </action>
+       <action dev="gk" type="update">
+       Fulcrum Torque Security added manager, om classes
+      </action>
+      <action dev="painter" type="add">
+       Added readme, docs, helper sql..
+      </action>
+       <action dev="painter" type="update">
+       MySQL is now default
+      </action>
+      <action dev="gk" type="update">
+       Update schema to torque / intake 4.0, dependencies, configurations
+       Update to MemoryGroupManagerImpl, Fulcrum     
+      </action>
+      <action dev="gk" type="add">
+        Jetty support
+      </action>
+      <action dev="tv" type="fix">
+        TRB-95
+      </action>
+      <action dev="gk" type="update ">
+        Update to Turbine 4-M2
+      </action>
+    </release>
+    <release version="1.0.0" date="2012-11-06">
+      <action dev="tv" type="fix">
+        Fixed missing dependencies and wrong class names as reported on the mailing list
+      </action>
+      <action dev="tv" type="add">
+        Add information required for a release to the POM
+      </action>
+      <action dev="tv" type="add">
+        Initial version
+      </action>
+    </release>
+  </body>
+</document>
diff --git a/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml b/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..b6481b5
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<archetype-descriptor 
+  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
+  name="turbine-4.0-velocity">
+
+  <requiredProperties>
+    <requiredProperty key="turbine_app_name">
+      <defaultValue>My Turbine Web Application</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_intake_file">
+      <defaultValue>intake.xml</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_database_name">
+      <defaultValue>turbine</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_database_adapter">
+      <defaultValue>auto</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_database_jndipath">
+      <defaultValue>jdbc/turbine</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_database_driver">
+      <defaultValue>com.mysql.jdbc.Driver</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_database_url">
+      <defaultValue>jdbc:mysql://localhost:3306/</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_database_user">
+      <defaultValue>db_user</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="turbine_database_password">
+      <defaultValue>db_password</defaultValue>
+    </requiredProperty>
+  </requiredProperties>
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+        <include>**/*.properties</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="false" packaged="false" encoding="UTF-8">
+      <directory>docs</directory>
+      <includes>
+        <include>**/*.txt</include>
+        <include>**/*.sql</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" packaged="false" encoding="UTF-8">
+      <directory>src/main/torque-schema</directory>
+      <includes>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" packaged="false" encoding="UTF-8">
+      <directory>src/main/webapp/WEB-INF</directory>
+      <includes>
+        <include>**/*.xml</include>
+        <include>**/*.properties</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="false" packaged="false" encoding="UTF-8">
+      <directory>src/main/webapp/templates</directory>
+      <includes>
+        <include>**/*.vm</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="false" packaged="false" encoding="UTF-8">
+      <directory>src/main/webapp/resources</directory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt b/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
new file mode 100644
index 0000000..46b5d28
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
@@ -0,0 +1,123 @@
+#*
+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.
+*#
+
+Notice
+
+About this archetype 
+ 
+Turbine Version: Turbine 4.0-M2. 
+
+Quick Guide to using the new Turbine 4.0-M2 maven archetype 
+for skeleton application generation
+
+You should have a local database installed and configured prior to 
+beginning the application setup below.
+
+
+You can invoke the Maven archetype for turbine-webapp-4.0 from 
+the command line as shown below - please update values starting 
+with 'groupId' as appropriate.
+
+mvn archetype:generate \
+    -DarchetypeGroupId=org.apache.turbine \
+    -DarchetypeArtifactId=turbine-webapp-4.0 \
+    -DarchetypeVersion=1.0.1-SNAPSHOT \
+    -DgroupId=com.mycompany.webapp \
+    -DartifactId=helloWorld \
+    -Dversion=1.0 \
+    -Dturbine_app_name=HelloWorld \
+    -Dturbine_database_adapter=mysql \
+    -Dturbine_database_user=db_username \
+    -Dturbine_database_password=db_password \
+    -Dturbine_database_name=helloWorld \
+    -Dturbine_database_url=jdbc:mysql://localhost:3306/ \
+    -Dgoals=generate-sources,sql:execute
+
+Notes
+
+When invoking archetype:generate, you can already set mvn commands and you can then skip them later.
+Be aware, when you set both mvn commands goals (-Dgoals=generate-sources, sql:execute), 
+you have to create the database (see below) BEFORE finishing the (interactive) archetype commands.
+
+Note that the database URL (turbine_database_url) 
+will be appended with your database name
+in the final pom.xml, so you do not need to specify that in 
+the configuration.
+
+Next, you need to create the database in MySQL
+
+ mysql -u <user> -p
+ mysql> create database helloWorld;
+ mysql> \q
+
+
+cd helloWorld
+
+# if not already done 
+mvn generate-sources  ## This will generate the OM layer and SQL 
+					  ## code for creating the corresponding
+					  ## database tables
+	
+# if not already done   
+mvn sql:execute       ## This executes the SQL code to create 
+					  ## the application schema defined 
+					  ## in src/main/torque-schema
+
+You should now check the database tables and if some data is missing
+insert the sample data file provided 
+as Torque 4.0 has disabled the datasql task.
+
+mvn jetty:run         ## Now you can launch your new Turbine application
+
+Open a web browser to http://localhost:8081/app
+
+Login should work with user admin/password or user/password.
+
+Background:
+
+By default Intake is used as an validation mechanism for authentication. You can change to the default login by settings
+
+action.login=LoginUser in TurbineResources.properties and changing Login.vm appropriately (commented form)
+
+To enable application development in Eclipse, run the following command 
+and then import the project into Eclipse.
+
+mvn eclipse:eclipse
+
+Once imported, update your project to be managed by Maven 
+  -> Right click on the proejct name
+  -> Configure 
+  -> Convert to Maven project
+
+To test the application can be deployed by Eclipse, select the run
+configuration "Run On Server" if you have a container configured with
+your eclipse environment.
+
+Starting developing
+
+Be aware of settings and some smaller restrictions, which mostly will be fixed in the upcoming releases.
+
+- Keep groups/roles lower case (which should be fixed in Fulcrum Security 1.1.1/Turbine 4.0)
+- abstract classes and managers are included (because of some minor bugs in Fulcrum Security 1.1.0, same as above)
+- LogoutUser action is included (fix in Turbine 4.0, getUserFromSession)
+- LoginUser action is included (to check for anonymous user, may be fixed in future release)
+- OM (Torque Object Mapper) stub classes are included (until configurable in schema with Torque version 2.1)
+- TurbineConfiguration returns a Commons configuration object, even if field is not assignable (will be fixed in Turbine 4.0, you can then assign e.g. to String instead, cft. SecureScreen)
+- Database connection is done initially by default with JNDI. If you want to change it, check Torque.properties and jetty-env.xml.  
+
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/_application-data.sql b/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/_application-data.sql
new file mode 100644
index 0000000..f605246
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/_application-data.sql
@@ -0,0 +1,15 @@
+
+##
+## application-data.sql
+##
+## Torque will not autogenerate these files anymore - please run
+## this SQL code maually to get your application up and running
+##
+
+INSERT INTO AUTHOR (AUTH_ID, FIRST_NAME, LAST_NAME) values (1, 'Donald', 'Knuth');
+INSERT INTO AUTHOR (AUTH_ID, FIRST_NAME, LAST_NAME) values (2, 'Mickey', 'Mouse' );
+INSERT INTO AUTHOR (AUTH_ID, FIRST_NAME, LAST_NAME) values (3, 'Bill', 'Bryson' );
+
+INSERT INTO BOOK ( BOOK_ID, AUTH_ID, TITLE, SUBJECT ) values ( 1, 1, 'The Art of Computer Programming', 'Computer Science');
+INSERT INTO BOOK ( BOOK_ID, AUTH_ID, TITLE, SUBJECT ) values ( 2, 2, 'Disney: Behind the Scenes', 'Fiction' );
+INSERT INTO BOOK ( BOOK_ID, AUTH_ID, TITLE, SUBJECT ) values ( 3, 3, 'A Walk in the Woods', 'Fiction');
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/_turbine-security-data.sql b/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/_turbine-security-data.sql
new file mode 100644
index 0000000..db0775a
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/sample-mysql-data/_turbine-security-data.sql
@@ -0,0 +1,40 @@
+##
+## turbine-security-data.sql
+##
+## Torque will not autogenerate these files anymore - please run
+## this SQL code maually to get your application up and running
+##
+SET FOREIGN_KEY_CHECKS=0;
+
+INSERT INTO TURBINE_USER (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
+    VALUES (1,'admin','password','','Admin');
+
+INSERT INTO TURBINE_USER (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
+    VALUES (2,'user','password','','User');
+    
+INSERT INTO TURBINE_USER (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
+    VALUES (3,'anon','nopw','','Anon');
+
+INSERT INTO `turbine_permission` (`PERMISSION_ID`, `PERMISSION_NAME`) VALUES
+(2, 'Turbine'),
+(1, 'TurbineAdmin');
+
+INSERT INTO `turbine_role` (`ROLE_ID`, `ROLE_NAME`) VALUES
+(1, 'turbineadmin'),
+(2, 'turbineuser');
+
+INSERT INTO `turbine_group` (`GROUP_ID`, `GROUP_NAME`) VALUES
+(1, 'global'),
+(2, 'Turbine');
+
+INSERT INTO `turbine_role_permission` (`ROLE_ID`, `PERMISSION_ID`) VALUES
+(1, 1),
+(2, 2);
+
+INSERT INTO `turbine_user_group_role` (`USER_ID`, `GROUP_ID`, `ROLE_ID`) VALUES
+(1, 1, 1),
+(1, 2, 1),
+(2, 2, 2),
+(2, 1, 2);
+    
+
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..f9ad7df
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,290 @@
+<?xml version="1.0" encoding="UTF-8"?>
+#*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*#
+#set($dollar = '$')
+#macro (var $label)${dollar}{${label}}#end
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>${package}</groupId>
+    <artifactId>${artifactId}</artifactId>
+    <version>${version}</version>
+    <packaging>war</packaging>
+
+    <name>${turbine_app_name}</name>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                </includes>
+            </resource>
+            <!-- (target) resource and filtering is not used  at all ? 
+            at least removed setting absolute path e.g. with #var("project.build.directory"), 
+            which does thrown an exception with mvn eclipse:eclipse - path is then incorrectly relativized.
+                --> 
+            <resource> 
+                <targetPath>../torque/schema</targetPath>
+                <filtering>true</filtering>
+                <directory>src/main/torque-schema</directory>
+                <includes>
+                    <include>*.xml</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.5.1</version>
+                <configuration>
+                    <source>${maven.compile.source}</source>
+                    <target>${maven.compile.target}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+            
+             <plugin>
+                <groupId>org.apache.torque</groupId>
+                <artifactId>torque-maven-plugin</artifactId>
+                <version>4.0</version>
+                <configuration>
+                    <schemaDir>#var("project.basedir")/src/main/torque-schema</schemaDir>
+                    <useClasspath>true</useClasspath>
+                    <runOnlyOnSchemaChange>false</runOnlyOnSchemaChange>
+                    <targetDatabase>${turbine_database_adapter}</targetDatabase>
+                </configuration>
+                <executions>
+          <execution>
+            <id>torque-om</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+            <configuration>
+              <packaging>classpath</packaging>
+              <configPackage>org.apache.torque.templates.om</configPackage>
+              <sourceDir>#var("project.basedir")/src/main/torque-schema</sourceDir>
+              <loglevel>error</loglevel>
+              <options>
+                <torque.database>${turbine_database_adapter}</torque.database>
+                <torque.om.package>${package}.om</torque.om.package>
+                <torque.om.addGetByNameMethods>false</torque.om.addGetByNameMethods>
+                <torque.om.save.saveException>TorqueException</torque.om.save.saveException>
+                <torque.om.useIsForBooleanGetters>true</torque.om.useIsForBooleanGetters>
+                <torque.om.useManagers>false</torque.om.useManagers>
+                <torque.om.addTimeStamp>true</torque.om.addTimeStamp>
+                <torque.om.objectIsCaching>true</torque.om.objectIsCaching>
+                <torque.om.save.addSaveMethods>true</torque.om.save.addSaveMethods>
+                <torque.om.addGetByNameMethods>true</torque.om.addGetByNameMethods>
+                <torque.om.complexObjectModel>true</torque.om.complexObjectModel>
+              </options>
+              <outputDirMap>
+                <modifiable>#var("project.build.sourceDirectory")</modifiable>
+              </outputDirMap>
+            </configuration>
+          </execution>
+          <execution>
+            <id>torque-sql-mysql</id><!-- ${turbine_database_adapter} -->
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+            <configuration>
+              <packaging>classpath</packaging>
+              <configPackage>org.apache.torque.templates.sql</configPackage>
+              <sourceDir>#var("project.basedir")/src/main/torque-schema</sourceDir>
+              <defaultOutputDir>#var("project.build.directory")/generated-sql/torque/mysql</defaultOutputDir>
+              <defaultOutputDirUsage>none</defaultOutputDirUsage>
+              <loglevel>error</loglevel>
+              <options>
+                <torque.database>mysql</torque.database>
+              </options>
+            </configuration>
+          </execution>
+                </executions>
+                <dependencies>
+                  <dependency>
+                    <groupId>org.apache.torque</groupId>
+                    <artifactId>torque-templates</artifactId>
+                    <version>4.0</version>
+                  </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                 <version>2.3</version>
+                <configuration>
+                    <archive>
+                        <manifestEntries>
+                            <X-Compile-Source-JDK>#var("maven.compile.source")</X-Compile-Source-JDK>
+                            <X-Compile-Target-JDK>#var("maven.compile.target")</X-Compile-Target-JDK>
+                        </manifestEntries>
+                    </archive>
+                    <!-- containerConfigXML>WEB-INF/build/context.xml</containerConfigXML -->
+                </configuration>
+            </plugin>
+
+
+      <!-- Required to execute torque database build -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>sql-maven-plugin</artifactId>
+        <version>1.5</version>
+        <configuration>
+
+          <!-- Please update with your database configuration -->
+          <driver>${turbine_database_driver}</driver>
+          <url>${turbine_database_url}${turbine_database_name}</url>
+          <username>${turbine_database_user}</username>
+          <password>${turbine_database_password}</password>
+          <onError>continue</onError>
+          <autocommit>true</autocommit>
+          <orderFile>ascending</orderFile>
+          <!-- this is mysql specific -->
+          <fileset>
+              <basedir>${project.build.directory}/generated-sql/torque/mysql</basedir>
+              <!-- basedir>${basedir}/target/generated-sql</basedir -->
+              <includes>
+                <include>*.sql</include>
+              </includes>
+           </fileset>
+           <srcFiles>
+              <srcFile>${basedir}/docs/sample-mysql-data/_application-data.sql</srcFile>
+              <srcFile>${basedir}/docs/sample-mysql-data/_turbine-security-data.sql</srcFile>
+           </srcFiles>
+        </configuration>
+        
+        <!-- update with your database driver dependency -->
+        
+        <dependencies>
+          <dependency>
+            <artifactId>mysql-connector-java</artifactId>
+            <groupId>mysql</groupId>
+            <version>5.1.40</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+
+            <!-- jetty:run checks deployed war http://localhost:8081/app/ 
+            
+            Using jetty 8 as supporting java 6. Other specs cft. http://www.eclipse.org/jetty/documentation/9.3.0.v20150612/what-jetty-version.html
+            -->
+            <plugin>
+               <groupId>org.mortbay.jetty</groupId>
+               <artifactId>jetty-maven-plugin</artifactId>
+               <version>8.1.16.v20140903</version>
+              <configuration>
+                <scanIntervalSeconds>10</scanIntervalSeconds>
+                <dumpOnStart>true</dumpOnStart>
+                <connectors>
+                <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+                  <port>8081</port>
+                </connector>
+                </connectors>
+                <!--webApp>
+                  <contextPath>/app</contextPath>
+                </webApp-->
+              </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+    
+    <!-- update with the database driver of your choice -->
+    <dependency>
+      <artifactId>mysql-connector-java</artifactId>
+      <groupId>mysql</groupId>
+      <version>5.1.40</version>
+    </dependency>    
+        <dependency>
+            <groupId>javax.activation</groupId>
+            <artifactId>activation</artifactId>
+            <version>1.1.1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+            <version>1.4.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.turbine</groupId>
+            <artifactId>turbine</artifactId>
+            <version>4.0-M2</version>
+        </dependency>
+        <!-- yaafi is optional. NOTICE: 1.0.7 has group org.apache.turbine not org.apache.fulcrum  -->
+        <dependency>
+          <groupId>org.apache.turbine</groupId>
+          <artifactId>fulcrum-yaafi</artifactId>
+          <version>1.0.7</version>
+        </dependency>
+        <!-- if using intake -->
+        <dependency>
+          <groupId>org.apache.fulcrum</groupId>
+          <artifactId>fulcrum-intake</artifactId>
+          <version>1.2.2</version>
+         </dependency>
+         <!-- include some optional dependencies required in example componentConfiguration.xml -->
+        <dependency>
+          <groupId>org.apache.fulcrum</groupId>
+          <artifactId>fulcrum-cache</artifactId>
+          <version>1.1.0</version>
+        </dependency>
+         <dependency>
+          <groupId>org.apache.fulcrum</groupId>
+          <artifactId>fulcrum-upload</artifactId>
+          <version>1.0.5</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.fulcrum</groupId>
+          <artifactId>fulcrum-security-memory</artifactId>
+          <version>1.1.0</version>
+        </dependency>
+         <dependency>             
+            <groupId>org.apache.fulcrum</groupId>
+            <artifactId>fulcrum-security-torque</artifactId>
+            <version>1.1.0</version>
+        </dependency>	
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <properties>
+        <maven.compile.source>1.6</maven.compile.source>
+        <maven.compile.target>1.6</maven.compile.target>
+        <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
+    </properties>
+    
+</project>
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
new file mode 100644
index 0000000..0a6bd1d
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N.properties
@@ -0,0 +1,23 @@
+#*
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+*#
+l10nkey=Default value
+username_required_msg=Please enter an email address as user name
+username_min_length_msg=Please enter at least {0} characters
+username_mask_msg=Please enter a valid email address as user name
+password_msg=Please enter a password
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
new file mode 100644
index 0000000..c5c771c
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_de_DE.properties
@@ -0,0 +1,28 @@
+#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
+#*
+# 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.
+
+l10nkey = German value
+
+password_msg = Bitte ein Passwort eingeben
+
+username_mask_msg = Geben Sie als Benutzername eine E-Mail-Adresse ein
+
+username_min_length_msg = Es m\u00FCssen {0} Zeichen eingegeben werden
+
+username_required_msg = Bitte einen Benutzernamen eingeben
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
new file mode 100644
index 0000000..0ceed48
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/L10N_en_US.properties
@@ -0,0 +1,23 @@
+#*
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+*#
+l10nkey=US-English value
+username_required_msg=Please enter an email address as user name
+username_min_length_msg=Please enter at least {0} characters
+username_mask_msg=Please enter a valid email address as user name
+password_msg=Please enter a password
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/TorqueAbstractUserManager.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/TorqueAbstractUserManager.java
new file mode 100644
index 0000000..5509438
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/TorqueAbstractUserManager.java
@@ -0,0 +1,400 @@
+package  ${package}.fulcrum.security.torque;
+
+#*
+* 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.
+*#
+
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.fulcrum.security.entity.User;
+import org.apache.fulcrum.security.spi.AbstractUserManager;
+import org.apache.fulcrum.security.util.DataBackendException;
+import org.apache.fulcrum.security.util.EntityExistsException;
+import org.apache.fulcrum.security.util.UnknownEntityException;
+import org.apache.fulcrum.security.util.UserSet;
+import org.apache.torque.NoRowsException;
+import org.apache.torque.TooManyRowsException;
+import org.apache.torque.TorqueException;
+import org.apache.torque.util.Transaction;
+
+import  org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity;
+/**
+ * This implementation persists to a database via Torque.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public abstract class TorqueAbstractUserManager extends AbstractUserManager
+{
+    private Boolean customPeer = false;  //  used for torque which uses per object peer classes
+    
+    private String peerClassName;
+    private static final String PEER_CLASS_NAME_KEY = "peerClassName";
+    
+    /**
+     * Avalon Service lifecycle method
+     */
+    public void configure(Configuration conf) throws ConfigurationException
+    {
+       super.configure( conf );
+       
+        peerClassName = conf.getChild( PEER_CLASS_NAME_KEY).getValue( null );
+        if (peerClassName != null) {
+            setPeerClassName( peerClassName );
+            setCustomPeer(true);
+        } 
+    }
+    
+    public Boolean getCustomPeer()
+    {
+        return customPeer;
+    }
+
+    public void setCustomPeer( Boolean customPeer )
+    {
+        this.customPeer = customPeer;
+    }
+
+    public String getPeerClassName()
+    {
+        return peerClassName;
+    }
+
+    public void setPeerClassName( String peerClassName )
+    {
+        this.peerClassName = peerClassName;
+    }
+    /**
+     * Get all specialized Users
+     *
+     * @param con a database connection
+     *
+     * @return a List of User instances
+     *
+     * @throws TorqueException if any database error occurs
+     */
+    protected abstract <T extends User> List<T> doSelectAllUsers(Connection con)
+        throws TorqueException;
+
+    /**
+     * Get a specialized User by name
+     *
+     * @param name the name of the group
+     * @param con a database connection
+     *
+     * @return a User instance
+     *
+     * @throws NoRowsException if no such group exists
+     * @throws TooManyRowsException if multiple groups with the given name exist
+     * @throws TorqueException if any other database error occurs
+     */
+    protected abstract <T extends User> T doSelectByName(String name, Connection con)
+        throws NoRowsException, TooManyRowsException, TorqueException;
+
+    /**
+     * Get a specialized User by id
+     *
+     * @param id the id of the group
+     * @param con a database connection
+     *
+     * @return a User instance
+     *
+     * @throws NoRowsException if no such group exists
+     * @throws TooManyRowsException if multiple groups with the given id exist
+     * @throws TorqueException if any other database error occurs
+     */
+    protected abstract <T extends User> T doSelectById(Integer id, Connection con)
+        throws NoRowsException, TooManyRowsException, TorqueException;
+
+    /**
+    * Removes an user account from the system.
+    *
+    * @param user the object describing the account to be removed.
+    * @throws DataBackendException if there was an error accessing the data
+    *         backend.
+    * @throws UnknownEntityException if the user account is not present.
+    */
+    public synchronized void removeUser(User user) throws DataBackendException, UnknownEntityException
+    {
+        try
+        {
+            ((TorqueAbstractSecurityEntity)user).delete();
+        }
+        catch (TorqueException e)
+        {
+            throw new DataBackendException("Removing User '" + user.getName() + "' failed", e);
+        }
+    }
+
+    /**
+       * Creates new user account with specified attributes.
+       *
+       * @param user the object describing account to be created.
+       *
+       * @throws DataBackendException if there was an error accessing the
+       *         data backend.
+       * @throws EntityExistsException if the user account already exists.
+       */
+    protected synchronized <T extends User> T persistNewUser(T user) throws DataBackendException
+    {
+        try
+        {
+            ((TorqueAbstractSecurityEntity)user).save();
+        }
+        catch (Exception e)
+        {
+            throw new DataBackendException("Adding User '" + user.getName() + "' failed", e);
+        }
+
+        return user;
+    }
+
+    /**
+       * Stores User attributes. The User is required to exist in the system.
+       *
+       * @param user The User to be stored.
+       * @throws DataBackendException if there was an error accessing the data
+       *         backend.
+       * @throws UnknownEntityException if the role does not exist.
+       */
+    public synchronized void saveUser(User user) throws DataBackendException, UnknownEntityException
+    {
+        if (checkExists(user))
+        {
+            try
+            {
+                TorqueAbstractSecurityEntity u = (TorqueAbstractSecurityEntity)user;
+                u.setNew(false);
+                u.save();
+            }
+            catch (Exception e)
+            {
+                throw new DataBackendException("Saving User '" + user.getName() + "' failed", e);
+            }
+        }
+        else
+        {
+            throw new UnknownEntityException("Unknown user '" + user + "'");
+        }
+    }
+
+    /**
+     * Check whether a specified user's account exists.
+     *
+     * The login name is used for looking up the account.
+     *
+     * @param userName The name of the user to be checked.
+     * @return true if the specified account exists
+     * @throws DataBackendException if there was an error accessing
+     *         the data backend.
+     */
+    public boolean checkExists(String userName) throws DataBackendException
+    {
+        boolean exists = false;
+
+        Connection con = null;
+
+        try
+        {
+            con = Transaction.begin(((TorqueAbstractSecurityEntity)getUserInstance()).getDatabaseName());
+
+            doSelectByName(userName, con);
+
+            Transaction.commit(con);
+            con = null;
+
+            exists = true;
+        }
+        catch (NoRowsException e)
+        {
+            exists = false;
+        }
+        catch (TooManyRowsException e)
+        {
+            throw new DataBackendException("Multiple Users with same username '" + userName + "'");
+        }
+        catch (TorqueException e)
+        {
+            throw new DataBackendException("Error retrieving user information", e);
+        }
+        finally
+        {
+            if (con != null)
+            {
+                Transaction.safeRollback(con);
+            }
+        }
+
+        return exists;
+    }
+
+    /**
+     * Retrieve a user from persistent storage using username as the
+     * key.
+     *
+     * @param userName the name of the user.
+     * @return an User object.
+     * @exception UnknownEntityException if the user's account does not
+     *            exist in the database.
+     * @exception DataBackendException if there is a problem accessing the
+     *            storage.
+     */
+    public <T extends User> T getUser(String userName) throws UnknownEntityException, DataBackendException
+    {
+        T user = null;
+        Connection con = null;
+
+        try
+        {
+            System.out.println("transaction for database: " +((TorqueAbstractSecurityEntity)getUserInstance()).getDatabaseName());
+            con = Transaction.begin(((TorqueAbstractSecurityEntity)getUserInstance()).getDatabaseName());
+
+            user = doSelectByName(userName.toLowerCase(), con);
+
+            // Add attached objects if they exist
+            ((TorqueAbstractSecurityEntity)user).retrieveAttachedObjects(con);
+
+            Transaction.commit(con);
+            con = null;
+        }
+        catch (NoRowsException e)
+        {
+            throw new UnknownEntityException("Unknown user '" + userName + "'",e);
+        }
+        catch (TooManyRowsException e)
+        {
+            throw new DataBackendException("Multiple Users with same username '" + userName + "'");
+        }
+        catch (TorqueException e)
+        {
+            throw new DataBackendException("Error retrieving user information", e);
+        }
+        finally
+        {
+            if (con != null)
+            {
+                Transaction.safeRollback(con);
+            }
+        }
+
+        return user;
+    }
+
+    /**
+       * Retrieves all users defined in the system.
+       *
+       * @return the names of all users defined in the system.
+       * @throws DataBackendException if there was an error accessing the data
+       *         backend.
+       */
+    public UserSet getAllUsers() throws DataBackendException
+    {
+        UserSet userSet = new UserSet();
+        Connection con = null;
+
+        try
+        {
+            con = Transaction.begin(((TorqueAbstractSecurityEntity)getUserInstance()).getDatabaseName());
+
+            List<User> users = doSelectAllUsers(con);
+
+            for (User user : users)
+            {
+                // Add attached objects if they exist
+                ((TorqueAbstractSecurityEntity)user).retrieveAttachedObjects(con);
+
+                userSet.add(user);
+            }
+
+            Transaction.commit(con);
+            con = null;
+        }
+        catch (TorqueException e)
+        {
+            throw new DataBackendException("Error retrieving all users", e);
+        }
+        finally
+        {
+            if (con != null)
+            {
+                Transaction.safeRollback(con);
+            }
+        }
+
+        return userSet;
+    }
+
+    /**
+     * Retrieve a User object with specified id.
+     *
+     * @param id
+     *            the id of the User.
+     * @return an object representing the User with specified id.
+     * @throws DataBackendException
+     *             if there was an error accessing the data backend.
+     * @throws UnknownEntityException
+     *             if the user does not exist.
+     */
+    public <T extends User> T getUserById(Object id) throws DataBackendException, UnknownEntityException
+    {
+        T user;
+
+        if (id != null && id instanceof Integer)
+        {
+            Connection con = null;
+
+            try
+            {
+                con = Transaction.begin(((TorqueAbstractSecurityEntity)getUserInstance()).getDatabaseName());
+
+                user = doSelectById((Integer)id, con);
+
+                // Add attached objects if they exist
+                ((TorqueAbstractSecurityEntity)user).retrieveAttachedObjects(con);
+
+                Transaction.commit(con);
+                con = null;
+            }
+            catch (NoRowsException e)
+            {
+                throw new UnknownEntityException("User with id '" + id + "' does not exist.", e);
+            }
+            catch (TorqueException e)
+            {
+                throw new DataBackendException("Error retrieving user information", e);
+            }
+            finally
+            {
+                if (con != null)
+                {
+                    Transaction.safeRollback(con);
+                }
+            }
+        }
+        else
+        {
+            throw new UnknownEntityException("Invalid user id '" + id + "'");
+        }
+
+        return user;
+    }
+    
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineGroup.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineGroup.java
new file mode 100644
index 0000000..f236106
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineGroup.java
@@ -0,0 +1,140 @@
+package ${package}.fulcrum.security.torque.turbine;
+#*
+* 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.
+*#
+import java.sql.Connection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.fulcrum.security.model.turbine.entity.TurbineGroup;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
+import org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole;
+import org.apache.fulcrum.security.torque.turbine.TorqueAbstractTurbineTurbineSecurityEntity;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+import org.apache.torque.om.SimpleKey;
+
+import ${package}.om.TurbineGroupPeer;
+import ${package}.om.TurbineUserGroupRolePeer;
+/**
+ * This abstract class provides the SecurityInterface to the managers.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public abstract class TorqueAbstractTurbineGroup extends TorqueAbstractTurbineTurbineSecurityEntity
+    implements TurbineGroup
+{
+    /** Serial version */
+	private static final long serialVersionUID = -6230312046016785990L;
+
+    /**
+     * Forward reference to generated code
+     *
+     * Get a list of association objects, pre-populated with their TurbineRole
+     * objects.
+     *
+     * @param criteria Criteria to define the selection of records
+     * @param con a database connection
+     * @throws TorqueException
+     *
+     * @return a list of User/Group/Role relations
+     */
+    protected List<${package}.om.TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria, Connection con)
+        throws TorqueException
+    {
+        criteria.and(TurbineUserGroupRolePeer.GROUP_ID, getEntityId() );
+        return TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria, con);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#getDatabaseName()
+     */
+    @Override
+	public String getDatabaseName()
+    {
+        return TurbineGroupPeer.DATABASE_NAME;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#retrieveAttachedObjects(java.sql.Connection)
+     */
+    @Override
+	public void retrieveAttachedObjects(Connection con) throws TorqueException
+    {
+        Set<TurbineUserGroupRole> userGroupRoleSet = new HashSet<TurbineUserGroupRole>();
+
+        List<${package}.om.TurbineUserGroupRole> ugrs = getTurbineUserGroupRolesJoinTurbineRole(new Criteria(), con);
+
+        for (${package}.om.TurbineUserGroupRole ttugr : ugrs)
+        {
+            TurbineUserGroupRole ugr = new TurbineUserGroupRole();
+            ugr.setGroup(this);
+            ugr.setRole(ttugr.getTurbineRole());
+            ugr.setUser(ttugr.getTurbineUser(con));
+            userGroupRoleSet.add(ugr);
+        }
+
+        setUserGroupRoleSet(userGroupRoleSet);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#update(java.sql.Connection)
+     */
+    @Override
+	public void update(Connection con) throws TorqueException
+    {
+    	Set<TurbineUserGroupRole> userGroupRoleSet = getUserGroupRoleSet();
+        if (userGroupRoleSet != null)
+        {
+            Criteria criteria = new Criteria();
+
+            /* remove old entries */
+            criteria.where(TurbineUserGroupRolePeer.GROUP_ID, getEntityId());
+            TurbineUserGroupRolePeer.doDelete(criteria, con);
+
+            for (TurbineUserGroupRole ugr : userGroupRoleSet)
+            {
+            	TorqueTurbineUserGroupRole ttugr = new TorqueTurbineUserGroupRole();
+                ttugr.setGroupId((Integer)ugr.getGroup().getId());
+                ttugr.setUserId((Integer)ugr.getUser().getId());
+                ttugr.setRoleId((Integer)ugr.getRole().getId());
+                ttugr.save(con);
+            }
+        }
+
+        try
+        {
+            save(con);
+        }
+        catch (Exception e)
+        {
+            throw new TorqueException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#delete()
+     */
+    @Override
+	public void delete() throws TorqueException
+    {
+        TurbineGroupPeer.doDelete(SimpleKey.keyFor(getEntityId()));
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbinePermission.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbinePermission.java
new file mode 100644
index 0000000..0a0a032
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbinePermission.java
@@ -0,0 +1,207 @@
+package ${package}.fulcrum.security.torque.turbine;
+/*
+ * 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.
+ */
+import java.sql.Connection;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.fulcrum.security.entity.Role;
+import org.apache.fulcrum.security.model.turbine.entity.TurbinePermission;
+import org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity;
+import org.apache.fulcrum.security.torque.om.TorqueTurbineRolePermission;
+import org.apache.fulcrum.security.util.RoleSet;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+import org.apache.torque.om.SimpleKey;
+
+import ${package}.om.TurbinePermissionPeer;
+import ${package}.om.TurbineRolePermission;
+import ${package}.om.TurbineRolePermissionPeer;
+/**
+ * This abstract class provides the SecurityInterface to the managers.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public abstract class TorqueAbstractTurbinePermission extends TorqueAbstractSecurityEntity
+    implements TurbinePermission
+{
+    /** Serial version */
+	private static final long serialVersionUID = -5313324873688923207L;
+
+	/** a cache of role objects */
+    private Set<Role> roleSet = null;
+
+    /**
+     * Forward reference to generated code
+     *
+     * Get a list of association objects, pre-populated with their TorqueTurbineRole
+     * objects.
+     *
+     * @param criteria Criteria to define the selection of records
+     * @param con a database connection
+     * @throws TorqueException
+     *
+     * @return a list of Role/Permission relations
+     */
+    protected List<TurbineRolePermission> getTurbineRolePermissionsJoinTurbineRole(Criteria criteria, Connection con)
+        throws TorqueException
+    {
+        criteria.and(TurbineRolePermissionPeer.PERMISSION_ID, getEntityId() );
+        return TurbineRolePermissionPeer.doSelectJoinTurbineRole(criteria, con);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbinePermission#addRole(org.apache.fulcrum.security.entity.Role)
+     */
+    @Override
+	public void addRole(Role role)
+    {
+        getRoles().add(role);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbinePermission#getRoles()
+     */
+    @Override
+	public RoleSet getRoles()
+    {
+        if (roleSet == null)
+        {
+            roleSet = new RoleSet();
+        }
+        else if(!(roleSet instanceof RoleSet))
+        {
+            roleSet = new RoleSet(roleSet);
+        }
+
+        return (RoleSet)roleSet;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbinePermission#getRolesAsSet()
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	public <T extends Role> Set<T> getRolesAsSet()
+    {
+        return (Set<T>)roleSet;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbinePermission#removeRole(org.apache.fulcrum.security.entity.Role)
+     */
+    @Override
+	public void removeRole(Role role)
+    {
+        getRoles().remove(role);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbinePermission#setRoles(org.apache.fulcrum.security.util.RoleSet)
+     */
+    @Override
+	public void setRoles(RoleSet roleSet)
+    {
+        if (roleSet != null)
+        {
+            this.roleSet = roleSet;
+        }
+        else
+        {
+            this.roleSet = new RoleSet();
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbinePermission#setRolesAsSet(java.util.Set)
+     */
+    @Override
+	public <T extends Role> void setRolesAsSet(Set<T> roles)
+    {
+        setRoles(new RoleSet(roles));
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#getDatabaseName()
+     */
+    @Override
+	public String getDatabaseName()
+    {
+        return TurbinePermissionPeer.DATABASE_NAME;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#retrieveAttachedObjects(java.sql.Connection)
+     */
+    @Override
+	public void retrieveAttachedObjects(Connection con) throws TorqueException
+    {
+        this.roleSet = new RoleSet();
+
+        List<TurbineRolePermission> rolepermissions = getTurbineRolePermissionsJoinTurbineRole(new Criteria(), con);
+
+        for (TurbineRolePermission ttrp : rolepermissions)
+        {
+            roleSet.add(ttrp.getTurbineRole());
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#update(java.sql.Connection)
+     */
+    @Override
+	public void update(Connection con) throws TorqueException
+    {
+        if (roleSet != null)
+        {
+            Criteria criteria = new Criteria();
+
+            /* remove old entries */
+            criteria.where(TurbineRolePermissionPeer.PERMISSION_ID, getEntityId());
+            TurbineRolePermissionPeer.doDelete(criteria, con);
+
+            for (Role r : roleSet)
+            {
+                TorqueTurbineRolePermission rp = new TorqueTurbineRolePermission();
+                rp.setRoleId((Integer)r.getId());
+                rp.setPermissionId(getEntityId());
+                rp.save(con);
+            }
+        }
+
+        try
+        {
+            save(con);
+        }
+        catch (Exception e)
+        {
+            throw new TorqueException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#delete()
+     */
+    @Override
+	public void delete() throws TorqueException
+    {
+        TurbinePermissionPeer.doDelete(SimpleKey.keyFor(getEntityId()));
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineRole.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineRole.java
new file mode 100644
index 0000000..7f04c42
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineRole.java
@@ -0,0 +1,264 @@
+package ${package}.fulcrum.security.torque.turbine;
+/*
+ * 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.
+ */
+import java.sql.Connection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.fulcrum.security.entity.Permission;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineRole;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
+import org.apache.fulcrum.security.torque.om.TorqueTurbineRolePermission;
+import org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole;
+import org.apache.fulcrum.security.torque.turbine.TorqueAbstractTurbineTurbineSecurityEntity;
+import org.apache.fulcrum.security.util.PermissionSet;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+import org.apache.torque.om.SimpleKey;
+
+import ${package}.om.TurbineRolePeer;
+import ${package}.om.TurbineRolePermission;
+import ${package}.om.TurbineRolePermissionPeer;
+import ${package}.om.TurbineUserGroupRolePeer;
+/**
+ * This abstract class provides the SecurityInterface to the managers.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public abstract class TorqueAbstractTurbineRole extends TorqueAbstractTurbineTurbineSecurityEntity
+    implements TurbineRole
+{
+    /** Serial version */
+	private static final long serialVersionUID = -1782236723198646728L;
+
+	/** a cache of permission objects */
+    private Set<Permission> permissionSet = null;
+
+    /**
+     * Forward reference to generated code
+     *
+     * Get a list of association objects, pre-populated with their TorqueTurbinePermission
+     * objects.
+     *
+     * @param criteria Criteria to define the selection of records
+     * @param con a database connection
+     * @throws TorqueException
+     *
+     * @return a list of Role/Permission relations
+     */
+    protected List<TurbineRolePermission> getTurbineRolePermissionsJoinTurbinePermission(Criteria criteria, Connection con)
+        throws TorqueException
+    {
+        criteria.and(TurbineRolePermissionPeer.ROLE_ID, getEntityId() );
+        return TurbineRolePermissionPeer.doSelectJoinTurbinePermission(criteria, con);
+    }
+
+    /**
+     * Forward reference to generated code
+     *
+     * Get a list of association objects, pre-populated with their TurbineGroup
+     * objects.
+     *
+     * @param criteria Criteria to define the selection of records
+     * @param con a database connection
+     * @throws TorqueException
+     *
+     * @return a list of User/Group/Role relations
+     */
+    protected List<${package}.om.TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineGroup(Criteria criteria, Connection con)
+        throws TorqueException
+    {
+        criteria.and(TurbineUserGroupRolePeer.ROLE_ID, getEntityId() );
+        return TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria, con);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbineRole#addPermission(org.apache.fulcrum.security.entity.Permission)
+     */
+    @Override
+	public void addPermission(Permission permission)
+    {
+        getPermissions().add(permission);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbineRole#getPermissions()
+     */
+    @Override
+	public PermissionSet getPermissions()
+    {
+        if (permissionSet == null)
+        {
+            permissionSet = new PermissionSet();
+        }
+        else if(!(permissionSet instanceof PermissionSet))
+        {
+            permissionSet = new PermissionSet(permissionSet);
+        }
+
+        return (PermissionSet)permissionSet;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbineRole#getPermissionsAsSet()
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	public <T extends Permission> Set<T> getPermissionsAsSet()
+    {
+        return (Set<T>)permissionSet;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbineRole#removePermission(org.apache.fulcrum.security.entity.Permission)
+     */
+    @Override
+	public void removePermission(Permission permission)
+    {
+        getPermissions().remove(permission);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbineRole#setPermissions(org.apache.fulcrum.security.util.PermissionSet)
+     */
+    @Override
+	public void setPermissions(PermissionSet permissionSet)
+    {
+        if (permissionSet != null)
+        {
+            this.permissionSet = permissionSet;
+        }
+        else
+        {
+            this.permissionSet = new PermissionSet();
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.model.turbine.entity.TurbineRole#setPermissionsAsSet(java.util.Set)
+     */
+    @Override
+	public <T extends Permission> void setPermissionsAsSet(Set<T> permissions)
+    {
+        setPermissions(new PermissionSet(permissions));
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#getDatabaseName()
+     */
+    @Override
+	public String getDatabaseName()
+    {
+        return TurbineRolePeer.DATABASE_NAME;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#retrieveAttachedObjects(java.sql.Connection)
+     */
+    @Override
+	public void retrieveAttachedObjects(Connection con) throws TorqueException
+    {
+        this.permissionSet = new PermissionSet();
+
+        List<TurbineRolePermission> rolepermissions = getTurbineRolePermissionsJoinTurbinePermission(new Criteria(), con);
+
+        for (TurbineRolePermission ttrp : rolepermissions)
+        {
+            permissionSet.add(ttrp.getTurbinePermission());
+        }
+
+        Set<TurbineUserGroupRole> userGroupRoleSet = new HashSet<TurbineUserGroupRole>();
+
+        List<${package}.om.TurbineUserGroupRole> ugrs = getTurbineUserGroupRolesJoinTurbineGroup(new Criteria(), con);
+
+        for (${package}.om.TurbineUserGroupRole ttugr : ugrs)
+        {
+            TurbineUserGroupRole ugr = new TurbineUserGroupRole();
+            ugr.setRole(this);
+            ugr.setGroup(ttugr.getTurbineGroup());
+            ugr.setUser(ttugr.getTurbineUser(con));
+            userGroupRoleSet.add(ugr);
+        }
+
+        setUserGroupRoleSet(userGroupRoleSet);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#update(java.sql.Connection)
+     */
+    @Override
+	public void update(Connection con) throws TorqueException
+    {
+        if (permissionSet != null)
+        {
+            Criteria criteria = new Criteria();
+
+            /* remove old entries */
+            criteria.where(TurbineRolePermissionPeer.ROLE_ID, getEntityId());
+            TurbineRolePermissionPeer.doDelete(criteria, con);
+
+            for (Permission p : permissionSet)
+            {
+            	TorqueTurbineRolePermission rp = new TorqueTurbineRolePermission();
+                rp.setPermissionId((Integer)p.getId());
+                rp.setRoleId(getEntityId());
+                rp.save(con);
+            }
+        }
+
+    	Set<TurbineUserGroupRole> userGroupRoleSet = getUserGroupRoleSet();
+        if (userGroupRoleSet != null)
+        {
+            Criteria criteria = new Criteria();
+
+            /* remove old entries */
+            criteria.where(TurbineUserGroupRolePeer.ROLE_ID, getEntityId());
+            TurbineUserGroupRolePeer.doDelete(criteria, con);
+
+            for (TurbineUserGroupRole ugr : userGroupRoleSet)
+            {
+                TorqueTurbineUserGroupRole ttugr = new TorqueTurbineUserGroupRole();
+                ttugr.setGroupId((Integer)ugr.getGroup().getId());
+                ttugr.setUserId((Integer)ugr.getUser().getId());
+                ttugr.setRoleId((Integer)ugr.getRole().getId());
+                ttugr.save(con);
+            }
+        }
+
+        try
+        {
+            save(con);
+        }
+        catch (Exception e)
+        {
+            throw new TorqueException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#delete()
+     */
+    @Override
+	public void delete() throws TorqueException
+    {
+        TurbineRolePeer.doDelete(SimpleKey.keyFor(getEntityId()));
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineUser.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineUser.java
new file mode 100644
index 0000000..b080de1
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueAbstractTurbineUser.java
@@ -0,0 +1,139 @@
+package ${package}.fulcrum.security.torque.turbine;
+#*
+* 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.
+*#
+import java.sql.Connection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUser;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
+import org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole;
+import org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRolePeer;
+import org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer;
+import org.apache.fulcrum.security.torque.turbine.TorqueAbstractTurbineTurbineSecurityEntity;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+import org.apache.torque.om.SimpleKey;
+/**
+ * This abstract class provides the SecurityInterface to the managers.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public abstract class TorqueAbstractTurbineUser extends TorqueAbstractTurbineTurbineSecurityEntity
+    implements TurbineUser
+{
+    /** Serial version */
+	private static final long serialVersionUID = -7255623655281852566L;
+
+    /**
+     * Forward reference to generated code
+     *
+     * Get a list of association objects, pre-populated with their TorqueTurbineRole
+     * objects.
+     *
+     * @param criteria Criteria to define the selection of records
+     * @param con a database connection
+     * @throws TorqueException
+     *
+     * @return a list of User/Group/Role relations
+     */
+    protected List<TorqueTurbineUserGroupRole> getTorqueTurbineUserGroupRolesJoinTorqueTurbineRole(Criteria criteria, Connection con)
+        throws TorqueException
+    {
+        criteria.and(TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId() );
+        return TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineRole(criteria, con);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#getDatabaseName()
+     */
+    @Override
+	public String getDatabaseName()
+    {
+        return TorqueTurbineUserPeer.DATABASE_NAME;
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#retrieveAttachedObjects(java.sql.Connection)
+     */
+    @Override
+	public void retrieveAttachedObjects(Connection con) throws TorqueException
+    {
+        Set<TurbineUserGroupRole> userGroupRoleSet = new HashSet<TurbineUserGroupRole>();
+
+        List<TorqueTurbineUserGroupRole> ugrs = getTorqueTurbineUserGroupRolesJoinTorqueTurbineRole(new Criteria(), con);
+
+        for (TorqueTurbineUserGroupRole ttugr : ugrs)
+        {
+            TurbineUserGroupRole ugr = new TurbineUserGroupRole();
+            ugr.setUser(this);
+            ugr.setRole(ttugr.getTorqueTurbineRole());
+            ugr.setGroup(ttugr.getTorqueTurbineGroup(con));
+            userGroupRoleSet.add(ugr);
+        }
+
+        setUserGroupRoleSet(userGroupRoleSet);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#update(java.sql.Connection)
+     */
+    @Override
+	public void update(Connection con) throws TorqueException
+    {
+    	Set<TurbineUserGroupRole> userGroupRoleSet = getUserGroupRoleSet();
+        if (userGroupRoleSet != null)
+        {
+            Criteria criteria = new Criteria();
+
+            /* remove old entries */
+            criteria.where(TorqueTurbineUserGroupRolePeer.USER_ID, getEntityId());
+            TorqueTurbineUserGroupRolePeer.doDelete(criteria, con);
+
+            for (TurbineUserGroupRole ugr : userGroupRoleSet)
+            {
+                TorqueTurbineUserGroupRole ttugr = new TorqueTurbineUserGroupRole();
+                ttugr.setGroupId((Integer)ugr.getGroup().getId());
+                ttugr.setUserId((Integer)ugr.getUser().getId());
+                ttugr.setRoleId((Integer)ugr.getRole().getId());
+                ttugr.save(con);
+            }
+        }
+
+        try
+        {
+            save(con);
+        }
+        catch (Exception e)
+        {
+            throw new TorqueException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#delete()
+     */
+    @Override
+	public void delete() throws TorqueException
+    {
+        TorqueTurbineUserPeer.doDelete(SimpleKey.keyFor(getEntityId()));
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineGroupManagerImpl.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineGroupManagerImpl.java
new file mode 100644
index 0000000..1826e0d
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineGroupManagerImpl.java
@@ -0,0 +1,144 @@
+package ${package}.fulcrum.security.torque.turbine;
+#*
+* 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.
+*#
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.fulcrum.security.entity.Group;
+import org.apache.fulcrum.security.torque.TorqueAbstractGroupManager;
+import org.apache.fulcrum.security.torque.peer.Peer;
+import org.apache.fulcrum.security.torque.peer.PeerManagable;
+import org.apache.fulcrum.security.torque.peer.PeerManager;
+import org.apache.fulcrum.security.torque.peer.TorqueTurbinePeer;
+import org.apache.fulcrum.security.util.DataBackendException;
+import org.apache.torque.NoRowsException;
+import org.apache.torque.TooManyRowsException;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+
+import ${package}.om.TurbineGroupPeer;
+/**
+ * This implementation persists to a database via Torque.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public class TorqueTurbineGroupManagerImpl extends TorqueAbstractGroupManager implements PeerManagable
+{
+    
+    PeerManager peerManager;
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractGroupManager#doSelectAllGroups(java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends Group> List<T> doSelectAllGroups(Connection con) throws TorqueException
+    {
+        Criteria criteria = new Criteria(TurbineGroupPeer.DATABASE_NAME);
+        
+        if ( (getCustomPeer())) {
+            try
+            {
+                return ((TorqueTurbinePeer<T>)getPeerInstance()).doSelect( criteria, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            return (List<T>) TurbineGroupPeer.doSelect(criteria, con);
+        }
+
+
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractGroupManager#doSelectById(java.lang.Integer, java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends Group> T doSelectById(Integer id, Connection con) throws NoRowsException, TooManyRowsException, TorqueException
+    {
+        if ( (getCustomPeer())) {
+            try
+            {
+                return ((TorqueTurbinePeer<T>) getPeerInstance()).retrieveByPK( id, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            return  (T)  TurbineGroupPeer.retrieveByPK(id, con);
+        }
+
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractGroupManager#doSelectByName(java.lang.String, java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends Group> T doSelectByName(String name, Connection con) throws NoRowsException, TooManyRowsException, TorqueException
+    {
+        Criteria criteria = new Criteria(TurbineGroupPeer.DATABASE_NAME);
+        criteria.where(TurbineGroupPeer.GROUP_NAME, name);
+        criteria.setIgnoreCase(true);
+        criteria.setSingleRecord(true);
+        List<T> groups = null;
+        
+        if ( (getCustomPeer())) {
+            try
+            {
+                
+                groups = ((TorqueTurbinePeer<T>) getPeerInstance()).doSelect( criteria, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            groups = (List<T>) TurbineGroupPeer.doSelect(criteria, con);
+        }
+
+        if (groups.isEmpty())
+        {
+            throw new NoRowsException(name);
+        }
+
+        return groups.get(0);
+    }
+    
+    public Peer getPeerInstance() throws DataBackendException {
+        return getPeerManager().getPeerInstance(getPeerClassName(), TorqueTurbinePeer.class, getClassName());
+    }
+    
+    /**
+     * @return Returns the persistenceHelper.
+     */
+    @Override
+	public PeerManager getPeerManager()
+    {
+        if (peerManager == null)
+        {
+            peerManager = (PeerManager) resolve(PeerManager.ROLE);
+        }
+        return peerManager;
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineRoleManagerImpl.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineRoleManagerImpl.java
new file mode 100644
index 0000000..80816f9
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineRoleManagerImpl.java
@@ -0,0 +1,140 @@
+package ${package}.fulcrum.security.torque.turbine;
+#*
+* 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.
+*#
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.fulcrum.security.entity.Role;
+import org.apache.fulcrum.security.torque.TorqueAbstractRoleManager;
+import org.apache.fulcrum.security.torque.peer.Peer;
+import org.apache.fulcrum.security.torque.peer.PeerManagable;
+import org.apache.fulcrum.security.torque.peer.PeerManager;
+import org.apache.fulcrum.security.torque.peer.TorqueTurbinePeer;
+import org.apache.fulcrum.security.util.DataBackendException;
+import org.apache.torque.NoRowsException;
+import org.apache.torque.TooManyRowsException;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+
+import ${package}.om.TurbineRolePeer;
+/**
+ * This implementation persists to a database via Torque.
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id:$
+ */
+public class TorqueTurbineRoleManagerImpl extends TorqueAbstractRoleManager implements PeerManagable
+{
+    PeerManager peerManager;
+    
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractRoleManager#doSelectAllRoles(java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends Role> List<T> doSelectAllRoles(Connection con) throws TorqueException
+    {
+        Criteria criteria = new Criteria(TurbineRolePeer.DATABASE_NAME);
+
+        if ( (getCustomPeer())) {
+            try
+            {
+                return ((TorqueTurbinePeer<T>) getPeerInstance()).doSelect( criteria, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            return (List<T>) TurbineRolePeer.doSelect(criteria, con);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractRoleManager#doSelectById(java.lang.Integer, java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends Role> T doSelectById(Integer id, Connection con) throws NoRowsException, TooManyRowsException, TorqueException
+    {
+        if ( (getCustomPeer())) {
+            try
+            {
+                return ((TorqueTurbinePeer<T>) getPeerInstance()).retrieveByPK( id, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            return  (T)  TurbineRolePeer.retrieveByPK(id, con);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractRoleManager#doSelectByName(java.lang.String, java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends Role> T doSelectByName(String name, Connection con) throws NoRowsException, TooManyRowsException, TorqueException
+    {
+        Criteria criteria = new Criteria(TurbineRolePeer.DATABASE_NAME);
+        criteria.where(TurbineRolePeer.ROLE_NAME, name);
+        criteria.setIgnoreCase(true);
+        criteria.setSingleRecord(true);
+        
+        List<T> roles = null;
+        if ( (getCustomPeer())) {
+            try
+            {
+                roles = ((TorqueTurbinePeer<T>)getPeerInstance()).doSelect( criteria, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            roles =  (List<T>) TurbineRolePeer.doSelect(criteria, con);
+        }
+
+        if (roles.isEmpty())
+        {
+            throw new NoRowsException(name);
+        }
+
+        return roles.get(0);
+    }
+    
+    public Peer getPeerInstance() throws DataBackendException {
+        return getPeerManager().getPeerInstance(getPeerClassName(), TorqueTurbinePeer.class, getClassName());
+    }
+    
+    /**
+     * @return Returns the persistenceHelper.
+     */
+    @Override
+	public PeerManager getPeerManager()
+    {
+        if (peerManager == null)
+        {
+            peerManager = (PeerManager) resolve(PeerManager.ROLE);
+        }
+        return peerManager;
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineUserManagerImpl.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineUserManagerImpl.java
new file mode 100644
index 0000000..7b42d23
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/fulcrum/security/torque/turbine/TorqueTurbineUserManagerImpl.java
@@ -0,0 +1,200 @@
+package ${package}.fulcrum.security.torque.turbine;
+#*
+* 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.
+*#
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.fulcrum.security.entity.User;
+import org.apache.fulcrum.security.model.turbine.TurbineUserManager;
+
+import ${package}.fulcrum.security.torque.TorqueAbstractUserManager;
+
+import org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer;
+import org.apache.fulcrum.security.torque.peer.Peer;
+import org.apache.fulcrum.security.torque.peer.PeerManagable;
+import org.apache.fulcrum.security.torque.peer.PeerManager;
+import org.apache.fulcrum.security.torque.peer.TorqueTurbinePeer;
+import org.apache.fulcrum.security.util.DataBackendException;
+import org.apache.fulcrum.security.util.UnknownEntityException;
+import org.apache.torque.NoRowsException;
+import org.apache.torque.TooManyRowsException;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+
+import ${package}.om.TurbineUserPeer;
+import ${package}.om.TurbineUserPeerImpl;
+
+/**
+ * This implementation persists to a database via Torque.
+ * 
+ *
+ * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
+ * @version $Id$
+ */
+public class TorqueTurbineUserManagerImpl extends TorqueAbstractUserManager implements TurbineUserManager, PeerManagable
+{
+    PeerManager peerManager;
+    private static final String ANON = "anon";
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractUserManager#doSelectAllUsers(java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends User> List<T> doSelectAllUsers(Connection con) throws TorqueException
+    {
+        Criteria criteria = new Criteria();
+        
+        if ( (getCustomPeer())) {
+            try
+            {
+                return ((TorqueTurbinePeer<T>) getPeerInstance()).doSelect( criteria, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            return (List<T>) TorqueTurbineUserPeer.doSelect(criteria, con);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractUserManager#doSelectById(java.lang.Integer, java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends User> T doSelectById(Integer id, Connection con) throws NoRowsException, TooManyRowsException, TorqueException
+    {
+        if ( (getCustomPeer())) {
+            try
+            {
+                return ((TorqueTurbinePeer<T>) getPeerInstance()).retrieveByPK( id, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            return  (T)  TorqueTurbineUserPeer.retrieveByPK(id, con);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractUserManager#doSelectByName(java.lang.String, java.sql.Connection)
+     */
+    @Override
+	@SuppressWarnings("unchecked")
+	protected <T extends User> T doSelectByName(String name, Connection con) throws NoRowsException, TooManyRowsException, TorqueException
+    {
+        Criteria criteria = new Criteria();
+        criteria.setIgnoreCase(true);
+        //criteria.setSingleRecord(true);
+        
+        List<T> users = null;
+        if ( (getCustomPeer())) {
+            try
+            {
+              System.out.println("criteria dbname is "+  criteria.getDbName());
+              TorqueTurbinePeer<T> peerInstance = (TorqueTurbinePeer<T>)getPeerInstance();
+              criteria.where( 
+            		TurbineUserPeer.LOGIN_NAME,
+                  name);
+              System.out.println("peerInstance is "+  peerInstance);
+              System.out.println("databae is "+  ((TurbineUserPeerImpl)peerInstance).getDatabaseName());
+
+              System.out.println("checkuser is "+  criteria.toString());
+              users = peerInstance.doSelect( criteria, con );
+            }
+            catch ( DataBackendException e )
+            {
+                throw new TorqueException( e );
+            }
+        } else {
+            //users = (List<T>) TorqueTurbineUserPeer.doSelect(criteria, con);
+        }
+
+         System.out.println("users is "+  users);
+
+        if (users.isEmpty())
+        {
+            throw new NoRowsException(name);
+        }
+
+        System.out.println("user is "+  users.get(0));
+        return users.get(0);
+    }
+
+    /**
+     * Default implementation.
+     */
+    @Override
+    public <T extends User> T getAnonymousUser()
+        throws UnknownEntityException
+    {
+        try
+        {
+            T anonUser =  getUser( ANON );
+            // add more, if needed
+            return anonUser;
+        }
+        catch ( DataBackendException e )
+        {
+            throw new UnknownEntityException( "Failed to load anonymous user",e);
+        } 
+    }
+
+    /**
+     * Default implementation.
+     */
+    @Override
+    public boolean isAnonymousUser( User u )
+    {
+        try
+        {
+            User anon = getAnonymousUser();
+            if (u.equals( anon )) 
+                {
+                 return true;
+                }
+        }
+        catch ( Exception e )
+        {
+            getLogger().error( "Failed to check user:" + e.getMessage(),e);
+        }
+        return false;
+    }
+    
+    public Peer getPeerInstance() throws DataBackendException {
+        return getPeerManager().getPeerInstance(getPeerClassName(), TorqueTurbinePeer.class, getClassName());
+    }
+    
+    /**
+     * @return Returns the persistenceHelper.
+     */
+    @Override
+    public PeerManager getPeerManager()
+    {
+        if (peerManager == null)
+        {
+            peerManager = (PeerManager) resolve(PeerManager.ROLE);
+        }
+        return peerManager;
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ChangePasswordAction.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ChangePasswordAction.java
new file mode 100644
index 0000000..c8f4d1b
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/ChangePasswordAction.java
@@ -0,0 +1,95 @@
+package ${package}.modules.actions;
+
+#*
+* 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.
+*#
+
+
+import org.apache.fulcrum.security.util.PasswordMismatchException;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+
+/**
+ * Change Password action.
+ *
+ */
+public class ChangePasswordAction extends SecureAction 
+
+{
+	
+    /** Injected service instance */
+    @TurbineService
+    private SecurityService security;
+	
+	
+	/**
+	 * Implement this to add information to the context.
+	 *
+	 * @param data
+	 *            Turbine information.
+	 * @param context
+	 *            Context for web pages.
+	 * @exception Exception,
+	 *                a generic exception.
+	 */
+    @Override
+    public void doPerform(PipelineData data)
+            throws Exception 
+            {
+
+		User user = getRunData(data).getUser();
+		
+    RunData rundata = getRunData(data);
+    String oldPassword = rundata.getParameters().getString("oldpassword", "");
+    String newPassword = rundata.getParameters().getString("newpassword", "");
+		
+    try {
+        security.changePassword(user, oldPassword, newPassword); 
+        rundata.setMessage("Password changed!");
+    }
+    catch (PasswordMismatchException e) 
+    {
+      rundata.setMessage(e.getMessage());
+      rundata.setScreenTemplate("Password.vm");
+    }
+		
+    
+	}
+    
+	/**
+	 * Implement this to add information to the context.
+	 *
+	 * @param data
+	 *            Turbine information.
+	 * @param context
+	 *            Context for web pages.
+	 * @exception Exception,
+	 *                a generic exception.
+	 */
+	@Override
+	public void doPerform(PipelineData data, Context context) throws Exception 
+	{
+
+		context.put("success", "Password changed!!");
+	}
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUser.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUser.java
new file mode 100644
index 0000000..3018954
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUser.java
@@ -0,0 +1,114 @@
+package ${package}.modules.actions;
+
+#*
+* 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.
+*#
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fulcrum.security.util.FulcrumSecurityException;
+import org.apache.fulcrum.security.util.UnknownEntityException;
+import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineConfiguration;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.RunData;
+
+/**
+ * This is where we authenticate the user logging into the system
+ * against a user in the database. If the user exists in the database
+ * that users last login time will be updated.
+ *
+ * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
+ * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
+ * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
+ * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
+ * @version $Id: LoginUser.java 1725011 2016-01-16 17:38:47Z tv $
+ */
+public class LoginUser
+        extends org.apache.turbine.modules.actions.LoginUser
+{
+
+    /** Logging */
+    private static Log log = LogFactory.getLog(LoginUser.class);
+
+    /** Injected service instance */
+    @TurbineService
+    private SecurityService security;
+    
+    /** Injected configuration instance */
+    @TurbineConfiguration
+    private Configuration conf;
+
+
+
+    /**
+     * Checks for anonymous user, else calls parent method.
+     *
+     * @param     pipelineData Turbine information.
+     * @exception FulcrumSecurityException could not get instance of the
+     *            anonymous user
+     */
+    @Override
+    public void doPerform(PipelineData pipelineData)
+            throws FulcrumSecurityException
+    {
+        RunData data = getRunData(pipelineData);
+        String username = data.getParameters().getString(LoginUser.CGI_USERNAME, "");
+
+        if (StringUtils.isEmpty(username))
+        {
+            return;
+        }
+
+    	if (username.equals(security.getAnonymousUser().getName()))
+        {
+            data.setMessage("Anonymous user cannot login");
+            reset(data);
+            return;
+        }
+    	
+       super.doPerform(pipelineData);
+
+    }
+
+
+
+	private void reset(RunData data) throws UnknownEntityException {
+		User anonymousUser = security.getAnonymousUser();
+		data.setUser(anonymousUser);
+
+		if (StringUtils.isNotEmpty(conf.getString(TurbineConstants.TEMPLATE_LOGIN,"")))
+		{
+		    // We're running in a templating solution
+		    data.setScreenTemplate(
+		    		conf.getString(TurbineConstants.TEMPLATE_LOGIN));
+		}
+		else
+		{
+		    data.setScreen(
+		    		conf.getString(TurbineConstants.SCREEN_LOGIN));
+		}
+	}
+
+}
+
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
new file mode 100644
index 0000000..272d47b
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LoginUserIntake.java
@@ -0,0 +1,183 @@
+package ${package}.modules.actions;
+
+#*
+* 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.
+*#
+
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fulcrum.security.util.DataBackendException;
+import org.apache.fulcrum.security.util.FulcrumSecurityException;
+import org.apache.fulcrum.security.util.UnknownEntityException;
+import org.apache.fulcrum.intake.model.Group;
+import org.apache.fulcrum.intake.IntakeException;
+import org.apache.turbine.services.intake.IntakeTool;
+import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineConfiguration;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.modules.Action;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.RunData;
+
+/**
+ * This is where we authenticate the user logging into the system
+ * against a user in the database. If the user exists in the database
+ * that users last login time will be updated.
+ *
+ * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
+ * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
+ * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
+ * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
+ * @version $Id$
+ */
+public class LoginUserIntake
+        extends org.apache.turbine.modules.actions.LoginUser
+{
+
+    /** Logging */
+    private static Log log = LogFactory.getLog(LoginUserIntake.class);
+
+    /** Injected service instance */
+    @TurbineService
+    private SecurityService security;
+    
+    /** Injected configuration instance */
+    @TurbineConfiguration
+    private Configuration conf;
+
+
+
+    /**
+     * Checks for anonymous user, else calls parent method.
+     *
+     * @param     pipelineData Turbine information.
+     * @exception FulcrumSecurityException could not get instance of the
+     *            anonymous user
+     */
+    @Override
+    public void doPerform(PipelineData pipelineData)
+            throws FulcrumSecurityException
+    {
+        RunData data = getRunData(pipelineData);
+        	
+       try
+        {
+          // Get intake group
+          IntakeTool intake =  new IntakeTool();//(IntakeTool)context.get("intake");
+          intake.init(data);
+          Group group = intake.get("Login", IntakeTool.DEFAULT_KEY);
+          String username = (String)group.get("Username").getValue();
+          if (StringUtils.isEmpty(username))
+            {
+                return;
+            }
+
+          if (username.equals(security.getAnonymousUser().getName()))
+            {
+                data.setMessage("Anonymous user cannot login");
+                reset(data);
+                return;
+            }
+            
+        	if (username.equals(security.getAnonymousUser().getName()))
+            {
+                throw new Exception("Anonymous user cannot login");
+            }
+        	
+            String password = (String)group.get("Password").getValue();
+            // Authenticate the user and get the object.
+            User user = security.getAuthenticatedUser(username, password);
+
+            // Store the user object.
+            data.setUser(user);
+
+            // Mark the user as being logged in.
+            user.setHasLoggedIn(Boolean.TRUE);
+
+            // Set the last_login date in the database.
+            user.updateLastLogin();
+
+            // This only happens if the user is valid; otherwise, we
+            // will get a valueBound in the User object when we don't
+            // want to because the username is not set yet.  Save the
+            // User object into the session.
+            data.save();
+
+            /*
+             * If the setPage("template.vm") method has not
+             * been used in the template to authenticate the
+             * user (usually Login.vm), then the user will
+             * be forwarded to the template that is specified
+             * by the "template.home" property as listed in
+             * TR.props for the webapp.
+             */
+
+        }
+        catch (Exception e)
+        {
+            if (e instanceof DataBackendException || e instanceof IntakeException)
+            {
+                log.error(e);
+            }
+
+            // Set Error Message and clean out the user.
+            data.setMessage(conf.getString(TurbineConstants.LOGIN_ERROR, ""));
+            User anonymousUser = security.getAnonymousUser();
+            data.setUser(anonymousUser);
+            
+            String loginTemplate = conf.getString(
+                    TurbineConstants.TEMPLATE_LOGIN);
+
+            if (StringUtils.isNotEmpty(loginTemplate))
+            {
+                // We're running in a templating solution
+                data.setScreenTemplate(loginTemplate);
+            }
+            else
+            {
+                data.setScreen(conf.getString(TurbineConstants.SCREEN_LOGIN));
+            }
+        }
+    }
+
+
+
+	private void reset(RunData data) throws UnknownEntityException {
+		User anonymousUser = security.getAnonymousUser();
+		data.setUser(anonymousUser);
+
+		if (StringUtils.isNotEmpty(conf.getString(TurbineConstants.TEMPLATE_LOGIN,"")))
+		{
+		    // We're running in a templating solution
+		    data.setScreenTemplate(
+		    		conf.getString(TurbineConstants.TEMPLATE_LOGIN));
+		}
+		else
+		{
+		    data.setScreen(
+		    		conf.getString(TurbineConstants.SCREEN_LOGIN));
+		}
+	}
+
+}
+
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LogoutUser.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LogoutUser.java
new file mode 100644
index 0000000..2fea6dd
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/LogoutUser.java
@@ -0,0 +1,121 @@
+package ${package}.modules.actions;
+
+#*
+* 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.
+*#
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.fulcrum.security.util.FulcrumSecurityException;
+import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineConfiguration;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.modules.Action;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.RunData;
+
+/**
+ * This action removes a user from the session. It makes sure to save
+ * the User object in the session.
+ *
+ * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
+ * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
+ * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
+ * @version $Id: LogoutUser.java 1706239 2015-10-01 13:18:35Z tv $
+ */
+public class LogoutUser
+        extends Action
+{
+    /** Injected service instance */
+    @TurbineService
+    private SecurityService security;
+
+    /** Injected configuration instance */
+    @TurbineConfiguration
+    private Configuration conf;
+
+    /**
+     * Clears the PipelineData user object back to an anonymous status not
+     * logged in, and with a null ACL.  If the tr.props ACTION_LOGIN
+     * is anything except "LogoutUser", flow is transfered to the
+     * SCREEN_HOMEPAGE
+     *
+     * If this action name is the value of action.logout then we are
+     * being run before the session validator, so we don't need to
+     * set the screen (we assume that the session validator will handle
+     * that). This is basically still here simply to preserve old behaviour
+     * - it is recommended that action.logout is set to "LogoutUser" and
+     * that the session validator does handle setting the screen/template
+     * for a logged out (read not-logged-in) user.
+     *
+     * @param pipelineData Turbine information.
+     * @exception FulcrumSecurityException a problem occurred in the security
+     *            service.
+     */
+    @Override
+    public void doPerform(PipelineData pipelineData)
+            throws FulcrumSecurityException
+    {
+        RunData data = getRunData(pipelineData);
+        // Session validator did not run, so RunData is not populated
+        User user = data.getUserFromSession();
+
+        if (user != null && !security.isAnonymousUser(user))
+        {
+            // Make sure that the user has really logged in...
+            if (!user.hasLoggedIn())
+            {
+                return;
+            }
+
+            user.setHasLoggedIn(Boolean.FALSE);
+            security.saveUser(user);
+        }
+
+        data.setMessage(conf.getString(TurbineConstants.LOGOUT_MESSAGE));
+
+        // This will cause the acl to be removed from the session in
+        // the Turbine servlet code.
+        data.setACL(null);
+
+        // Retrieve an anonymous user.
+        User anonymousUser = security.getAnonymousUser();
+        data.setUser(anonymousUser);
+        data.save();
+
+        // In the event that the current screen or related navigations
+        // require acl info, we cannot wait for Turbine to handle
+        // regenerating acl.
+        data.getSession().removeAttribute(TurbineConstants.ACL_SESSION_KEY);
+
+        // If this action name is the value of action.logout then we are
+        // being run before the session validator, so we don't need to
+        // set the screen (we assume that the session validator will handle
+        // that). This is basically still here simply to preserve old behavior
+        // - it is recommended that action.logout is set to "LogoutUser" and
+        // that the session validator does handle setting the screen/template
+        // for a logged out (read not-logged-in) user.
+        if (!conf.getString(TurbineConstants.ACTION_LOGOUT_KEY,
+                            TurbineConstants.ACTION_LOGOUT_DEFAULT)
+            .equals(TurbineConstants.ACTION_LOGOUT_DEFAULT))
+        {
+            data.setScreen(conf.getString(TurbineConstants.SCREEN_HOMEPAGE));
+        }
+    }
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
new file mode 100644
index 0000000..f612181
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/actions/SecureAction.java
@@ -0,0 +1,85 @@
+package ${package}.modules.actions;
+
+#*
+* 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.
+*#
+
+import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
+import org.apache.turbine.modules.actions.VelocitySecureAction;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.velocity.context.Context;
+
+/**
+ * Velocity Secure action.
+ *
+ * Always performs a Security Check that you've defined before executing the
+ * doPerform().
+ */
+public class SecureAction extends VelocitySecureAction 
+{
+	/**
+	 * This currently only checks to make sure that user is allowed to view the
+	 * storage area. If you create an action that requires more security then
+	 * override this method.
+	 *
+	 * @param data
+	 *            Turbine information.
+	 * @return True if the user is authorized to access the screen.
+	 * @exception Exception,
+	 *                a generic exception.
+	 */
+	@Override
+	protected boolean isAuthorized(PipelineData data) throws Exception 
+	{
+		boolean isAuthorized = false;
+
+		// Who is our current user?
+		User user = getRunData(data).getUser();
+
+		// Get the Turbine ACL implementation
+		TurbineAccessControlList acl = getRunData(data).getACL();
+
+		if (acl == null || ! ( acl.hasRole("turbineuser") || acl.hasRole("turbineadmin") ) ) 
+		{
+			getRunData(data).setMessage("You do not have permission to access this action");
+			isAuthorized = false;
+		} 
+		else if ( acl.hasRole("turbineuser") || acl.hasRole("turbineadmin") )
+		{
+			isAuthorized = true;
+		}
+
+		return isAuthorized;
+	}
+
+	/**
+	 * Implement this to add information to the context.
+	 *
+	 * @param data
+	 *            Turbine information.
+	 * @param context
+	 *            Context for web pages.
+	 * @exception Exception,
+	 *                a generic exception.
+	 */
+	public void doPerform(PipelineData data, Context context) throws Exception 
+	{
+
+	}
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java
new file mode 100644
index 0000000..4990038
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Index.java
@@ -0,0 +1,63 @@
+package ${package}.modules.screens;

+#*

+ * 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.

+*#

+

+import org.apache.turbine.pipeline.PipelineData;

+import org.apache.velocity.context.Context;

+import org.apache.turbine.modules.screens.VelocitySecureScreen;

+

+/**

+ * This class provides the data required for displaying content in the

+ * Velocity page. 

+ */

+public class Index extends VelocitySecureScreen

+{

+	/**

+	 * This method is called by the Turbine framework when the

+	 * associated Velocity template, Index.vm is requested

+	 * 

+	 * @param data the Turbine request data

+	 * @param context the Velocity context

+	 * @throws Exception a generic Exception

+	 */

+	@Override

+	protected void doBuildTemplate(PipelineData data, Context context)

+			throws Exception

+	{

+		context.put("success", "Congratulations, it worked!");

+	}

+

+	/**

+	 * This method is called bythe Turbine framework to determine if

+	 * the current user is allowed to use this screen. If this method

+	 * returns false, the doBuildTemplate() method will not be called.

+	 * If a redirect to some "access denied" page is required, do the

+	 * necessary redirect here.

+	 * 

+	 * @param data the Turbine request data

+	 * @return true if this screen may be accessed

+	 * @throws Exception a generic Exception

+	 */

+	@Override

+	protected boolean isAuthorized(PipelineData data) throws Exception

+	{

+		// use data.getACL() 

+		return true;

+	}

+}

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Password.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Password.java
new file mode 100644
index 0000000..9028874
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/Password.java
@@ -0,0 +1,54 @@
+package ${package}.modules.screens;
+
+#*
+* 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.
+*#
+
+import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
+import org.apache.turbine.Turbine;
+import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineConfiguration;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.modules.screens.VelocitySecureScreen;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.velocity.context.Context;
+import org.apache.commons.configuration.Configuration;
+
+/**
+ * This class provides a sample extending a secured screen
+ */
+public class Password extends SecureScreen 
+{
+
+	/**
+	 * This method is called by the Turbine framework when the
+	 * associated Velocity template, Index.vm is requested
+	 * 
+	 * @param data the Turbine request data
+	 * @param context the Velocity context
+	 * @throws Exception a generic Exception
+	 */
+	@Override
+	protected void doBuildTemplate(PipelineData data, Context context)
+			throws Exception
+	{
+		
+	}
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
new file mode 100644
index 0000000..74a4b49
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/SecureScreen.java
@@ -0,0 +1,93 @@
+package ${package}.modules.screens;
+#*
+* 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.
+*#
+
+
+import org.apache.fulcrum.security.model.turbine.TurbineAccessControlList;
+import org.apache.turbine.Turbine;
+import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineConfiguration;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.modules.screens.VelocitySecureScreen;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.velocity.context.Context;
+import org.apache.commons.configuration.Configuration;
+
+/**
+ * This class provides a sample implementation for creating a secured screen
+ */
+public class SecureScreen extends VelocitySecureScreen 
+{
+	@TurbineService
+	protected SecurityService securityService;
+	
+  @TurbineConfiguration( TurbineConstants.TEMPLATE_LOGIN )
+  private Configuration templateLogin;
+
+  @TurbineConfiguration( TurbineConstants.TEMPLATE_HOMEPAGE )
+  private Configuration templateHomepage;
+
+	@Override
+	protected boolean isAuthorized(PipelineData data) throws Exception 
+	{
+		boolean isAuthorized = false;
+
+		// Who is our current user?
+		User user = getRunData(data).getUser();
+
+		// Get the Turbine ACL implementation
+		TurbineAccessControlList acl = getRunData(data).getACL();
+
+		if (acl == null)
+		{
+      // commons configuration getProperty: prefix removed, the key for the value .. is an empty string, the result an object
+			getRunData(data).setScreenTemplate( (String) templateLogin.getProperty("") );
+			isAuthorized = false;
+		} 
+		else if (acl.hasRole("turbineuser") || acl.hasRole("turbineadmin"))
+		{
+			isAuthorized = true;
+		}
+		else 
+		{
+			getRunData(data).setScreenTemplate( (String) templateHomepage.getProperty("") );
+			getRunData(data).setMessage("You do not have access to this part of the site.");
+			isAuthorized = false;
+		}
+		return isAuthorized;
+	}
+
+    /**
+     * Implement this to add information to the context.
+     *
+     * @param data
+     *            Turbine information.
+     * @param context
+     *            Context for web pages.
+     * @exception Exception,
+     *                a generic exception.
+     */
+	@Override
+	protected void doBuildTemplate(PipelineData data, Context context) throws Exception 
+	{
+
+	}
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java
new file mode 100644
index 0000000..d82f6ba
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/modules/screens/TestSecure.java
@@ -0,0 +1,48 @@
+package ${package}.modules.screens;
+#*
+* 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.
+*#
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.torque.criteria.Criteria;
+import org.apache.turbine.pipeline.PipelineData;
+import org.apache.velocity.context.Context;
+
+/**
+ * This class provides the data required for displaying content in the
+ * Velocity page. 
+ */
+public class TestSecure extends SecureScreen
+{
+	/**
+	 * This method is called by the Turbine framework when the
+	 * associated Velocity template, Index.vm is requested
+	 * 
+	 * @param data the Turbine request data
+	 * @param context the Velocity context
+	 * @throws Exception a generic Exception
+	 */
+	@Override
+	protected void doBuildTemplate(PipelineData data, Context context)
+			throws Exception
+	{
+		context.put("success", "Congratulations, it worked!");
+	}
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroup.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroup.java
new file mode 100644
index 0000000..eadb5eb
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroup.java
@@ -0,0 +1,89 @@
+package ${package}.om;
+
+import org.apache.torque.TorqueException;
+
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+/**
+ * Added Interface and default implementations 
+ * @author gk
+ *
+ */
+public  class TurbineGroup
+    extends ${package}.om.BaseTurbineGroup implements org.apache.fulcrum.security.entity.Group, org.apache.fulcrum.security.model.turbine.entity.TurbineGroup
+{
+    /** Serial version */
+    private static final long serialVersionUID = 1477403437121L;
+
+    /**
+     * Get the value of id.
+     *
+     * @return Object
+     */
+    @Override
+	public Object getId() 
+    {
+        
+        return getGroupId();
+    }
+
+    /**
+     * Set the value of id.
+     *
+     * @param v new value
+     */
+    @Override
+	public void setId(Object v)
+    {
+        setGroupId( (Integer)v);
+
+    }
+    
+        /**
+     * Get the value of name.
+     *
+     * @return String
+     */
+    @Override
+	public String getName() 
+    {
+        
+        return getEntityName();
+    }
+
+    /**
+     * Set the value of name.
+     *
+     * @param v new value
+     */
+    @Override
+	public void setName(String v)
+    {
+        setEntityName(v);
+    }
+    
+	@Override
+	public Integer getEntityId() {
+		return getGroupId();
+	}
+
+	@Override
+	public void setEntityId(Integer id) throws TorqueException {
+		setGroupId(id);
+	}
+
+    @Override
+    public String getDatabaseName()
+    {
+      return "default";
+    }
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroupPeer.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroupPeer.java
new file mode 100644
index 0000000..d54dcf1
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroupPeer.java
@@ -0,0 +1,21 @@
+package ${package}.om;
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * This class provides static wrappers for the peer implementation classes.
+ * This class will only be generated as long as it does not already exist
+ * in the output directory.
+ */
+/**
+ * Added Interface
+ * @author gk
+ *
+ */
+public class TurbineGroupPeer
+    extends ${package}.om.BaseTurbineGroupPeer implements org.apache.fulcrum.security.torque.peer.Peer
+{
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroupPeerImpl.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroupPeerImpl.java
new file mode 100644
index 0000000..94c681d
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineGroupPeerImpl.java
@@ -0,0 +1,25 @@
+package ${package}.om;
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:38 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+/**
+ * Added Interface
+ * @author gk
+ *
+ */
+public class TurbineGroupPeerImpl
+    extends ${package}.om.BaseTurbineGroupPeerImpl implements org.apache.fulcrum.security.torque.peer.TorqueTurbinePeer<TurbineGroup>
+{
+    /** Serial version */
+    private static final long serialVersionUID = 1477403438057L;
+
+
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbinePermission.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbinePermission.java
new file mode 100644
index 0000000..6a38306
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbinePermission.java
@@ -0,0 +1,60 @@
+package ${package}.om;
+
+import org.apache.torque.TorqueException;
+
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+/**
+ * Added Interface and default implementations 
+ * @author gk
+ *
+ */
+public  class TurbinePermission
+    extends ${package}.om.BaseTurbinePermission implements org.apache.fulcrum.security.entity.Permission, org.apache.fulcrum.security.model.turbine.entity.TurbinePermission
+{
+    /** Serial version */
+    private static final long serialVersionUID = 1477403437105L;
+
+	@Override
+	public Integer getEntityId() {
+		return getPermissionId();
+	}
+
+	@Override
+	public void setEntityId(Integer id) throws TorqueException {
+		setPermissionId(id);
+	}
+
+	 /**
+     * Get the value of name.
+     *
+     * @return String
+     */
+    @Override
+	public String getName() 
+    {
+        
+        return getEntityName();
+    }
+
+    /**
+     * Set the value of name.
+     *
+     * @param v new value
+     */
+    @Override
+	public void setName(String v)
+    {
+        setEntityName(v);
+
+    }
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRole.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRole.java
new file mode 100644
index 0000000..aee193e
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRole.java
@@ -0,0 +1,99 @@
+package ${package}.om;
+
+import java.sql.Connection;
+import java.util.Set;
+
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
+import org.apache.torque.TorqueException;
+import org.apache.torque.om.SimpleKey;
+
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+/**
+ * Added Interface and default implementations 
+ * @author gk
+ *
+ */
+public  class TurbineRole
+    extends ${package}.om.BaseTurbineRole implements org.apache.fulcrum.security.entity.Role, org.apache.fulcrum.security.model.turbine.entity.TurbineRole
+{
+    /** Serial version */
+    private static final long serialVersionUID = 1477403437121L;
+
+    
+    /**
+     * Get the value of name.
+     *
+     * @return String
+     */
+    @Override
+	public String getName() 
+    {
+        
+        return getEntityName();
+    }
+
+    /**
+     * Set the value of name.
+     *
+     * @param v new value
+     */
+    @Override
+	public void setName(String v)
+    {
+        setEntityName(v);
+
+    }
+
+	@Override
+	public Integer getEntityId() {
+		return getRoleId();
+	}
+
+	@Override
+	public void setEntityId(Integer id) throws TorqueException {
+		setRoleId(id);
+	}
+
+	/**
+	 * @TODO
+	 */
+	@Override
+	public void update(Connection con) throws TorqueException {
+    	Set<TurbineUserGroupRole> userGroupRoleSet = getUserGroupRoleSet();
+        if (userGroupRoleSet != null)
+        {
+
+
+        }
+
+        try
+        {
+            save(con);
+        }
+        catch (Exception e)
+        {
+            throw new TorqueException(e);
+        }
+	}
+
+	@Override
+	public String getDatabaseName() {
+		return "default";
+	}
+
+	@Override
+	public void delete() throws TorqueException {
+		TurbineRolePeer.doDelete(SimpleKey.keyFor(getEntityId()));
+		
+	}
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePeer.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePeer.java
new file mode 100644
index 0000000..739597f
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePeer.java
@@ -0,0 +1,21 @@
+package ${package}.om;
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * This class provides static wrappers for the peer implementation classes.
+ * This class will only be generated as long as it does not already exist
+ * in the output directory.
+ */
+/**
+ * Added Interface
+ * @author gk
+ *
+ */
+public class TurbineRolePeer
+    extends ${package}.om.BaseTurbineRolePeer implements org.apache.fulcrum.security.torque.peer.Peer
+{
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePeerImpl.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePeerImpl.java
new file mode 100644
index 0000000..91d307f
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePeerImpl.java
@@ -0,0 +1,27 @@
+package ${package}.om;
+
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:38 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+/**
+ * Added Interface
+ * @author gk
+ *
+ */
+public class TurbineRolePeerImpl
+    extends ${package}.om.BaseTurbineRolePeerImpl implements org.apache.fulcrum.security.torque.peer.TorqueTurbinePeer<TurbineRole>
+{
+    /** Serial version */
+    private static final long serialVersionUID = 1477403438057L;
+
+
+
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePermission.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePermission.java
new file mode 100644
index 0000000..a26f32e
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineRolePermission.java
@@ -0,0 +1,25 @@
+package ${package}.om;
+
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+
+public  class TurbineRolePermission
+    extends ${package}.om.BaseTurbineRolePermission
+{
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+
+
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUser.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUser.java
new file mode 100644
index 0000000..8caa282
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUser.java
@@ -0,0 +1,149 @@
+package ${package}.om;
+
+import java.sql.Connection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.Criteria;
+import org.apache.torque.om.SimpleKey;
+
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+/**
+ * Added Interface
+ * @author gk
+ *
+ */
+public  class TurbineUser
+    extends ${package}.om.BaseTurbineUser implements org.apache.fulcrum.security.model.turbine.entity.TurbineUser
+{
+    /** Serial version */
+    private static final long serialVersionUID = 1477403437136L;
+    
+   /**
+     * Get the value of id.
+     *
+     * @return Object
+     */
+    @Override
+	public Object getId() 
+    {
+        
+        return getEntityId();
+    }
+
+    /**
+     * Set the value of id.
+     *
+     * @param v new value
+     */
+    @Override
+	public void setId(Object v)
+    {
+        setEntityId( (Integer) v);
+
+    }
+    
+        /**
+     * Get the value of name.
+     *
+     * @return String
+     */
+    @Override
+	public String getName() 
+    {
+        
+        return getEntityName();
+    }
+
+    /**
+     * Set the value of name.
+     *
+     * @param v new value
+     */
+    @Override
+	public void setName(String v)
+    {
+        setEntityName(v);
+
+    }
+    
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#getDatabaseName()
+     */
+    @Override
+    public String getDatabaseName()
+    {
+      return "default";
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#retrieveAttachedObjects(java.sql.Connection)
+     */
+    @Override
+	public void retrieveAttachedObjects(Connection con) throws TorqueException
+    {
+        Set<TurbineUserGroupRole> userGroupRoleSet = new HashSet<TurbineUserGroupRole>();
+
+        List<${package}.om.TurbineUserGroupRole> ugrs = getTurbineUserGroupRolesJoinTurbineUser(new Criteria(), con);
+
+        for (${package}.om.TurbineUserGroupRole ttugr : ugrs)
+        {
+            TurbineUserGroupRole ugr = new TurbineUserGroupRole();
+            ugr.setUser(this);
+            ugr.setRole(ttugr.getTurbineRole());
+            ugr.setGroup(ttugr.getTurbineGroup(con));
+            userGroupRoleSet.add(ugr);
+        }
+
+        setUserGroupRoleSet(userGroupRoleSet);
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#update(java.sql.Connection)
+     * 
+     * @TODO
+     */
+    @Override
+	public void update(Connection con) throws TorqueException
+    {
+    	Set<TurbineUserGroupRole> userGroupRoleSet = getUserGroupRoleSet();
+        if (userGroupRoleSet != null)
+        {
+
+
+        }
+
+        try
+        {
+            save(con);
+        }
+        catch (Exception e)
+        {
+            throw new TorqueException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity#delete()
+     */
+    @Override
+	public void delete() throws TorqueException
+    {
+        TurbineUserPeer.doDelete(SimpleKey.keyFor(getEntityId()));
+    }
+
+
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUserPeer.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUserPeer.java
new file mode 100644
index 0000000..4c330e2
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUserPeer.java
@@ -0,0 +1,22 @@
+package ${package}.om;
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:37 CEST 2016]
+ *
+ * This class provides static wrappers for the peer implementation classes.
+ * This class will only be generated as long as it does not already exist
+ * in the output directory.
+ */
+/**
+ * Added Interface
+ * @author gk
+ *
+ */
+
+public class TurbineUserPeer
+    extends ${package}.om.BaseTurbineUserPeer implements org.apache.fulcrum.security.torque.peer.Peer
+{
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUserPeerImpl.java b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUserPeerImpl.java
new file mode 100644
index 0000000..38d7984
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/java/om/TurbineUserPeerImpl.java
@@ -0,0 +1,25 @@
+package ${package}.om;
+
+
+/**
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [Tue Oct 25 15:50:38 CEST 2016]
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements.  This class will only be generated as
+ * long as it does not already exist in the output directory.
+ */
+
+/**
+ * Added Interface
+ * @author gk
+ *
+ */
+public class TurbineUserPeerImpl
+    extends ${package}.om.BaseTurbineUserPeerImpl implements org.apache.fulcrum.security.torque.peer.TorqueTurbinePeer<TurbineUser>
+{
+    /** Serial version */
+    private static final long serialVersionUID = 1477403438057L;
+
+}
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-data.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-data.xml
new file mode 100644
index 0000000..eeef5cd
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-data.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

+#*

+ 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.

+*#

+<!DOCTYPE dataset SYSTEM "file://application-data.dtd">

+

+<!-- =============================================================================== -->

+<!--                                                                                 -->

+<!-- Application Data in XML. Add your custom values to this file                    -->

+<!--                                                                                 -->

+<!-- @version $Id: application-data.xml 615328 2008-01-25 20:25:05Z tv $ -->

+<!--                                                                                 -->

+<!-- =============================================================================== -->

+

+<dataset name="all"/>

+

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml
new file mode 100644
index 0000000..8e867d5
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

+<!--

+ 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.

+-->

+

+<!-- ============================================================================== -->

+<!--                                                                                -->

+<!--  Database Definition for the Application                                       -->

+<!--                                                                                -->

+<!--  @version $Id: application-schema.xml                                          -->

+<!--                                                                                -->

+<!-- ============================================================================== -->

+

+<database xmlns="http://db.apache.org/torque/4.0/templates/database"

+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+  xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database

+        http://db.apache.org/torque/4.0/templates/database-strict.xsd"

+  name="${turbine_database_name}"

+  defaultIdMethod="native">

+

+

+	<!--  Simple author/book database example -->

+	<table name="AUTHOR" idMethod="idbroker">

+		<column name="AUTH_ID"     required="true" primaryKey="true" type="INTEGER" />

+		<column name="FIRST_NAME"  required="true" size="64" type="VARCHAR" />

+		<column name="LAST_NAME"   required="true" size="64" type="VARCHAR" />

+	</table>

+

+    <table name="BOOK" idMethod="idbroker">

+		<column name="BOOK_ID"     required="true" primaryKey="true" type="INTEGER" />

+		<column name="AUTH_ID"     required="true" type="INTEGER" />

+		<column name="TITLE"       required="true" size="64" type="VARCHAR" />

+		<column name="SUBJECT"     required="true" size="64" type="VARCHAR" />

+		<foreign-key foreignTable="AUTHOR">

+			<reference local="AUTH_ID" foreign="AUTH_ID"></reference>

+		</foreign-key>		

+	</table>

+</database>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml
new file mode 100644
index 0000000..5002f21
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

+<!--

+ 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.

+-->

+

+<!-- ========================================================================= -->

+<!--                                                                           -->

+<!-- Table definition for the ID Broker Table used by Torque                   -->

+<!--                                                                           -->

+<!-- @version $Id: id-table-schema.xml 615328 2008-01-25 20:25:05Z tv $ -->

+<!--                                                                           -->

+<!-- ========================================================================= -->

+

+<database xmlns="http://db.apache.org/torque/4.0/templates/database"

+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+  xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database

+        http://db.apache.org/torque/4.0/templates/database-strict.xsd"

+  name="${turbine_database_name}"

+  defaultIdMethod="native">

+

+  <table name="ID_TABLE" idMethod="idbroker">

+    <column name="ID_TABLE_ID" required="true" primaryKey="true" type="INTEGER" javaName="IdTableId"/>

+    <column name="TABLE_NAME" required="true" size="255" type="VARCHAR" javaName="TableName"/>

+    <column name="NEXT_ID" required="true" type="INTEGER" javaName="NextId"/>

+    <column name="QUANTITY" required="true" type="INTEGER" javaName="Quantity"/>

+

+    <unique>

+      <unique-column name="TABLE_NAME"/>

+    </unique>

+

+  </table>

+</database>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-data.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-data.xml
new file mode 100644
index 0000000..8503f8f
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-data.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

+#*

+ 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.

+*#

+<!DOCTYPE dataset SYSTEM "file://torque-security-data.dtd">

+

+<!-- =============================================================================== -->

+<!--                                                                                 -->

+<!-- Default Values for Admin and normal User                                        -->

+<!--                                                                                 -->

+<!-- @version $Id: turbine-security-data.xml 615328 2008-01-25 20:25:05Z tv $ -->

+<!--                                                                                 -->

+<!-- =============================================================================== -->

+

+<dataset name="all">

+

+  <TurbineUser UserId="1"

+               UserName="admin"

+               Password="password"

+               FirstName=""

+               LastName="Admin"/>

+

+  <TurbineUser UserId="2"

+               UserName="user"

+               Password="password"

+               FirstName=""

+               LastName="User"/>

+

+  <!-- Turbine Permissions -->

+

+  <TurbinePermission PermissionId="1" Name="turbineadmin"/>

+  <TurbinePermission PermissionId="2" Name="turbine"/>

+

+  <!-- Turbine Roles -->

+

+  <TurbineRole RoleId="1" Name="turbineadmin"/>

+  <TurbineRole RoleId="2" Name="turbineuser"/>

+

+ <!-- Turbine Groups -->

+

+  <TurbineGroup GroupId="1" Name="global"/>

+  <TurbineGroup GroupId="2" Name="Turbine"/>

+

+  <TurbineRolePermission RoleId="1" PermissionId="1"/>

+  <TurbineRolePermission RoleId="2" PermissionId="2"/>

+

+  <!-- Associate Users, Groups, and Roles -->

+

+  <TurbineUserGroupRole UserId="1" GroupId="2" RoleId="1"/>

+  <TurbineUserGroupRole UserId="2" GroupId="2" RoleId="2"/>

+

+</dataset>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml
new file mode 100644
index 0000000..84cbd6b
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

+<!--

+ 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.

+-->

+

+

+<!-- ======================================================================== -->

+<!--                                                                          -->

+<!--  Turbine Torque based Security Service Schema                            -->

+<!--                                                                          -->

+<!-- $Id: turbine-security-schema.xml 615328 2008-01-25 20:25:05Z tv $ -->

+<!--                                                                          -->

+<!-- ======================================================================== -->

+

+<database xmlns="http://db.apache.org/torque/4.0/templates/database"

+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+  xsi:schemaLocation="http://db.apache.org/torque/4.0/templates/database

+        http://db.apache.org/torque/4.0/templates/database-strict.xsd"

+  name="${turbine_database_name}"

+  defaultIdMethod="idbroker">

+

+

+  <table name="TURBINE_PERMISSION" idMethod="idbroker" baseClass="${package}.fulcrum.security.torque.turbine.TorqueAbstractTurbinePermission">

+    <column name="PERMISSION_ID" required="true" primaryKey="true" type="INTEGER" javaType="object"/>

+    <column name="PERMISSION_NAME" required="true" size="64" type="VARCHAR" javaName="EntityName"/>

+

+    <unique>

+      <unique-column name="PERMISSION_NAME"/>

+    </unique>

+

+  </table>

+

+  <table name="TURBINE_ROLE" idMethod="idbroker" baseClass="${package}.fulcrum.security.torque.turbine.TorqueAbstractTurbineRole">

+    <column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER" javaType="object"/>

+    <column name="ROLE_NAME" required="true" size="64" type="VARCHAR" javaName="EntityName"/>

+

+    <unique>

+        <unique-column name="ROLE_NAME"/>

+    </unique>

+

+  </table>

+

+  <table name="TURBINE_GROUP" idMethod="idbroker" baseClass="${package}.fulcrum.security.torque.turbine.TorqueAbstractTurbineGroup">

+    <column name="GROUP_ID" required="true" primaryKey="true" type="INTEGER" javaType="object"/>

+    <column name="GROUP_NAME" required="true" type="VARCHAR" size="64" javaName="EntityName"/>

+

+    <unique>

+        <unique-column name="GROUP_NAME"/>

+    </unique>

+

+  </table>

+

+  <table name="TURBINE_ROLE_PERMISSION">

+    <column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>

+    <column name="PERMISSION_ID" required="true" primaryKey="true" type="INTEGER"/>

+

+    <foreign-key foreignTable="TURBINE_ROLE">

+      <reference local="ROLE_ID" foreign="ROLE_ID"/>

+    </foreign-key>

+

+    <foreign-key foreignTable="TURBINE_PERMISSION">

+      <reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>

+    </foreign-key>

+  </table>

+

+  <!-- org.apache.fulcrum.security.torque.TorqueAbstractSecurityEntity -->

+  <table name="TURBINE_USER" idMethod="idbroker" baseClass="org.apache.fulcrum.security.torque.turbine.TorqueAbstractTurbineTurbineSecurityEntity"

+  interface="org.apache.fulcrum.security.model.turbine.entity.TurbineUser">

+    <column name="USER_ID" required="true" primaryKey="true" type="INTEGER" javaType="object" javaName="EntityId"/>

+    <column name="LOGIN_NAME" required="true" size="64" type="VARCHAR" javaName="EntityName"/>

+    <column name="PASSWORD_VALUE" required="true" size="16" type="VARCHAR" javaName="Password"/>

+    <column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>

+    <column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>

+    <column name="EMAIL" size="64" type="VARCHAR"/>

+    <column name="CONFIRM_VALUE" size="16" type="VARCHAR" javaName="Confirmed"/>

+    <column name="MODIFIED_DATE" type="TIMESTAMP" javaName="ModifiedDate"/>

+    <column name="CREATED" type="TIMESTAMP" javaName="CreateDate"/>

+    <column name="LAST_LOGIN" type="TIMESTAMP"/>

+    <column name="OBJECTDATA" type="VARBINARY"/>

+

+    <unique>

+        <unique-column name="LOGIN_NAME"/>

+    </unique>

+

+  </table>

+

+  <table name="TURBINE_USER_GROUP_ROLE">

+    <column name="USER_ID" required="true" primaryKey="true" type="INTEGER"/>

+    <column name="GROUP_ID" required="true" primaryKey="true" type="INTEGER"/>

+    <column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>

+

+    <foreign-key foreignTable="TURBINE_USER">

+      <reference local="USER_ID" foreign="USER_ID"/>

+    </foreign-key>

+

+    <foreign-key foreignTable="TURBINE_GROUP">

+      <reference local="GROUP_ID" foreign="GROUP_ID"/>

+    </foreign-key>

+

+    <foreign-key foreignTable="TURBINE_ROLE">

+      <reference local="ROLE_ID" foreign="ROLE_ID"/>

+    </foreign-key>

+  </table>

+

+</database>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties
new file mode 100644
index 0000000..023ef76
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/Torque.properties
@@ -0,0 +1,126 @@
+#*
+# 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.
+*#
+# -------------------------------------------------------------------
+#
+# This is the configuration file for Torque.
+#
+# Note that strings containing "," (comma) characters must backslash
+# escape the comma (i.e. '\,')
+#
+# -------------------------------------------------------------------
+#
+#  T O R Q U E  P R O P E R T I E S
+#
+# -------------------------------------------------------------------
+# These are your database settings. Look in the
+# org.apache.torque.pool.* packages for more information.
+#
+# The parameters to connect to the default database.  You MUST
+# configure these properly.
+# -------------------------------------------------------------------
+
+
+
+#
+# For JNDI configuration please see: https://db.apache.org/torque/torque-4.0/documentation/orm-reference/initialisation-configuration.html
+# 
+#
+torque.dsfactory.${turbine_database_name}.factory=org.apache.torque.dsfactory.JndiDataSourceFactory
+torque.dsfactory.${turbine_database_name}.jndi.path=java:comp/env/${turbine_database_jndipath}
+torque.dsfactory.${turbine_database_name}.jndi.ttl=300000
+
+# -------------------------------------------------------------------
+#
+# Shared Pool Data Source Factory
+#
+# -------------------------------------------------------------------
+#torque.database.default=${turbine_database_name}
+torque.database.${turbine_database_name}.adapter=${turbine_database_adapter}
+
+#torque.database.${turbine_database_name}.user=${turbine_database_user}
+#torque.database.${turbine_database_name}.password=${turbine_database_password}
+#
+#torque.defaults.pool.maxActive =       	30
+#torque.defaults.pool.testOnBorrow =    	true
+#torque.defaults.pool.validationQuery = 	SELECT 1
+#
+#torque.defaults.connection.driver =    	${turbine_database_driver}
+#torque.defaults.connection.url =       	${turbine_database_url}${turbine_database_name}
+#torque.defaults.connection.user =      	${turbine_database_user}
+#torque.defaults.connection.password =  	${turbine_database_password}
+#
+#torque.dsfactory.${turbine_database_name}.connection.driver =    	${turbine_database_driver}
+#torque.dsfactory.${turbine_database_name}.connection.url =       	${turbine_database_url}${turbine_database_name}
+#torque.dsfactory.${turbine_database_name}.connection.user =      	${turbine_database_user}
+#torque.dsfactory.${turbine_database_name}.connection.password =  	${turbine_database_password}
+#torque.dsfactory.${turbine_database_name}.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory
+# -------------------------------------------------------------------
+
+# Determines if the quantity column of the IDBroker's id_table should
+# be increased automatically if requests for ids reaches a high
+# volume.
+
+torque.idbroker.cleverquantity=true
+
+# Determines whether the managers cache instances of the business objects.
+# And also whether the MethodResultCache will really cache results.
+torque.manager.useCache = true
+
+# Determines if IDBroker should prefetch IDs or not.  If set to false
+# this property has the effect of shutting off the housekeeping thread
+# that attempts to prefetch the id's.  It also sets the # of id's grabbed
+# per request to 1 regardless of the settings in the database.
+# Default: true
+torque.idbroker.prefetch = true
+
+# Controls the starting id of table entries when creating SQL for 
+# the id-table. If you have two projects that use the same id-table 
+# in the same database with different tables, make sure that they have 
+# different initialID settings and the ranges (initialID is incremented 
+# for every new table) don't overlap.
+torque.idbroker.initialId = 101 
+
+# The start value of the ID broker for supplying IDs to Torque. This value 
+# is incremented every time Torque requests ID keys from the broker. If you 
+# pre-load your table straight from SQL, make sure that you don't accidentially 
+# overlap with this setting, because Torque doesn't keep record of what IDs are 
+# already taken in the database. If you overlap, inserting new objects will fail 
+# because the ID assigned by Torque is already taken.
+torque.idBroker.initialIdValue = 100
+
+# For performance reasons, the ID Broker does not request a single ID at a time
+# but fetches a whole range and increments the current next ID Value in the ID
+# Table by this step. If you have to do lots of inserts straight in a row, increment
+# this value to get slightly better performance.
+torque.idbroker.initialIdStep = 500
+
+# IDBroker can grab its own connection from the pool to use when retrieving
+# more id's to minimize the amount of time ID_TABLE will be locked.
+# Some usage of IDBroker or assumptions made by connection pools or jdbc
+# drivers may disallow this optimization in which case the property
+# should be set to false.
+torque.idbroker.usenewconnection = true
+
+# Comment if not using shared data source factory
+torque.database.default=${turbine_database_name}
+
+
+
+
+
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineConfigurationBuilder.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineConfigurationBuilder.xml
new file mode 100644
index 0000000..4c6407e
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineConfigurationBuilder.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<configuration>
+   <header>
+    <!-- Meta data about the resulting combined configuration -->
+  </header>
+  <override><!-- only allowed configurations are user and turbine, realtive paths   -->
+    <properties config-name="user" fileName="WEB-INF/conf/usersettings.properties" config-optional="true" config-forceCreate="true"/> 
+    <!-- xml fileName="conf/test/TurbineResources.xml"/-->
+    <properties config-name="turbine" fileName="WEB-INF/conf/TurbineResources.properties" throwExceptionOnMissing="true"/>
+   </override>
+  <additional>
+    <!-- Configuration declarations that form a union configuration, always provide a unique config-name attribute  -->
+  </additional>
+</configuration>
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
new file mode 100644
index 0000000..e24decf
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
@@ -0,0 +1,652 @@
+#*
+# 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.
+*#
+# -------------------------------------------------------------------
+#
+# This is the configuration file for Turbine.
+#
+# Note that strings containing "," (comma) characters must backslash
+# escape the comma (i.e. '\,')
+#
+# -------------------------------------------------------------------
+
+# -------------------------------------------------------------------
+#
+#  P I P E L I N E
+#
+# -------------------------------------------------------------------
+pipeline.default.descriptor = WEB-INF/conf/turbine-classic-pipeline.xml
+
+# -------------------------------------------------------------------
+#
+#  L O G 4 J - L O G G I N G
+#
+# -------------------------------------------------------------------
+
+log4j.file = WEB-INF/conf/log4j.properties
+
+# -------------------------------------------------------------------
+#
+#  M A I L  S E R V E R
+#
+# -------------------------------------------------------------------
+# Your mail server for outgoing email.
+#
+# Default: null
+# -------------------------------------------------------------------
+
+mail.server=
+
+# -------------------------------------------------------------------
+# SMTP-From header for your outgoing messages
+#
+# All failed delivery messages will be returned to this address.
+# If unset, these messages will be sent to the address in the
+# From header (standard behaviour)
+#
+# Default: null
+# -------------------------------------------------------------------
+
+mail.smtp.from=
+
+# -------------------------------------------------------------------
+#
+#  S E R V E R   D A T A
+#
+# -------------------------------------------------------------------
+# Default ServerData that can be used if asked for before the first
+# request is made.
+#
+# Defaults:
+#
+# serverdata.default.serverName=
+# serverdata.default.serverPort=80
+# serverdata.default.serverScheme=http
+# serverdata.default.scriptName=
+# serverdata.default.contextPath=
+# -------------------------------------------------------------------
+
+serverdata.default.serverName=
+serverdata.default.serverPort=80
+serverdata.default.serverScheme=http
+serverdata.default.scriptName=
+serverdata.default.contextPath=
+
+# -------------------------------------------------------------------
+#
+#  M O D U L E  C A C H I N G
+#
+# -------------------------------------------------------------------
+# This determines whether or not to cache the modules in memory.  For
+# development, turn this off.  For production, turn this on.
+#
+# Default: false
+# -------------------------------------------------------------------
+
+module.cache=false
+
+# If module.cache=true, then how large should we make the hashtables
+# by default.
+
+action.cache.size=20
+layout.cache.size=10
+navigation.cache.size=10
+page.cache.size=5
+screen.cache.size=50
+scheduledjob.cache.size=10
+
+# -------------------------------------------------------------------
+#
+#  M O D U L E  P A C K A G E S
+#
+# -------------------------------------------------------------------
+# This is the "classpath" for Turbine.  In order to locate your own
+# modules, you should add them to this path.  For example, if you have
+# com.company.actions, com.company.screens, com.company.navigations,
+# then this setting would be "com.company,org.apache.turbine.modules".
+# This path is searched in order.  For example, Turbine comes with a
+# screen module named "Login".  If you wanted to have your own screen
+# module named "Login", then you would specify the path to your
+# modules before the others.
+#
+# Note: org.apache.turbine.modules will always be added to the search
+# path.  If it is not explicitly added here, it will be added to the
+# end.
+#
+# Default: org.apache.turbine.modules
+# -------------------------------------------------------------------
+
+module.packages=${package}.modules,org.apache.turbine.modules
+
+# -------------------------------------------------------------------
+#
+#  F R A M E W O R K  S E T T I N G S
+#
+# -------------------------------------------------------------------
+# These are settings that control the behavior of the framework,
+# such as determining whether a template system is in use, what
+# the default templates and screens are and session handling settings.
+# -------------------------------------------------------------------
+
+# Used to set the template homepage if you are using a template
+# layout.  This is the template that will be displayed to the user
+# when no specific template is requested.  This is normally executed
+# as the first template the user sees when they access the system.
+#
+# Default: Index.vm
+
+template.homepage=Index.vm
+
+# This is the default screen to show to people when they first access
+# the system.  This is only used if there is no value for
+# template.homepage.  This is for use when you are not using a
+# templating system such as Velocity or JSP.
+#
+# Default: Login
+
+screen.homepage=
+
+# This is the template that is shown on an incorrect login attempt.
+# Setting this property will override any value of screen.login specified
+# below.
+#
+# Default: Login.vm
+
+template.login=Login.vm
+
+# This is the page that is shown on an incorrect login attempt.  It is
+# referenced in the LoginUser action. This is only used if there is no value
+# for template.login.  This is for use when you are not using a
+# templating system such as Velocity or JSP.
+#
+# Default: Login
+
+screen.login=
+
+# This is the template that is used by the respective Template based
+# ErrorScreen for displaying the error. If you are not using a Template based
+# ErrorScreen, then this is ignored.
+#
+# Default: Error.vm
+
+template.error=Error.vm
+
+# This is the default error screen.
+#
+# Default: VelocityErrorScreen
+
+screen.error=VelocityErrorScreen
+
+# This is the screen that is displayed when the user's web page is in
+# an invalid state.
+#
+# Default: error.InvalidState
+
+screen.invalidstate=error.InvalidState
+
+# Set the components of the default Doctype for use in html documents.
+#
+# Defaults: There are no defaults - if default.html.doctype.root.element is not
+#           set then no default doctype will be available.
+
+default.html.doctype.root.element=HTML
+default.html.doctype.identifier=-//W3C//DTD HTML 4.01 Transitional//EN
+default.html.doctype.url=http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd
+
+# This is the default action to log a user in.  If you write your own
+# implementation of the login action, make sure that you change this
+# to reflect the new name.
+
+action.login=LoginUserIntake
+
+# This is the default action to log a user out. If you write your own
+# implementation of the logout action, make sure that you change this
+# to reflect the new name.
+
+action.logout=LogoutUser
+
+# This is the default action to validate whether or not a session is
+# valid.  For example, if you want to make sure if a user has already
+# logged in or not.
+#
+# Default: SessionValidator
+
+action.sessionvalidator=sessionvalidator.TemplateSessionValidator
+
+#
+# Use this setting if you want your application to display the Login Screen
+# as first action and does not allow any operation before the user has
+# logged in
+#
+# action.sessionvalidator=sessionvalidator.TemplateSecureSessionValidator
+
+# This is the timeout in seconds for sessions. If left commented out, the
+# servlet container's default timeout will be left as is.
+
+# session.timeout=1800
+
+# This is the default action that builds up the AccessControlList for
+# the individual users session.
+
+action.accesscontroller=AccessController
+
+#
+# Set this value to true if you want to be able to submit multiple
+# events to an Action by doing eventSubmit_do<action> and consider
+# only events that have a non-empty, non-zero value. This is useful
+# if you submit your form with JavaScript
+#
+action.eventsubmit.needsvalue = false
+
+# If the web container does not supply an explicit encoding for the
+# request data, assume that is has this encoding. If you use e.g.
+# UTF-8 or ISO-8859-<something>, change this parameter to keep your
+# special characters. Default is ISO-8859-1
+input.encoding=UTF-8
+
+
+# -------------------------------------------------------------------
+#
+#  J N D I  C O N T E X T S
+#
+# -------------------------------------------------------------------
+
+# This indicates whether Turbine should try to create JNDI contexts.
+#
+# Default: false
+#
+# contexts=true
+
+# These are the JNDI context properties.  Each context's properties
+# are defined by the properties beginning with context.name.
+#
+# Default: none
+#
+# Example: The following will create a JNDI context named "name" in
+# the data.contexts Hashtable.  It will point at the RMI registry on
+# localhost running on port 1099, and will use
+# com.sun.jndi.rmi.registry.RegistryContextFactory as the initial
+# context factory:
+#
+# context.name.java.naming.provider.url=rmi://localhost:1099
+# context.name.java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
+
+# -------------------------------------------------------------------
+#
+#  M E S S A G E S
+#
+# -------------------------------------------------------------------
+# Note that strings containing "," (comma) characters must backslash
+# escape the comma (i.e. '\,')
+
+# The message that can be displayed before a user logs in.
+
+login.message=Thank you for your visit. Please log into the system.
+
+# The message that can be displayed when no screen is defined.
+
+login.message.noscreen=There has been an error. Your session is valid but the screen variable is not defined.
+
+# The message that can be displayed when a user enters an incorrect
+# password or username.
+
+login.error=Sorry your username or password is incorrect!
+
+# The message that can be displayed when a user logs out.
+
+logout.message=Thank you for using the system. Please come back soon.
+
+# -------------------------------------------------------------------
+#
+#  S E C U R E  S O C K E T S  L A Y E R
+#
+# -------------------------------------------------------------------
+# Whether the web server is able to use SSL.  Links in Turbine can
+# check this property to determine if SSL can be used.
+#
+# Default: true
+# -------------------------------------------------------------------
+
+use.ssl=true
+
+# -------------------------------------------------------------------
+#
+#  S E R V I C E S
+#
+# -------------------------------------------------------------------
+# Classes for Turbine Services should be defined here.
+# Format: services.[name].classname=[implementing class]
+#
+# To specify properties of a service use the following syntax:
+# service.[name].[property]=[value]
+#
+# The order that these services is listed is important! The
+# order that is stated here is the order in which the services
+# will be initialized. Keep this is mind if you have services
+# that depend on other services during initialization.
+# -------------------------------------------------------------------
+services.AvalonComponentService.classname=org.apache.turbine.services.avaloncomponent.TurbineYaafiComponentService
+
+services.RunDataService.classname=org.apache.turbine.services.rundata.TurbineRunDataService
+services.ServletService.classname=org.apache.turbine.services.servlet.TurbineServletService
+services.AssemblerBrokerService.classname=org.apache.turbine.services.assemblerbroker.TurbineAssemblerBrokerService
+services.PullService.classname=org.apache.turbine.services.pull.TurbinePullService
+services.TemplateService.classname=org.apache.turbine.services.template.TurbineTemplateService
+services.UIService.classname = org.apache.turbine.services.ui.TurbineUIService
+services.VelocityService.classname=org.apache.turbine.services.velocity.TurbineVelocityService
+services.JsonRpcService.classname=org.apache.turbine.services.jsonrpc.TurbineJsonRpcService
+
+# -------------------------------------------------------------------
+#
+#  R U N   D A T A   S E R V I C E
+#
+# -------------------------------------------------------------------
+# Default implementations of base interfaces for request processing.
+# Additional configurations can be defined by using other keys
+# in the place of the <default> key.
+# -------------------------------------------------------------------
+
+services.RunDataService.default.run.data=org.apache.turbine.services.rundata.DefaultTurbineRunData
+services.RunDataService.default.parameter.parser=org.apache.fulcrum.parser.DefaultParameterParser
+services.RunDataService.default.cookie.parser=org.apache.fulcrum.parser.DefaultCookieParser
+
+# -------------------------------------------------------------------
+#
+#  A S S E M B L E R  B R O K E R  S E R V I C E
+#
+# -------------------------------------------------------------------
+# A list of AssemblerFactory classes that will be registered
+# with TurbineAssemblerBrokerService
+# -------------------------------------------------------------------
+
+services.AssemblerBrokerService.screen=org.apache.turbine.services.assemblerbroker.util.java.JavaScreenFactory
+services.AssemblerBrokerService.action=org.apache.turbine.services.assemblerbroker.util.java.JavaActionFactory
+services.AssemblerBrokerService.layout=org.apache.turbine.services.assemblerbroker.util.java.JavaLayoutFactory
+services.AssemblerBrokerService.page=org.apache.turbine.services.assemblerbroker.util.java.JavaPageFactory
+services.AssemblerBrokerService.navigation=org.apache.turbine.services.assemblerbroker.util.java.JavaNavigationFactory
+services.AssemblerBrokerService.scheduledjob=org.apache.turbine.services.assemblerbroker.util.java.JavaScheduledJobFactory
+
+# -------------------------------------------------------------------
+#
+#  T E M P L A T E  S E R V I C E
+#
+# -------------------------------------------------------------------
+
+# Roughly, the number of templates in each category.
+#
+# Defaults: layout=2, navigation=10, screen=50
+
+services.TemplateService.layout.cache.size=2
+services.TemplateService.navigation.cache.size=10
+services.TemplateService.screen.cache.size=50
+
+# -------------------------------------------------------------------
+#
+#  P U L L  S E R V I C E
+#
+# -------------------------------------------------------------------
+# These are the properties for the Pull Service, the service
+# that works in conjunction with the Turbine Pull Model API.
+# -------------------------------------------------------------------
+
+services.PullService.earlyInit= true
+
+# This determines whether the non-request tools are refreshed
+# on each request (request tools aren't ever, because they're
+# instantiated for the request only anyway).
+
+#services.PullService.tools.per.request.refresh=true
+
+# Path to the resources of the application tools, relative to the
+# application root
+
+services.PullService.tools.resources.dir=/resources/
+
+# These are tools that are placed in the context by the service
+# These tools will be made available to all your
+# templates. You list the tools in the following way:
+#
+# tool.<scope>.<id> = <classname>
+#
+# <scope>      is the tool scope: global, request, session
+#              or persistent (see below for more details)
+# <id>         is the name of the tool in the context
+#
+# You can configure the tools in this way:
+# tool.<id>.<parameter> = <value>
+#
+# So if you find "global", "request", "session" or "persistent" as second
+# part, it is a configuration to put a tool into the toolbox, else it is a
+# tool specific configuration.
+#
+# For example:
+#
+# tool.global.ui    = org.apache.turbine.util.pull.tools.UITool
+# tool.global.mm    = org.apache.turbine.util.pull.MessageManager
+# tool.request.link = org.apache.turbine.services.pull.tools.TemplateLink
+# tool.request.page = org.apache.turbine.util.template.HtmlPageAttributes
+#
+# Then:
+#
+# tool.ui.skin = default
+#
+# configures the value of "skin" for the "ui" tool.
+#
+# Tools are accessible in all templates by the <id> given
+# to the tool. So for the above listings the UITool would
+# be available as $ui, the MessageManager as $mm, the TemplateLink
+# as $link and the HtmlPageAttributes as $page.
+#
+# You should avoid using tool names called "global", "request",
+# "session" or "persistent" because of clashes with the possible Scopes.
+#
+# Scopes:
+#
+#   global:     tool is instantiated once and that instance is available
+#               to all templates for all requests. Tool must be threadsafe.
+#
+#   request:    tool is instantiated once for each request (although the
+#               PoolService is used to recycle instances). Tool need not
+#               be threadsafe.
+#
+#   session:    tool is instantiated once for each user session, and is
+#               stored in the user's temporary hashtable. Tool should be
+#               threadsafe.
+#
+#   authorized: tool is instantiated once for each user session once the
+#               user logs in. After this, it is a normal session tool.
+#
+# Defaults: none
+
+tool.request.link=org.apache.turbine.services.pull.tools.TemplateLink
+tool.request.page=org.apache.turbine.util.template.HtmlPageAttributes
+tool.request.content=org.apache.turbine.services.pull.tools.ContentTool
+
+# Localization and Internationalization
+tool.request.l10n=org.apache.turbine.services.localization.LocalizationTool
+
+# This pull tool is to allow for easy formatting of Date object into Strings
+tool.request.dateFormatter=org.apache.turbine.services.pull.util.DateFormatter
+
+# Use this tool if you need a place to store data that will persist between
+# requests.  Any data stored using this tool will be stored in the session.
+tool.session.sessionData=org.apache.turbine.services.pull.util.SessionData
+
+# These are intake tools.
+tool.request.intake=org.apache.turbine.services.intake.IntakeTool
+
+# This is a tool that allows access to the scheduler service.
+# tool.request.scheduler=org.apache.turbine.services.SchedulerTool
+
+# The UITool will allow you to skin your Turbine application using simple
+# properties files that are located in the WEBAPP/resources/ directory
+# hierarchy.
+tool.global.ui=org.apache.turbine.services.pull.tools.UITool
+
+# Path to the UI resources, relative to the resources directory defined above
+# tool.ui.dir.skin=/ui/skins
+
+# Path to the images of a skin, relative to the skin directory defined above
+# tool.ui.dir.image=/images
+
+# Default CSS file for a skin
+# tool.ui.css=skin.css
+
+# Default skin name
+# tool.ui.skin=default
+
+#
+# The ui tool normally returns absolute URIs.
+# Setting this property to true allows you to change the behavior if you
+# want only relative URIs (e.g. if you run behind a reverse proxy or a load
+# balancer).
+tool.ui.want.relative=true
+
+#
+# The content tool can put its URIs through the Servlet container,
+# which might attach things like the jsessionid even to URIs that
+# are not served by the container.
+#
+# The default behavior was not to put these through the container.
+#
+# Set this to true if you need things like jsessionid attached to all
+# links generated from the $content pull tool.
+#
+tool.content.want.encoding = false
+
+#
+# Both the link and the content tool normally return absolute URIs
+# You can change this by exchanging the tool classes but this is not
+# really recommended. Setting these properties to true allow you
+# to change the behaviour if you want only relative URIs (e.g. if you
+# run behind a reverse proxy or a load balancer).
+#
+tool.content.want.relative = true
+tool.link.want.relative = true
+
+# -------------------------------------------------------------------
+#
+#  V E L O C I T Y  S E R V I C E
+#
+# -------------------------------------------------------------------
+
+# The location of Velocity configuration file, relative to webapp root
+# These properties will override the default properties set by Velocity.
+# You should specify the path to the templates directories as well as
+# the path to the log file and they should also be relative to webapp root
+
+services.VelocityService.template.extension=vm
+services.VelocityService.default.page = VelocityPage
+services.VelocityService.default.screen = VelocityScreen
+services.VelocityService.default.layout = VelocityOnlyLayout
+services.VelocityService.default.navigation = VelocityNavigation
+services.VelocityService.default.error.screen = VelocityErrorScreen
+services.VelocityService.default.layout.template = Default.vm
+
+#
+# Set this to true to catch Velocity Errors and display them in the log file
+services.VelocityService.catch.errors = true
+
+services.VelocityService.input.encoding=UTF-8
+
+#
+# Class Path Loader, Turbine jar
+services.VelocityService.velocimacro.library = macros/TurbineMacros.vm,macros/applicationMacros.vm
+
+# Set the following line to true to cause velocity to automatically reload
+# library macro files if they change.  This is useful for debugging.
+services.VelocityService.velocimacro.library.autoreload = true
+
+services.VelocityService.resource.loader = file
+services.VelocityService.file.resource.loader.description = Velocity File Resource Loader
+services.VelocityService.file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
+services.VelocityService.file.resource.loader.path = /templates
+services.VelocityService.file.resource.loader.cache = false
+services.VelocityService.file.resource.loader.modificationCheckInterval = 2
+
+services.VelocityService.resource.loader = classpath
+services.VelocityService.classpath.resource.loader.description = Velocity Classpath Resource Loader
+services.VelocityService.classpath.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+
+# -------------------------------------------------------------------
+#
+#  S C H E D U L E R  S E R V I C E
+#
+# -------------------------------------------------------------------
+
+#
+# Set enabled to true to start the scheduler.  The scheduler can be
+# stopped and started after Turbine has been initialized.  See the
+# javadocs for org.apache.turbine.services.schedule.TurbineScheduler
+# for the methods calls.
+#
+# Default = false
+#
+
+services.SchedulerService.enabled=false
+
+# Determines if the scheduler service should be initialized early.  This
+# Should always be set to true!!!!
+
+services.SchedulerService.earlyInit=true
+
+# -------------------------------------------------------------------
+#
+#  S E C U R I T Y  S E R V I C E
+#
+# -------------------------------------------------------------------
+
+# Configure Torque Security Service
+services.SecurityService.classname=org.apache.turbine.services.security.DefaultSecurityService
+services.SecurityService.user.manager = org.apache.turbine.services.security.DefaultUserManager
+
+services.SecurityService.user.class=org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl
+
+
+
+# -------------------------------------------------------------------
+#
+#  A V A L O N   C O M P O N E N T   S E R V I C E
+#
+# -------------------------------------------------------------------
+# Components implementing the Avalon lifecycle interfaces can be loaded,
+# configured and initialized by Turbine
+# -------------------------------------------------------------------
+
+#
+# Name and location to the configuration file for the components.
+#
+services.AvalonComponentService.containerConfiguration = /WEB-INF/conf/containerConfiguration.xml
+#
+# Name and location to the configuration file for the component roles.
+#
+#services.AvalonComponentService.componentRoles =  /WEB-INF/conf/roleConfiguration.xml
+#
+#services.AvalonComponentService.componentConfiguration = /WEB-INF/conf/componentConfiguration.xml
+
+# -------------------------------------------------------------------
+#
+#  A D D I T I O N A L  P R O P E R T I E S
+#
+# -------------------------------------------------------------------
+# The full path name to an additional properties file. Properties in
+# this file will be included in this property set. Duplicate name
+# values will be replaced, so be careful.
+#
+# Default: none
+# -------------------------------------------------------------------
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml
new file mode 100644
index 0000000..7502ca4
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+#*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*#
+<componentConfig>
+    <!-- Torque Component -->
+    <torque>
+       <configfile>/WEB-INF/conf/Torque.properties</configfile>
+    </torque>
+    <cache cacheInitialSize="20" cacheCheckFrequency="5"/>
+    <mimetype/>
+    <crypto>
+      <algorithm>
+        <unix>org.apache.fulcrum.crypto.provider.UnixCrypt</unix>
+        <clear>org.apache.fulcrum.crypto.provider.ClearCrypt</clear>
+        <java>org.apache.fulcrum.crypto.provider.JavaCrypt</java>
+        <oldjava>org.apache.fulcrum.crypto.provider.OldJavaCrypt</oldjava>
+      </algorithm>
+    </crypto>
+    <localization>
+      <bundles>
+        <bundle>${package}.L10N</bundle>
+      </bundles>
+    </localization>
+    <!-- Disable if you experience startup problems with Java8 -->
+    <intake>
+      <serialDataPath>WEB-INF/appData.ser</serialDataPath>
+      <xmlPaths>
+        <xmlPath>WEB-INF/conf/${turbine_intake_file}</xmlPath>
+      </xmlPaths>
+    </intake>
+    <factory/>
+    <pool/>
+    <parser>
+        <parameterEncoding>utf-8</parameterEncoding>
+        <automaticUpload>true</automaticUpload>
+    </parser>
+    <upload repository="/tmp" sizeMax="1048576" sizeThreshold="10240"/>
+        <!-- These components belong to the Fulcrum-Security services -->        
+    <securityService/>
+    <authenticator/>
+    <modelManager/>
+    <aclFactory/>
+    
+    <!--  
+       Fulcrum Components, e.g. json, XmlRpcServerComponent, cft. Fulcrum Component Configurations 
+     -->
+       
+     
+     <!--  
+     Pure Fulcrum Model
+    -->
+    <!--
+     <userManager> 
+       <className>org.apache.fulcrum.security.torque.om.TorqueTurbineUser</className>
+    </userManager>
+    <groupManager>
+        <className>org.apache.fulcrum.security.torque.om.TorqueTurbineGroup</className>
+    </groupManager>
+    <roleManager>
+        <className>org.apache.fulcrum.security.torque.om.TorqueTurbineRole</className>
+    </roleManager>
+    <permissionManager>
+        <className>org.apache.fulcrum.security.torque.om.TorqueTurbinePermission</className>
+    </permissionManager>
+    -->
+ 
+     <!-- 
+     Default classes implementing org.apache.fulcrum.security.model.turbine.entity interfaces 
+     -->
+    <!--userManager>
+        <className>org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl</className>
+    </userManager>
+    <groupManager>
+        <className>org.apache.fulcrum.security.model.turbine.entity.impl.TurbineGroupImpl</className>
+    </groupManager>
+    <roleManager>
+        <className>org.apache.fulcrum.security.model.turbine.entity.impl.TurbineRoleImpl</className>
+    </roleManager>
+    <permissionManager>
+        <className>org.apache.fulcrum.security.model.turbine.entity.impl.TurbinePermissionImpl</className>
+    </permissionManager -->
+    
+    <!-- 
+     Custom Turbine ORM Torque classes could not yet be used: 
+     - requires Torque 4.1 or if using Torque 4.0 reqires manually adding the interfaces in T-classes
+     - requires attribute baseClass in fulcrum-turbine-schema.xml table elements set to appropriate org.apache.fulcrum.security.model.turbine.entity interfaces
+     - requires attribute peerClass in fulcrum-turbine-schema.xml table elements set to org.apache.fulcrum.security.torque.peer.TorqueTurbinePeer 
+     -->
+     
+     <userManager>
+     <className>${package}.om.TurbineUser</className>
+        <peerClassName>${package}.om.TurbineUserPeerImpl</peerClassName>
+    </userManager>
+    <groupManager>
+        <className>${package}.om.TurbineGroup</className>
+        <peerClassName>${package}.om.TurbineGroupPeerImpl</peerClassName>
+    </groupManager>
+    <roleManager>
+        <className>${package}.om.TurbineRole</className>
+        <peerClassName>${package}.om.TurbineRolePeerImpl</peerClassName>
+    </roleManager>
+    <permissionManager>
+        <className>${package}.om.TurbinePermission</className>
+        <peerClassName>${package}.om.TurbinePermissionPeerImpl</peerClassName>
+    </permissionManager>
+     <peerManager/>
+     
+</componentConfig>
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/containerConfiguration.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/containerConfiguration.xml
new file mode 100644
index 0000000..f676999
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/containerConfiguration.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+#*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*#
+<fulcrum-yaafi>
+	<containerFlavour>yaafi</containerFlavour>
+	<containerClazzName>org.apache.fulcrum.yaafi.framework.container.ServiceContainerImpl</containerClazzName>
+	<componentRoles>
+		<location>/WEB-INF/conf/roleConfiguration.xml</location>
+		<isEncrypted>false</isEncrypted>
+	</componentRoles>
+	<componentConfiguration>
+		<location>/WEB-INF/conf/componentConfiguration.xml</location>
+		<isEncrypted>false</isEncrypted>
+	</componentConfiguration>
+	<parameters>
+		<location>/WEB-INF/conf/parameters.properties</location>
+		<isEncrypted>false</isEncrypted>
+	</parameters>
+</fulcrum-yaafi>
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml
new file mode 100644
index 0000000..7c00de2
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/intake.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>

+#*

+ Licensed to the Apache Software Foundation (ASF) under one

+ or more contributor license agreements.  See the NOTICE file

+ distributed with this work for additional information

+ regarding copyright ownership.  The ASF licenses this file

+ to you under the Apache License, Version 2.0 (the

+ "License"); you may not use this file except in compliance

+ with the License.  You may obtain a copy of the License at

+

+   http://www.apache.org/licenses/LICENSE-2.0

+

+ Unless required by applicable law or agreed to in writing,

+ software distributed under the License is distributed on an

+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+ KIND, either express or implied.  See the License for the

+ specific language governing permissions and limitations

+ under the License.

+*#

+

+<!-- ======================================================================== -->

+<!--                                                                          -->

+<!--  Default Intake file for Turbine Skeleton                                -->

+<!--                                                                          -->

+<!-- $Id: intake.xml 615350 2008-01-25 21:28:10Z tv $                         -->

+<!--                                                                          -->

+<!-- ======================================================================== -->

+

+<input-data xmlns="http://turbine.apache.org/schema/intake/4.0"

+    basePackage="${package}.">

+    <group name="example" key="example" mapToObject="om.Table1">

+        <field name="TestCol2" key="testCol2" type="String"/>

+    </group>

+    <group name="Login" key="login">

+    <field name="Username" key="u" type="String">

+      <!-- l10n keys -->

+      <rule name="required" value="true">username_required_msg</rule>

+      <rule name="minLength" value="4">username_min_length_msg</rule>

+      <!--rule name="mask" value=".+@.+\..+">username_mask_msg</rule-->

+    </field>

+    <field name="Password" key="p" type="String">

+      <rule name="required" value="true">password_msg</rule>

+    </field>

+</group>

+</input-data>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties
new file mode 100644
index 0000000..f29d85a
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/log4j.properties
@@ -0,0 +1,137 @@
+#*

+# 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.

+*#

+##set($dollar = '$')

+##macro (var $label)${dollar}{${label}}#end

+# Turbine logging configuration

+#

+# If we don't know the logging facility, put it into the

+# turbine.log

+#

+log4j.rootLogger = INFO, app, console

+

+#

+# App log

+#

+log4j.logger.${package} = DEBUG, app

+log4j.additivity.${package} = false

+

+#

+# Avalon log

+#

+log4j.logger.avalon = DEBUG, app

+log4j.additivity.avalon = false

+

+#

+# Scheduler Category

+#

+log4j.logger.scheduler = INFO, app

+log4j.additivity.scheduler = false

+

+#

+# sql log

+# allows TRACE

+log4j.logger.org.apache.torque.util = DEBUG, sql, console

+log4j.additivity.org.apache.torque.util = false

+

+#

+# Torque log

+# allows TRACE

+log4j.logger.org.apache.torque = DEBUG, torque

+log4j.additivity.org.apache.torque = false

+

+#

+# Turbine goes into "turbine" loggers

+#

+log4j.logger.org.apache.turbine = INFO, turbine

+log4j.additivity.org.apache.turbine = false

+

+#

+# Velocity log

+#

+log4j.logger.velocity = INFO, velocity

+log4j.additivity.velocity = false

+

+# #######################################################################

+#

+# Logfile definitions

+#

+# #######################################################################

+

+#

+# Application.log

+#

+log4j.appender.app = org.apache.log4j.RollingFileAppender

+log4j.appender.app.MaxFileSize=5MB

+log4j.appender.app.MaxBackupIndex=5

+log4j.appender.app.file = ${applicationRoot}/logs/application.log

+log4j.appender.app.layout = org.apache.log4j.PatternLayout

+log4j.appender.app.layout.conversionPattern = %d [%t] %-5p %c - %m%n

+log4j.appender.app.append = false

+

+#

+# turbine.log

+#

+log4j.appender.turbine = org.apache.log4j.RollingFileAppender

+log4j.appender.turbine.MaxFileSize=5MB

+log4j.appender.turbine.MaxBackupIndex=5

+log4j.appender.turbine.file = ${applicationRoot}/logs/turbine.log

+log4j.appender.turbine.layout = org.apache.log4j.PatternLayout

+log4j.appender.turbine.layout.conversionPattern = %d [%t] %-5p %c - %m%n

+log4j.appender.turbine.append = false

+

+#

+# sql.log

+#

+log4j.appender.sql = org.apache.log4j.RollingFileAppender

+log4j.appender.sql.file = ${applicationRoot}/logs/sql.log

+log4j.appender.sql.MaxFileSize=5MB

+log4j.appender.sql.MaxBackupIndex=5

+log4j.appender.sql.layout = org.apache.log4j.PatternLayout

+log4j.appender.sql.layout.conversionPattern = %d [%t] %-5p %c - %m%n

+log4j.appender.sql.append = true

+

+#

+# console

+#

+log4j.appender.console = org.apache.log4j.ConsoleAppender

+log4j.appender.console.layout = org.apache.log4j.PatternLayout

+log4j.appender.console.layout.conversionPattern = %d [%t] %-5p %C{1} - %m%n

+

+#

+# torque.log

+#

+log4j.appender.torque = org.apache.log4j.RollingFileAppender

+log4j.appender.torque.MaxFileSize=5MB

+log4j.appender.torque.MaxBackupIndex=5

+log4j.appender.torque.file = ${applicationRoot}/logs/torque.log

+log4j.appender.torque.layout = org.apache.log4j.PatternLayout

+log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n

+log4j.appender.torque.append = false

+

+#

+# Velocity gets configured to write its output onto the velocity

+# category.

+#

+log4j.appender.velocity = org.apache.log4j.RollingFileAppender

+log4j.appender.velocity.MaxFileSize=5MB

+log4j.appender.velocity.MaxBackupIndex=5

+log4j.appender.velocity.file = ${applicationRoot}/logs/velocity.log

+log4j.appender.velocity.layout = org.apache.log4j.PatternLayout

+log4j.appender.velocity.layout.conversionPattern = %d [%t] %-5p %c - %m%n

+log4j.appender.velocity.append = false

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
new file mode 100644
index 0000000..a0886a4
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+#*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*#
+<role-list>
+    <!-- Torque Component Role Configuration -->
+    <role name="org.apache.torque.avalon.Torque"
+          shorthand="torque"
+          default-class="org.apache.torque.avalon.TorqueComponent"
+          early-init = "true" />
+        
+    <role
+        name="org.apache.fulcrum.cache.GlobalCacheService"
+        shorthand="cache"
+        default-class="org.apache.fulcrum.cache.impl.DefaultGlobalCacheService"/>
+
+    <role
+        name="org.apache.fulcrum.mimetype.MimeTypeService"
+        shorthand="mimetype"
+        default-class="org.apache.fulcrum.mimetype.DefaultMimeTypeService"/>
+
+    <role
+        name="org.apache.fulcrum.crypto.CryptoService"
+        shorthand="crypto"
+        default-class="org.apache.fulcrum.crypto.DefaultCryptoService"/>
+
+    <role
+        name="org.apache.fulcrum.localization.LocalizationService"
+        shorthand="localization"
+        default-class="org.apache.fulcrum.localization.DefaultLocalizationService"/>
+
+	<!-- Disable if you experience startup problems with Java8 -->
+    <role
+        name="org.apache.fulcrum.intake.IntakeService"
+        shorthand="intake"
+        default-class="org.apache.fulcrum.intake.IntakeServiceImpl"/>
+
+    <role
+        name="org.apache.fulcrum.factory.FactoryService"
+        shorthand="factory"
+        default-class="org.apache.fulcrum.factory.DefaultFactoryService"/>
+
+    <role
+        name="org.apache.fulcrum.pool.PoolService"
+        shorthand="pool"
+        default-class="org.apache.fulcrum.pool.DefaultPoolService"/>
+
+    <role
+        name="org.apache.fulcrum.upload.UploadService"
+        shorthand="upload"
+        default-class="org.apache.fulcrum.upload.DefaultUploadService"/>
+
+    <role
+        name="org.apache.fulcrum.parser.ParserService"
+        shorthand="parser"
+        default-class="org.apache.fulcrum.parser.DefaultParserService"/>
+       
+    <role
+        name="org.apache.fulcrum.xslt.XSLTService"
+        shorthand="xslt"
+        default-class="org.apache.fulcrum.xslt.DefaultXSLTService"/>
+        
+         <!-- These components belong to the Fulcrum-Security services -->        
+    <role
+        name="org.apache.fulcrum.security.SecurityService"
+        shorthand="securityService"
+        default-class="org.apache.fulcrum.security.BaseSecurityService"/>
+
+    <role
+        name="org.apache.fulcrum.security.UserManager"
+        shorthand="userManager"
+        early-init="true"
+        default-class="${package}.fulcrum.security.torque.turbine.TorqueTurbineUserManagerImpl"/>
+
+    <role
+        name="org.apache.fulcrum.security.GroupManager"
+        shorthand="groupManager"
+        default-class="${package}.fulcrum.security.torque.turbine.TorqueTurbineGroupManagerImpl"/>
+
+    <role
+        name="org.apache.fulcrum.security.RoleManager"
+        shorthand="roleManager"
+        default-class="${package}.fulcrum.security.torque.turbine.TorqueTurbineRoleManagerImpl"/>
+
+    <role
+        name="org.apache.fulcrum.security.PermissionManager"
+        shorthand="permissionManager"
+        default-class="org.apache.fulcrum.security.memory.MemoryPermissionManagerImpl"/>
+        
+    <role
+        name="org.apache.fulcrum.security.torque.peer.PeerManager"
+        shorthand="peerManager"
+        default-class="org.apache.fulcrum.security.torque.peer.PeerManagerDefaultImpl"/>
+        
+    <!-- optionally five memory managers : remove later and .. -->
+   <!-- 
+    <role
+        name="org.apache.fulcrum.security.UserManager"
+        shorthand="userManager"
+        early-init="true"
+        default-class="org.apache.fulcrum.security.memory.turbine.MemoryTurbineUserManagerImpl"/>
+
+    <role
+        name="org.apache.fulcrum.security.GroupManager"
+        shorthand="groupManager"
+        default-class="org.apache.fulcrum.security.memory.MemoryGroupManagerImpl"/>
+
+    <role
+        name="org.apache.fulcrum.security.RoleManager"
+        shorthand="roleManager"
+        default-class="org.apache.fulcrum.security.memory.MemoryRoleManagerImpl"/>
+
+    <role
+        name="org.apache.fulcrum.security.PermissionManager"
+        shorthand="permissionManager"
+        default-class="org.apache.fulcrum.security.memory.MemoryPermissionManagerImpl"/>
+     -->
+
+    <role
+        name="org.apache.fulcrum.security.ModelManager"
+        shorthand="modelManager"
+        default-class="org.apache.fulcrum.security.memory.turbine.MemoryTurbineModelManagerImpl"/>
+
+    <role
+        name="org.apache.fulcrum.security.authenticator.Authenticator"
+        shorthand="authenticator"
+        default-class="org.apache.fulcrum.security.authenticator.TextMatchAuthenticator"/>
+
+    <role
+        name="org.apache.fulcrum.security.model.ACLFactory"
+        shorthand="aclFactory"
+        default-class="org.apache.fulcrum.security.model.turbine.TurbineACLFactory"/>
+        
+    <!-- use torque managers for database mysql et al. -->
+    <!--   <role
+        name="org.apache.fulcrum.security.UserManager"
+        shorthand="userManager"
+        early-init="true"
+        default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineUserManagerImpl"/>
+    <role
+        name="org.apache.fulcrum.security.GroupManager"
+        shorthand="groupManager"
+        default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineGroupManagerImpl"/>
+    <role
+        name="org.apache.fulcrum.security.RoleManager"
+        shorthand="roleManager"
+        default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineRoleManagerImpl"/>
+    <role
+        name="org.apache.fulcrum.security.PermissionManager"
+        shorthand="permissionManager"
+        default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbinePermissionManagerImpl"/>
+    <role
+        name="org.apache.fulcrum.security.ModelManager"
+        shorthand="modelManager"
+        default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineModelManagerImpl"/-->
+            
+     <!-- role
+        name="org.apache.fulcrum.json.JsonService"
+        shorthand="json"
+        default-class="org.apache.fulcrum.json.jackson.Jackson2MapperService"/-->
+
+    <!-- Add your services here -->
+        
+</role-list>
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/turbine-classic-pipeline.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/turbine-classic-pipeline.xml
new file mode 100644
index 0000000..1cb9053
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/turbine-classic-pipeline.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<org.apache.turbine.pipeline.TurbinePipeline>
+  <valves>
+    <org.apache.turbine.pipeline.DetermineActionValve/>
+    <org.apache.turbine.pipeline.DetermineTargetValve/>
+    <org.apache.turbine.pipeline.DefaultSessionTimeoutValve/>
+    <org.apache.turbine.pipeline.DefaultLoginValve/>
+    <org.apache.turbine.pipeline.DefaultSessionValidationValve/>
+    <org.apache.turbine.pipeline.DefaultACLCreationValve/>
+    <org.apache.turbine.pipeline.ExecutePageValve/>
+    <org.apache.turbine.pipeline.CleanUpValve/>
+    <org.apache.turbine.pipeline.DetermineRedirectRequestedValve/>
+  </valves>
+</org.apache.turbine.pipeline.TurbinePipeline>
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/usersettings.properties b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/usersettings.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/usersettings.properties
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-env.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-env.xml
new file mode 100644
index 0000000..64f7b2c
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-env.xml
@@ -0,0 +1,15 @@
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+  <New id="Turbine" class="org.eclipse.jetty.plus.jndi.Resource">
+    <Arg></Arg> <!-- reference to WebAppContext requires jetty 9.x only  -->
+    <Arg>${turbine_database_jndipath}</Arg>
+    <Arg>
+        <New class="org.apache.commons.dbcp.BasicDataSource">
+           <Set name="driverClassName">${turbine_database_driver}</Set>
+            <Set name="url">${turbine_database_url}${turbine_database_name}</Set>
+            <Set name="username">${turbine_database_user}</Set>
+            <Set name="password">${turbine_database_password}</Set>
+            <Set name="validationQuery">SELECT 1</Set>
+        </New>
+    </Arg>
+  </New>
+</Configure>
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..7241e9d
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8" ?>

+<!--
+ Licensed to the Apache Software Foundation (ASF) under one

+ or more contributor license agreements.  See the NOTICE file

+ distributed with this work for additional information

+ regarding copyright ownership.  The ASF licenses this file

+ to you under the Apache License, Version 2.0 (the

+ "License"); you may not use this file except in compliance

+ with the License.  You may obtain a copy of the License at

+

+   http://www.apache.org/licenses/LICENSE-2.0

+

+ Unless required by applicable law or agreed to in writing,

+ software distributed under the License is distributed on an

+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+ KIND, either express or implied.  See the License for the

+ specific language governing permissions and limitations

+ under the License.

+-->

+<web-app id="WebApp_ID" version="2.5" 

+    xmlns="http://java.sun.com/xml/ns/j2ee" 

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_2_5.xsd">

+<!-- ======================================================================== -->

+<!--                                                                          -->

+<!-- Web Application descriptor                                               -->

+<!--                                                                          -->

+<!-- ======================================================================== -->

+

+<!-- ======================================================================== -->

+<!--                                                                          -->

+<!-- Uncomment the following block if you want to use the Session Service     -->

+<!--                                                                          -->

+<!-- ======================================================================== -->

+<!--

+  <listener>

+    <listener-class>org.apache.turbine.services.session.SessionListener</listener-class>

+  </listener>

+-->

+

+  <servlet>

+    <description>${turbine_app_name}</description>

+    <servlet-name>Turbine</servlet-name>

+    <servlet-class>org.apache.turbine.Turbine</servlet-class>

+    <init-param>

+      <param-name>applicationRoot</param-name>

+      <param-value>webContext</param-value>

+    </init-param>

+    <init-param>

+      <param-name>loggingRoot</param-name>

+      <param-value>/.</param-value>

+    </init-param>

+    <init-param>

+      <param-name>properties</param-name>

+      <param-value>WEB-INF/conf/TurbineResources.properties</param-value>

+    </init-param>

+    <load-on-startup>1</load-on-startup>

+  </servlet>

+

+  <servlet-mapping>

+    <servlet-name>Turbine</servlet-name>

+    <url-pattern>/app/*</url-pattern>

+  </servlet-mapping>

+

+<!-- ======================================================================== -->

+<!--                                                                          -->

+<!-- Redirect the home page of the application to the turbine servlet         -->

+<!--                                                                          -->

+<!-- ======================================================================== -->

+

+  <welcome-file-list>

+    <welcome-file>app</welcome-file>

+  </welcome-file-list>

+  

+  

+ <!-- ======================================================================== -->

+<!--                                                                          -->

+<!-- JNDI Ressource                                                           -->

+<!-- ======================================================================== -->

+  

+   <resource-ref>

+    <res-ref-name>${turbine_database_jndipath}</res-ref-name>

+    <res-type>javax.sql.DataSource</res-type>

+    <res-auth>Container</res-auth>

+  </resource-ref>

+

+<!-- ======================================================================== -->

+<!--                                                                          -->

+<!-- Make sure that templates and logs are not available through              -->

+<!-- the servlet container. Remove security constraints or add an authen-     -->

+<!-- tication role if you need access to these paths.                         -->

+<!--                                                                          -->

+<!-- ======================================================================== -->

+

+  <security-constraint>

+    <web-resource-collection>

+      <web-resource-name>templates</web-resource-name>

+      <url-pattern>/templates/*</url-pattern>

+    </web-resource-collection>

+    <web-resource-collection>

+      <web-resource-name>logs</web-resource-name>

+      <url-pattern>/logs/*</url-pattern>

+    </web-resource-collection>

+    <auth-constraint/>

+  </security-constraint>

+</web-app>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/powered-by-logo.gif b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/powered-by-logo.gif
new file mode 100644
index 0000000..94c6554
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/powered-by-logo.gif
Binary files differ
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/turbine-project.png b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/turbine-project.png
new file mode 100644
index 0000000..6d80184
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/images/turbine-project.png
Binary files differ
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/skin.props b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/skin.props
new file mode 100644
index 0000000..dde7066
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/resources/ui/skins/default/skin.props
@@ -0,0 +1,19 @@
+# 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.
+
+# Configuration file for the user interface
+bgcolor=#023262
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm
new file mode 100644
index 0000000..c9f94d0
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/layouts/Default.vm
@@ -0,0 +1,57 @@
+## 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.

+

+$page.addStyleSheet("http://www.w3schools.com/lib/w3.css")

+$page.addStyleSheet("http://www.w3schools.com/lib/w3-theme-blue-grey.css")

+$page.setTitle("Sample Apache Turbine Application")

+

+

+<html>

+

+#TurbineHtmlHead()

+

+<body #TurbineHtmlBodyAttributes() class="w3-theme-l4">

+

+	<div class="w3-wrapper">

+

+		<!-- Header -->

+		<header class="w3-container w3-center w3-padding-32 w3-theme">

+        	<img class="w3-right" src="$ui.image('turbine-project.png')" /> 

+	        #if ( $data.getUser().hasLoggedIn() ) 

+		        #set ( $u = $data.getUser() )

+		        <div class="w3-right">

+					<h5>Hello $!u.FirstName</h5>

+		        </div>

+			#end

+		</header>

+

+        <!-- Default Menu -->

+        $navigation.setTemplate("/Menu.vm")

+

+        <!-- Content -->

+        <div class="w3-left w3-padding" id="content">

+                $screen_placeholder

+        </div>

+

+        <!-- Footer -->

+        <footer class="w3-bottom">

+			<p>Powered by <img src="$ui.image('powered-by-logo.gif')"/></p>

+        </footer>

+	</div>

+

+</body>

+</html>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm
new file mode 100644
index 0000000..9acccea
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/macros/applicationMacros.vm
@@ -0,0 +1,151 @@
+## 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.
+
+##
+## $Id: TurbineMacros.vm 222027 2016-10-20 16:11:37Z painter $
+##
+## Put your Application macros in this file.
+##
+
+#* ------------------------------------------------------------------
+#    Global Macros
+*# ------------------------------------------------------------------
+
+#* ------------------------------------------------------------------
+#    Drop down select option for yes/no questions
+*# ------------------------------------------------------------------
+#macro (selectYesNo $label $selection)
+	<select name="$label">
+		#if ( $selection == "true" )
+			<option value="1" selected>Yes</option>
+			<option value="0">No</option>
+		#else
+			<option value="1">Yes</option>
+			<option value="0" selected>No</option>
+		#end
+	</select>
+#end
+
+
+#* ------------------------------------------------------------------
+#    Standard action form controls - Using w3.css styling
+*# ------------------------------------------------------------------
+
+#macro (insert)
+    <input type="submit" name="eventSubmit_doInsert" value="Insert"/>
+#end
+
+#macro (save)
+    <input type="submit" name="eventSubmit_doUpdate" value="Update"/>
+#end
+
+#macro (remove)
+    <input type="submit" name="eventSubmit_doDelete" value="Remove"/>
+#end
+
+
+#macro (warning $msg)
+<div class="w3-panel w3-orange w3-card-8">
+	$msg
+</div>
+#end
+
+#macro (error $msg)
+<div class="w3-panel w3-red w3-card-8">
+	$msg
+</div>
+#end
+
+#macro(info $msg)
+<div class="w3-panel w3-blue w3-card-8">
+	$msg
+</div>
+#end
+
+
+#* ------------------------------------------------------------------
+#
+# Macros that are used for displaying input forms. Using w3.css styling
+#
+*# ------------------------------------------------------------------
+
+#macro (formLabel $label)
+	<label>$!label</label>
+#end
+
+#macro (fileUpload $label $name)
+	<label>$!label</label>
+	<input class="w3-input" type="file" name="$!name">
+#end
+
+#macro (formCheckBox $label $name $checked)
+   #formLabel( $label )
+   #checkBox( $name $checked )
+#end
+
+#macro (checkBox $name $checked)
+	<input id="$!name" class="w3-check" type="checkbox" checked="$!checked">
+#end
+
+#macro (formLabelRequired $label)
+	<label class="w3-label w3-validate">$!label</label>
+#end
+
+#macro (formTextField $name $value)
+	<input class="w3-input" type="text" name="$!name" value="$!value">
+#end
+
+#macro (smallFormTextField $name $value)
+	<input class="w3-input" type="text" name="$!name" value="$!value">
+#end
+
+#macro (textField $name $value)
+	<input class="w3-input" type="text" name="$!name" value="$!value">
+#end
+
+#macro (textareaField $label $name $value)
+	<p>
+		<label class="w3-label">$label</label>
+		<textarea class="w3-input" style="width:90%" rows="6" name="$name" required>$!value</textarea>
+	</p>
+	
+#end
+
+#macro (formPasswordCell $label $name $value)
+	<p>
+	#formLabel( $label )
+	<input class="w3-input" type="password" name="$!name" value="$!value">
+	</p>
+#end
+
+#macro (formCellRequired $label $name $value)
+	<p>
+	  #formLabelRequired($label)
+  	  #formTextField($name $value)
+  	</p>
+#end
+
+#macro (formCell $label $name $value)
+  #formLabel($label)
+  #formTextField($name $value)
+#end
+
+#macro (smallFormCell $label $name $value)
+  #formLabel($label)
+  #smallFormTextField($name $value)
+#end
+
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm
new file mode 100644
index 0000000..4742b1f
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/navigations/Menu.vm
@@ -0,0 +1,45 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+
+#if ( $data.getUser().hasLoggedIn() )
+<nav class="w3-navbar w3-theme">
+          <li><a  href="$link.setPage("Index.vm")">Home</a></li>
+          <li class="w3-dropdown-hover">
+            <a href="#">Administration <i class="fa fa-caret-down"></i></a>
+            <div class="w3-dropdown-content w3-white w3-card-4">
+              ## every user can change their password
+          <a href="$link.setPage("Password.vm")">Update Password <i class="fa fa-unlock"></i></a>
+          
+          #if ( $data.getACL().hasRole("turbineadmin") )
+              <a href="$link.setPage("user,FluxUserList.vm")">User List <div class="w3-right"><i class="fa fa-users"></i></div></a>
+              <a href="$link.setPage("role,FluxRoleList.vm")">User Roles <div class="w3-right"><i class="fa fa-user-plus"></i></div></a>
+              <a href="$link.setPage("user,FluxUserForm.vm")?mode=insert">Add User <div class="w3-right"><i class="fa fa-user"></i></div></a>
+              #end
+            </div>
+          </li>
+
+          <li class="w3-right"><a href="$link.setAction("LogoutUser")">Logout</a></li>
+          
+</nav>
+#else
+<nav class="w3-navbar w3-theme">
+          <li><a  href="$link.setPage("Index.vm")">Home</a></li>
+          <li class="w3-right"><a href="$link.setPage("Login.vm")">Login</a></li>
+</nav>
+
+#end
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Error.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Error.vm
new file mode 100644
index 0000000..897e5f1
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Error.vm
@@ -0,0 +1,7 @@
+E R R O R 
+
+$message
+
+$error
+
+$exception
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm
new file mode 100644
index 0000000..f1eb477
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Index.vm
@@ -0,0 +1,39 @@
+## Licensed to the Apache Software Foundation (ASF) under one

+## or more contributor license agreements.  See the NOTICE file

+## distributed with this work for additional information

+## regarding copyright ownership.  The ASF licenses this file

+## to you under the Apache License, Version 2.0 (the

+## "License"); you may not use this file except in compliance

+## with the License.  You may obtain a copy of the License at

+##

+##   http://www.apache.org/licenses/LICENSE-2.0

+##

+## Unless required by applicable law or agreed to in writing,

+## software distributed under the License is distributed on an

+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+## KIND, either express or implied.  See the License for the

+## specific language governing permissions and limitations

+## under the License.

+

+

+

+

+#if ( $data.getMessage() )

+        #info( $data.getMessage() )

+#end

+

+     <div align="center"><h1>$success</h1></div>

+

+     <p>

+             You're now successfully running a <a href="http://turbine.apache.org/">Turbine</a> based

+             application, deployed to <font color="red">$data.ServerData.ContextPath</a></font> on

+             your web container.

+     </p>

+

+     <p>

+             You can (and should!) change or remove this page at any time. It is

+             intended to give you immediate feedback if you just deployed an newly

+             setup Turbine application.

+     </p>

+

+     <a href="$link.setPage("TestSecure.vm")">Test a secure access page</a>

diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm
new file mode 100644
index 0000000..71fc50a
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Login.vm
@@ -0,0 +1,101 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+##
+## If you want to use intake to process the data, uncomment below
+##
+
+#set ( $loginGroup = $intake.Login.Default )
+  
+#set ( $valid = true )  
+#if (!$loginGroup.Username.isValid() ) 
+    ## this should be improved ...
+    #if ("$loginGroup.Username.Message" == "username_min_length_msg") 
+       #info( $l10n.format("$loginGroup.Username.Message","4") )
+    #else
+      #info( $l10n.get("$loginGroup.Username.Message") )
+    #end
+    #set ( $valid = false )
+ #end
+ 
+ #if ( !$loginGroup.Password.isValid() ) 
+    #info( $l10n.get("$loginGroup.Password.Message") )
+    #set ( $valid = false )
+ #end
+
+<p/>
+  #if (! $data.user.hasLoggedIn()) 
+  
+  <div class="w3-display-middle w3-card-8 w3-center w3-light-grey" style="max-width: 500px">
+
+		<form class="w3-container w3-light-grey" name="login" method="post" enctype="application/x-www-form-urlencoded" action="$link.setAction("LoginUserIntake").setPage($data.templateInfo.screenTemplate)">
+       <div class="w3-section">
+        
+                <p>
+                	<input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Username" type="text" name="$loginGroup.Username.Key" value="$!loginGroup.Username" tabindex="1" autocomplete="off" autofocus="">
+                </p>
+
+                <p>
+                	<input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Password" type="password" name="$loginGroup.Password.Key" value="" tabindex="2" autocomplete="off">
+                </p>
+
+                <button type="submit" name="submit" id="submit" value="eventSubmit_doPerform" class="w3-ripple" tabindex="3">#if (! $valid ) Retry #else Sign in #end</button>
+                
+                <p/>
+    ##$intake.declareGroups()
+        
+      </div>
+    </form>
+    
+    <!--  default login without Intake  -->
+    <!-- 
+    		<form class="w3-container w3-light-grey" name="login" method="post" action="$link.setAction("LoginUser").setPage($data.templateInfo.screenTemplate)">
+       <div class="w3-section">
+       
+                <p>
+                	<input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Username" type="text" name="username" value="" tabindex="1"  autocomplete="off" autofocus="">
+                </p>
+
+                <p>
+                	<input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Password" type="password" name="password" value="" tabindex="2" autocomplete="off">
+                </p>
+
+                <button type="submit" name="submit" id="submit" value="eventSubmit_doPerform" class="w3-ripple" tabindex="3">Sign in</button>
+                
+                <p/>
+
+      </div>
+    </form>
+    
+    
+    
+    -->
+
+
+    <div class="w3-container w3-border-top w3-padding-16 w3-light-grey">
+          <span class="w3-right w3-padding w3-hide-small">Forgot <a href="#">password?</a></span>
+    </div>
+
+    ## Display System messages here if there are any
+        #if($data.getMessage())
+         #info( $data.getMessage() ) <br/>
+        #end 
+
+    </div>
+  #end             
+
+## $intake.declareGroups()
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Password.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Password.vm
new file mode 100644
index 0000000..c5c2b83
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/Password.vm
@@ -0,0 +1,56 @@
+## 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.
+
+
+    <div class="w3-display-middle w3-card-8 w3-center w3-light-grey" style="max-width: 500px">
+  
+    <form class="w3-container w3-light-grey" name="password_change" method="post" action="$link.setAction("ChangePasswordAction").setPage("Index.vm")">
+          <div class="w3-section">
+        
+
+                <p>
+                  <input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="Old Password" type="password" name="oldpassword" value="" tabindex="2" autocomplete="off">
+                </p>
+
+                <p>
+                  <input class="w3-input w3-border" style="margin: auto; width: 200px;" placeholder="New Password" type="password" name="newpassword" value="" tabindex="2" autocomplete="off">
+                </p>
+
+                <button type="submit" name="submit" id="submit" value="eventSubmit_doPerform" class="w3-ripple">Change Password</button>
+                
+                <button type="button" name="cancel" id="cancel" value="cancel" class="w3-ripple" onCLick="doCancel()">Cancel</button>
+                
+                <script>
+                function doCancel() { 
+                	location.href="$link.setPage('TestSecure.vm')"; 
+                	return false;
+                }
+                </script>
+
+                <p/>
+
+        
+      </div>
+    </form>
+
+
+    ## Display System messages here if there are any
+        #if($data.getMessage())
+         #info( $data.getMessage() ) <br/>
+        #end 
+
+    </div>
\ No newline at end of file
diff --git a/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm
new file mode 100644
index 0000000..e15f318
--- /dev/null
+++ b/turbine-webapp-4.0/src/main/resources/archetype-resources/src/main/webapp/templates/screens/TestSecure.vm
@@ -0,0 +1,5 @@
+#if ( $data.getMessage() )
+	#info( $data.getMessage() )
+#end
+
+<h1> Secured Access Page </h1>
diff --git a/turbine-webapp-4.0/src/test/resources/projects/first/archetype.properties b/turbine-webapp-4.0/src/test/resources/projects/first/archetype.properties
new file mode 100644
index 0000000..0a96356
--- /dev/null
+++ b/turbine-webapp-4.0/src/test/resources/projects/first/archetype.properties
@@ -0,0 +1,13 @@
+groupId=org.apache.turbine.test
+artifactId=integrationtest
+version=1.0.0-SNAPSHOT
+package=org.apache.turbine.test.integrationtest
+turbine_app_name=My Turbine Web Application
+turbine_intake_file=intake.xml
+turbine_database_name=turbine
+turbine_database_adapter=auto
+turbine_database_jndipath=jdbc/turbine
+turbine_database_driver=com.mysql.jdbc.Driver
+turbine_database_url=jdbc:mysql://localhost:3306/
+turbine_database_user=db_user
+turbine_database_password=db_password
diff --git a/turbine-webapp-4.0/src/test/resources/projects/first/goal.txt b/turbine-webapp-4.0/src/test/resources/projects/first/goal.txt
new file mode 100644
index 0000000..597acc7
--- /dev/null
+++ b/turbine-webapp-4.0/src/test/resources/projects/first/goal.txt
@@ -0,0 +1 @@
+package
\ No newline at end of file