You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ml...@apache.org on 2011/09/09 17:54:58 UTC

svn commit: r1167258 - in /tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources: pom.xml src/main/java/services/AppModule.java src/main/java/services/DevelopmentModule.java src/main/java/services/QaModule.java src/main/webapp/WEB-INF/web.xml

Author: mlusetti
Date: Fri Sep  9 15:54:58 2011
New Revision: 1167258

URL: http://svn.apache.org/viewvc?rev=1167258&view=rev
Log:
TAP5-1485 Specify two execution modes in the quickstart, Development and Qa

Added:
    tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/DevelopmentModule.java   (with props)
    tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/QaModule.java   (with props)
Modified:
    tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/pom.xml
    tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/AppModule.java
    tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/webapp/WEB-INF/web.xml

Modified: tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/pom.xml?rev=1167258&r1=1167257&r2=1167258&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/pom.xml (original)
+++ tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/pom.xml Fri Sep  9 15:54:58 2011
@@ -67,6 +67,17 @@ of testing facilities designed for use w
                 </configuration>
             </plugin>
 
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <!-- <version>2.8.1</version> -->
+                <configuration>
+                    <systemPropertyVariables>
+                        <tapestry.execution-mode>Qa</tapestry.execution-mode>
+                    </systemPropertyVariables>
+                </configuration>
+            </plugin>
+
             <!-- Run the application using "mvn jetty:run" -->
             <plugin>
                 <groupId>org.mortbay.jetty</groupId>
@@ -79,6 +90,12 @@ of testing facilities designed for use w
                              that prevents the requestLog from being set. -->
                         <append>true</append>
                     </requestLog>
+                    <systemProperties>
+                        <systemProperty>
+                            <name>tapestry.execution-mode</name>
+                            <value>Development</value>
+                        </systemProperty>
+                    </systemProperties>
                 </configuration>
             </plugin>
         </plugins>

Modified: tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/AppModule.java?rev=1167258&r1=1167257&r2=1167258&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/AppModule.java (original)
+++ tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/AppModule.java Fri Sep  9 15:54:58 2011
@@ -41,11 +41,6 @@ public class AppModule
         
         configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
 
-        // The factory default is true but during the early stages of an application
-        // overriding to false is a good idea. In addition, this is often overridden
-        // on the command line as -Dtapestry.production-mode=false
-        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
-
         // The application version number is incorprated into URLs for some
         // assets. Web browsers will cache assets because of the far future expires
         // header. If existing assets are changed, the version number should also

Added: tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/DevelopmentModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/DevelopmentModule.java?rev=1167258&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/DevelopmentModule.java (added)
+++ tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/DevelopmentModule.java Fri Sep  9 15:54:58 2011
@@ -0,0 +1,58 @@
+// Copyright (c) 2011. The Apache Software Foundation
+//
+// 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.
+
+package ${package}.services;
+
+import java.io.IOException;
+
+import org.apache.tapestry5.*;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.OrderedConfiguration;
+import org.apache.tapestry5.ioc.ServiceBinder;
+import org.apache.tapestry5.ioc.annotations.Local;
+import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.RequestFilter;
+import org.apache.tapestry5.services.RequestHandler;
+import org.apache.tapestry5.services.Response;
+import org.slf4j.Logger;
+
+/**
+ * This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em>
+ * contains the <code>DevelopmentMode</code>.
+ */
+public class DevelopmentModule
+{
+    public static void contributeApplicationDefaults(
+            MappedConfiguration<String, String> configuration)
+    {
+        // Contributions to ApplicationDefaults will override any contributions to
+        // FactoryDefaults (with the same key). Here we're restricting the supported
+        // locales to just "en" (English). As you add localised message catalogs and other assets,
+        // you can extend this list of locales (it's a comma separated series of locale names;
+        // the first locale name is the default when there's no reasonable match).
+        
+        configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
+
+        // The factory default is true but during the early stages of an application
+        // overriding to false is a good idea. In addition, this is often overridden
+        // on the command line as -Dtapestry.production-mode=false
+        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
+
+        // The application version number is incorprated into URLs for some
+        // assets. Web browsers will cache assets because of the far future expires
+        // header. If existing assets are changed, the version number should also
+        // change, to force the browser to download new versions.
+        configuration.add(SymbolConstants.APPLICATION_VERSION, "${version}-DEV");
+    }
+}

Propchange: tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/DevelopmentModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/QaModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/QaModule.java?rev=1167258&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/QaModule.java (added)
+++ tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/QaModule.java Fri Sep  9 15:54:58 2011
@@ -0,0 +1,65 @@
+// Copyright (c) 2011. The Apache Software Foundation
+//
+// 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.
+
+package ${package}.services;
+
+import java.io.IOException;
+
+import org.apache.tapestry5.*;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.OrderedConfiguration;
+import org.apache.tapestry5.ioc.ServiceBinder;
+import org.apache.tapestry5.ioc.annotations.Local;
+import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.RequestFilter;
+import org.apache.tapestry5.services.RequestHandler;
+import org.apache.tapestry5.services.Response;
+import org.slf4j.Logger;
+
+/**
+ * This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em>
+ * contains the <code>QaMode</code>.
+ */
+public class QaModule
+{
+    public static void bind(ServiceBinder binder)
+    {
+        // Bind any services needed by the QA team to produce their reports
+        // binder.bind(MyServiceMonitorInterface.class, MyServiceMonitorImpl.class);
+    }
+    
+
+    public static void contributeApplicationDefaults(
+            MappedConfiguration<String, String> configuration)
+    {
+        // Contributions to ApplicationDefaults will override any contributions to
+        // FactoryDefaults (with the same key). Here we're restricting the supported
+        // locales to just "en" (English). As you add localised message catalogs and other assets,
+        // you can extend this list of locales (it's a comma separated series of locale names;
+        // the first locale name is the default when there's no reasonable match).
+        
+        configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
+
+        // The factory default is true but during the early stages of an application
+        // overriding to false is a good idea. In addition, this is often overridden
+        // on the command line as -Dtapestry.production-mode=false
+        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
+
+        // The application version number is incorprated into URLs for some
+        // assets. Web browsers will cache assets because of the far future expires
+        // header. If existing assets are changed, the version number should also
+        // change, to force the browser to download new versions.
+        configuration.add(SymbolConstants.APPLICATION_VERSION, "${version}-QA");
+    }
+}

Propchange: tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/java/services/QaModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/webapp/WEB-INF/web.xml?rev=1167258&r1=1167257&r2=1167258&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/webapp/WEB-INF/web.xml (original)
+++ tapestry/tapestry5/trunk/quickstart/prototypes/archetype-resources/src/main/webapp/WEB-INF/web.xml Fri Sep  9 15:54:58 2011
@@ -10,6 +10,23 @@ of where to look for pages, components a
         <param-name>tapestry.app-package</param-name>
         <param-value>${package}</param-value>
     </context-param>
+    <!--
+    Specify some additional Modules for two different execution
+    modes: Development and Qa.
+    Remember that the default execution mode is: Production
+    -->
+    <context-param>
+        <param-name>tapestry.Development-modules</param-name>
+        <param-value>
+            ${package}.services.DevelopmentModule
+        </param-value>
+    </context-param>
+    <context-param>
+        <param-name>tapestry.Qa-modules</param-name>
+        <param-value>
+            ${package}.services.QaModule
+        </param-value>
+    </context-param>
     <filter>
         <filter-name>app</filter-name>
         <filter-class>org.apache.tapestry5.TapestryFilter</filter-class>