- Version for M2, based on Torque 4. 
- Some Configuration Mappings need probably more reviewing (e.g for Torque User..)
- Some Artifacts (e.g. DTDs are not yet included. 
- Snapshots in Dependencies

git-svn-id: https://svn.apache.org/repos/asf/turbine/maven/archetypes/trunk/turbine-webapp-4.0@1626205 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index b76adba..22e2dfb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,17 +21,17 @@
 
   <modelVersion>4.0.0</modelVersion>
   <parent>
-    <groupId>org.apache</groupId>
-    <artifactId>apache</artifactId>
-    <version>11</version>
+     <groupId>org.apache.turbine</groupId>
+     <artifactId>turbine-parent</artifactId>
+     <version>3</version>
   </parent>
   <groupId>org.apache.turbine</groupId>
   <artifactId>turbine-webapp-4.0</artifactId>
   <version>1.0.1-SNAPSHOT</version>
   <packaging>maven-archetype</packaging>
 
-  <name>Archetype - Turbine 4.0M1 WebApp</name>
-  <description>This archetype sets up a web application project based on Apache Turbine 4.0M1</description>
+  <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>
@@ -42,21 +42,20 @@
     <url>http://svn.apache.org/viewcvs/turbine/maven/archetypes/trunk/turbine-webapp-4.0/</url>
   </scm>
   
-  <build>
+<build>
     <extensions>
       <extension>
         <groupId>org.apache.maven.archetype</groupId>
         <artifactId>archetype-packaging</artifactId>
-        <version>2.1</version>
+        <version>2.2</version>
       </extension>
     </extensions>
 
     <pluginManagement>
       <plugins>
         <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-archetype-plugin</artifactId>
-          <version>2.1</version>
+          <version>2.2</version>
         </plugin>
       </plugins>
     </pluginManagement>
diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml
index 664d8e5..fba9e11 100644
--- a/src/main/resources/archetype-resources/pom.xml
+++ b/src/main/resources/archetype-resources/pom.xml
@@ -56,111 +56,73 @@
                     <encoding>${project.build.sourceEncoding}</encoding>
                 </configuration>
             </plugin>
-            <plugin>
+            
+             <plugin>
                 <groupId>org.apache.torque</groupId>
                 <artifactId>torque-maven-plugin</artifactId>
-                <version>3.3</version>
+                <version>4.0</version>
                 <configuration>
-                    <schemaDir>#var("project.build.directory")/torque/schema</schemaDir>
-
-                    <!-- Define the Override directory location -->
-                    <!-- templatePath>#var("project.build.directory")/torque/templates</templatePath -->
+                    <schemaDir>#var("basedir")/src/main/torque-schema</schemaDir>
                     <useClasspath>true</useClasspath>
                     <runOnlyOnSchemaChange>false</runOnlyOnSchemaChange>
-                    <targetDatabase>${turbine_database_adapter}</targetDatabase>
+                    <targetDatabase>mysql</targetDatabase>
                 </configuration>
                 <executions>
-                    <execution>
-                        <id>om</id>
-                        <phase>process-resources</phase>
-                        <goals>
-                            <goal>om</goal>
-                        </goals>
-                        <configuration>
-                            <!-- These settings will allow you to customize 
-                                the way your Peer-based object model is created. -->
-                            <targetPackage>${package}.om</targetPackage>
-                            <outputDir>#var("project.build.sourceDirectory")</outputDir>
-                            <baseOutputDir>#var("project.build.directory")/generated-sources/torque</baseOutputDir>
-                            <baseReportFile>report.#var("project.artifact.artifactId").om.base.generation</baseReportFile>
-                            <reportFile>report.#var("project.artifact.artifactId").om.generation</reportFile>
-
-                            <addGetByNameMethod>true</addGetByNameMethod>
-                            <addIntakeRetrievable>true</addIntakeRetrievable>
-                            <addSaveMethod>true</addSaveMethod>
-                            <addTimeStamp>true</addTimeStamp>
-                            <basePrefix>Base</basePrefix>
-                            <complexObjectModel>true</complexObjectModel>
-                            <correctGetters>true</correctGetters>
-                            <useManagers>false</useManagers>
-                            <objectIsCaching>true</objectIsCaching>
-                            <saveException>TorqueException</saveException>
-                            <enableJava5Features>true</enableJava5Features>
-                            <runOnlyOnSchemaChange>true</runOnlyOnSchemaChange>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>datadtd torque security</id>
-                        <phase>process-resources</phase>
-                        <goals>
-                            <goal>datadtd</goal>
-                        </goals>
-                        <configuration>
-                            <projectName>torque-security</projectName>
-                            <xmlFile>#var("project.build.directory")/torque/schema/torque-security-schema.xml</xmlFile>
-                            <outputDir>#var("project.build.directory")/torque/schema</outputDir>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>datadtd application specific</id>
-                        <phase>process-resources</phase>
-                        <goals>
-                            <goal>datadtd</goal>
-                        </goals>
-                        <configuration>
-                            <projectName>application</projectName>
-                            <xmlFile>#var("project.build.directory")/torque/schema/application-schema.xml</xmlFile>
-                            <outputDir>#var("project.build.directory")/torque/schema</outputDir>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>schema sql</id>
-                        <phase>process-resources</phase>
-                        <goals>
-                            <goal>sql</goal>
-                            <goal>id-table-init-sql</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>datasql torque security</id>
-                        <phase>process-resources</phase>
-                        <goals>
-                            <goal>datasql</goal>
-                        </goals>
-                        <configuration>
-                            <dataXmlFile>#var("project.build.directory")/torque/schema/torque-security-data.xml</dataXmlFile>
-                            <dataDtd>#var("project.build.directory")/torque/schema/torque-security-data.dtd</dataDtd>
-
-                            <reportFile>torque-security-data.sql</reportFile>
-                            <schemaIncludes>torque-security-schema.xml</schemaIncludes>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>datasql application specific</id>
-                        <phase>process-resources</phase>
-                        <goals>
-                            <goal>datasql</goal>
-                        </goals>
-                        <configuration>
-                            <dataXmlFile>#var("project.build.directory")/torque/schema/application-data.xml</dataXmlFile>
-                            <dataDtd>#var("project.build.directory")/torque/schema/application-data.dtd</dataDtd>
-                            <runOnlyOnSchemaChange>false</runOnlyOnSchemaChange>
-
-                            <reportFile>application-data.sql</reportFile>
-                            <schemaIncludes>application-schema.xml</schemaIncludes>
-                        </configuration>
-                    </execution>
+                 <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("basedir")/src/main/torque-schema</sourceDir>
+                      <loglevel>error</loglevel>
+                      <options>
+                        <torque.database>mysql</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-${turbine_database_adapter}</id>
+                    <phase>package</phase>
+                    <goals>
+                      <goal>generate</goal>
+                    </goals>
+                    <configuration>
+                      <packaging>classpath</packaging>
+                      <configPackage>org.apache.torque.templates.sql</configPackage>
+                      <sourceDir>#var("basedir")/src/main/torque-schema</sourceDir>
+                      <defaultOutputDir>#var("project.build.directory")/generated-sql/torque/${turbine_database_adapter}</defaultOutputDir>
+                      <defaultOutputDirUsage>none</defaultOutputDirUsage>
+                      <loglevel>error</loglevel>
+                      <options>
+                        <torque.database>${turbine_database_adapter}</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>
@@ -194,18 +156,37 @@
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
-            <version>2.4</version>
+            <version>2.5</version>
             <scope>provided</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.torque</groupId>
-            <artifactId>village</artifactId>
-            <version>3.3.1</version>
+         <dependency>
+          <groupId>org.apache.torque</groupId>
+          <artifactId>torque-runtime</artifactId>
+          <version>4.0</version>
+          <type>jar</type>
+          <exclusions>
+            <exclusion>
+                <groupId>avalon-framework</groupId>
+                <artifactId>avalon-framework-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>avalon-logkit</groupId>
+                <artifactId>avalon-logkit</artifactId>
+            </exclusion>
+             <exclusion>
+               <groupId>commons-configuration</groupId>
+               <artifactId>commons-configuration</artifactId>
+             </exclusion>
+             <exclusion>
+               <groupId>commons-logging</groupId>
+               <artifactId>commons-logging</artifactId>
+             </exclusion>
+          </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.turbine</groupId>
             <artifactId>turbine</artifactId>
-            <version>4.0-M1</version>
+            <version>4.0-M2-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.fulcrum</groupId>
@@ -222,11 +203,25 @@
             <artifactId>fulcrum-upload</artifactId>
             <version>1.0.5</version>
         </dependency>
-
+         <dependency>
+            <groupId>org.apache.fulcrum</groupId>
+            <artifactId>fulcrum-security-api</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.fulcrum</groupId>
+            <artifactId>fulcrum-security-memory</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+         </dependency>
+         <dependency>             
+            <groupId>org.apache.fulcrum</groupId>
+            <artifactId>fulcrum-security-torque</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+        </dependency>	
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>3.8.1</version>
+            <version>4.11</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml b/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml
index 2eaa6f3..97b7a5c 100644
--- a/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml
+++ b/src/main/resources/archetype-resources/src/main/torque-schema/application-schema.xml
@@ -17,7 +17,12 @@
  specific language governing permissions and limitations

  under the License.

 *#

-<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd">

+<database name="${turbine_database_name}"

+    defaultIdMethod="none"

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

 

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

 <!--                                                                                -->

@@ -26,8 +31,6 @@
 <!--  @version $Id: application-schema.xml 615328 2008-01-25 20:25:05Z tv $  -->

 <!--                                                                                -->

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

-

-<database name="${turbine_database_name}">

     <table name="table1">

         <column name="test_col1" type="INTEGER" />

         <column name="test_col2" type="VARCHAR" size="10" />

diff --git a/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml b/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml
index 3d845de..d2bdbdb 100644
--- a/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml
+++ b/src/main/resources/archetype-resources/src/main/torque-schema/id-table-schema.xml
@@ -17,7 +17,13 @@
  specific language governing permissions and limitations

  under the License.

 -->

-<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd">

+<database name="@DATABASE_DEFAULT@"

+    defaultIdMethod="idbroker"

+    defaultJavaType="primitive"

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

 

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

 <!--                                                                           -->

@@ -27,11 +33,6 @@
 <!--                                                                           -->

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

 

-<database name="@DATABASE_DEFAULT@"

-  defaultIdMethod="idbroker"

-  defaultJavaType="primitive"

-  defaultJavaNamingMethod="underscore"

-  package="@DATABASE_PACKAGE@">

   <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"/>

diff --git a/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml b/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml
index a2327f1..fcd3857 100644
--- a/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml
+++ b/src/main/resources/archetype-resources/src/main/torque-schema/torque-security-schema.xml
@@ -17,7 +17,12 @@
  specific language governing permissions and limitations

  under the License.

 -->

-<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_3.dtd">

+<database name="${turbine_database_name}"

+    defaultIdMethod="none"

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

 

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

 <!--                                                                          -->

@@ -27,7 +32,6 @@
 <!--                                                                          -->

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

 

-<database name="${turbine_database_name}">

 

   <table name="TURBINE_PERMISSION" idMethod="idbroker">

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

@@ -80,7 +84,7 @@
     <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" type="TIMESTAMP"/>

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

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

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

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

diff --git a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
index 219c448..cae2f44 100644
--- a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
+++ b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/TurbineResources.properties
@@ -614,13 +614,13 @@
 # -------------------------------------------------------------------
 
 # Configure Torque Security Service
-services.SecurityService.classname=org.apache.turbine.services.security.torque.TorqueSecurityService
-services.SecurityService.user.manager = org.apache.turbine.services.security.torque.TorqueUserManager
+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.turbine.services.security.torque.TorqueUser
-services.SecurityService.group.class =      org.apache.turbine.services.security.torque.TorqueGroup
-services.SecurityService.permission.class = org.apache.turbine.services.security.torque.TorquePermission
-services.SecurityService.role.class =       org.apache.turbine.services.security.torque.TorqueRole
+services.SecurityService.user.class =       ${package}.om.TurbineUser
+services.SecurityService.group.class =      ${package}.om.TurbineGroup
+services.SecurityService.permission.class = ${package}.om.TurbinePermission
+services.SecurityService.role.class =       ${package}.om.TurbineRole
 
 services.SecurityService.torque.userPeer.class       = ${package}.om.TurbineUserPeer
 services.SecurityService.torque.groupPeer.class      = ${package}.om.TurbineGroupPeer
diff --git a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml
index e001001..2faadff 100644
--- a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml
+++ b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/componentConfiguration.xml
@@ -22,6 +22,23 @@
     <torque>
        <configfile>/WEB-INF/conf/Torque.properties</configfile>
     </torque>
+    <userManager>
+        <className>org.apache.fulcrum.security.torque.om.TorqueTurbineUser</className>
+        <peerClassName>org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer</peerClassName>
+    </userManager>
+    <groupManager>
+        <className>org.apache.fulcrum.security.torque.om.TorqueTurbineGroup</className>
+        <peerClassName>org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeerImpl</peerClassName>
+    </groupManager>
+    <roleManager>
+        <className>org.apache.fulcrum.security.torque.om.TorqueTurbineRole</className>
+        <peerClassName>org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeerImpl</peerClassName>
+    </roleManager>
+    <permissionManager>
+        <className>org.apache.fulcrum.security.torque.om.TorqueTurbinePermission</className>
+        <peerClassName>org.apache.fulcrum.security.torque.om.TorqueTurbinePermissionPeerImpl</peerClassName>
+    </permissionManager>
+     <peerManager/>
     <cache cacheInitialSize="20" cacheCheckFrequency="5"/>
     <mimetype/>
     <crypto>
diff --git a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
index 73e6f6d..404974f 100644
--- a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
+++ b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/conf/roleConfiguration.xml
@@ -73,6 +73,32 @@
         name="org.apache.fulcrum.xslt.XSLTService"
         shorthand="xslt"
         default-class="org.apache.fulcrum.xslt.DefaultXSLTService"/>
+        
+    <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="org.apache.fulcrum.security.memory.turbine.MemoryTurbineUserManagerImpl"/>
+    <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.memory.turbine.MemoryTurbineModelManagerImpl"/>
 
     <!-- Add your services here -->
 </role-list>
\ No newline at end of file