[seam-commits] Seam SVN: r10623 - in examples/trunk/servlet-booking: src/main/java/org/jboss/seam/examples/booking and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Apr 23 21:02:30 EDT 2009


Author: dan.j.allen
Date: 2009-04-23 21:02:30 -0400 (Thu, 23 Apr 2009)
New Revision: 10623

Modified:
   examples/trunk/servlet-booking/pom.xml
   examples/trunk/servlet-booking/readme.txt
   examples/trunk/servlet-booking/src/main/java/org/jboss/seam/examples/booking/BeanLookup.java
   examples/trunk/servlet-booking/src/main/webapp/META-INF/context.xml
   examples/trunk/servlet-booking/src/main/webapp/WEB-INF/
   examples/trunk/servlet-booking/src/main/webapp/WEB-INF/faces-config.xml
   examples/trunk/servlet-booking/src/main/webapp/WEB-INF/jetty-env.xml
   examples/trunk/servlet-booking/src/main/webapp/WEB-INF/web.xml
Log:
change JNDI name for manager from jcdi/Manager to app/Manager
remove all JSF 1.2 left overs
setup build to accomodate war:inplace
update instructions


Modified: examples/trunk/servlet-booking/pom.xml
===================================================================
--- examples/trunk/servlet-booking/pom.xml	2009-04-23 23:49:28 UTC (rev 10622)
+++ examples/trunk/servlet-booking/pom.xml	2009-04-24 01:02:30 UTC (rev 10623)
@@ -21,21 +21,45 @@
       <plugins>
 
          <plugin>
+            <artifactId>maven-clean-plugin</artifactId>
+            <configuration>
+               <failOnError>false</failOnError>
+               <filesets>
+                  <fileset>
+                     <!-- clean up files from war:inplace -->
+                     <directory>src/main/webapp</directory>
+                     <includes>
+                        <include>WEB-INF/classes/**</include>
+                        <include>WEB-INF/lib/**</include>
+                     </includes>
+                     <followSymlinks>false</followSymlinks>
+                  </fileset>
+               </filesets>
+            </configuration>
+         </plugin>
+
+         <plugin>
+            <artifactId>maven-war-plugin</artifactId>
+            <configuration>
+               <!-- don't stage or package files added to src/main/webapp by war:inplace -->
+               <warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
+            </configuration>
+         </plugin>
+
+         <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>tomcat-maven-plugin</artifactId>
             <configuration>
                <path>/${project.build.finalName}</path>
-               <!-- expecting username to be "admin" and a blank password for manager app -->
-               <!-- configure a server in settings.xml containing <username> and <password> to override -->
+               <!-- uncomment to use server configuration override; see readme.txt for details -->
                <!--<server>tomcatserver</server>-->
                <url>http://localhost:${tomcat.http.port}/manager</url>
                <port>${embedded-tomcat.http.port}</port> <!-- port for embedded Tomcat only (putting this configuration in the execution for the run goal doesn't work) -->
+               <!-- if you don't want to use war:inplace, uncomment this setting -->
                <!--
                <warSourceDirectory>${project.build.directory}/${project.build.finalName}</warSourceDirectory>
                -->
             </configuration>
-            <dependencies>
-            </dependencies>
          </plugin>
 
          <plugin>
@@ -52,12 +76,11 @@
                <webAppConfig>
                   <contextPath>/${project.build.finalName}</contextPath>
                </webAppConfig>
+               <!-- if you don't want to use war:inplace, uncomment this setting -->
                <!--
                <webAppSourceDirectory>${project.build.directory}/${project.build.finalName}</webAppSourceDirectory>
                -->
             </configuration>
-            <dependencies>
-            </dependencies>
          </plugin>
 
       </plugins>
@@ -80,16 +103,7 @@
          <classifier>jdk15</classifier>
       </dependency>
 
-      <!-- disable after upgrading to JSF 2 -->
-      <!--
       <dependency>
-         <groupId>com.sun.facelets</groupId>
-         <artifactId>jsf-facelets</artifactId>
-         <scope>runtime</scope>
-      </dependency>
-      -->
-
-      <dependency>
          <groupId>javax.annotation</groupId>
          <artifactId>jsr250-api</artifactId>
       </dependency>
@@ -97,9 +111,6 @@
       <dependency>
          <groupId>javax.faces</groupId>
          <artifactId>jsf-api</artifactId>
-         <!--
-         <version>1.2_12</version>
-         -->
          <version>2.0.0-PR2_1</version>
       </dependency>
 
@@ -107,9 +118,6 @@
          <groupId>javax.faces</groupId>
          <artifactId>jsf-impl</artifactId>
          <scope>runtime</scope>
-         <!--
-         <version>1.2_12</version>
-         -->
          <version>2.0.0-PR2_1</version>
       </dependency>
 

Modified: examples/trunk/servlet-booking/readme.txt
===================================================================
--- examples/trunk/servlet-booking/readme.txt	2009-04-23 23:49:28 UTC (rev 10622)
+++ examples/trunk/servlet-booking/readme.txt	2009-04-24 01:02:30 UTC (rev 10623)
@@ -1,8 +1,8 @@
-Seam Booking Example
-====================
+Seam Booking Example (Servlet Container)
+========================================
 
 This example demonstrates the use of Seam 3 in a Servlet container environment
-(Tomcat 6 or Jetty 6). Contextual state management and dependency injection are
+(Tomcat 6 / Jetty 6). Contextual state management and dependency injection are
 handled by JSR-299. Transaction and persistence context management is handled
 by the EJB 3 container. No alterations are expected to be made to the Servlet
 container. All services are self-contained within the deployment.
@@ -13,27 +13,47 @@
 
  mvn
 
+Now you are ready to deploy.
+
+== Deploying with an embedded servlet container
+
 Run this command to execute the application in an embedded Jetty 6 container:
 
- mvn jetty:run
+ mvn war:inplace jetty:run
 
 You can also execute the application in an embedded Tomcat 6 container:
 
- mvn tomcat:run
+ mvn war:inplace tomcat:run
 
-In both cases, any changes to assets in src/main/webapp will take affect
-immediately. If a change to a configuration file is made, the application will
-automatically redeploy. The redeploy behavior can be fined tuned in the plugin
-configuration (at least for Jetty).
+In both cases, any changes to assets in src/main/webapp take affect
+immediately. If a change to a webapp configuration file is made, the
+application may automatically redeploy. The redeploy behavior can be fined
+tuned in the plugin configuration (at least for Jetty). If you make a change
+to a classpath resource, you need to execute a build:
 
+ mvn compile war:inplace
+
+Note that war:inplace copies the compiled classes and JARs inside WebContent,
+under WEB-INF/classes and WEB-INF/lib, respectively, mixing source and compiled
+files. However, the build does work around these temporary files by excluding
+them from the packaged WAR and cleaning them during the Maven clean phase.
+These folders are also ignored by SVN.
+
+== Deploying to standalone Tomcat
+
 If you want to run the application on a standalone Tomcat 6, first download and
-extract Tomcat 6.  This build assumes you will be running Tomcat in its default
+extract Tomcat 6. This build assumes you will be running Tomcat in its default
 configuration, with a hostname of localhost and port 8080. Before starting
 Tomcat, add the following line to conf/tomcat-users.xml to allow the Maven
 Tomcat plugin to access the manager application, then start Tomcat:
 
  <user username="admin" password="" roles="manager"/>
 
+To override this username and password, add a <server> with id tomcat in your
+Maven 2 settings.xml file, set the <username> and <password> elements to the
+appropriate values and uncomment the <server> element inside the
+tomcat-maven-plugin configuration in the pom.xml.
+
 You can deploy the packaged archive to Tomcat via HTTP PUT using this command:
 
  mvn package tomcat:deploy
@@ -57,13 +77,3 @@
  mvn war:exploded tomcat:redeploy
  mvn compile war:exploded tomcat:redeploy
 
-Use of the war:inplace + tomcat:inplace goals are not recommended as it causes
-files to be copied to your src/main/webapp directory. You may accidently check
-them into the source repository or include them in the deployable archive.
-
------------------------
-Unfinished instructions
------------------------
-Have to decide if you want war:inplace which mixes compiled files w/ source
-files but gives you instant change or change the warSourceDirectory and require
-war:exploded to be run to see changes take affect.

Modified: examples/trunk/servlet-booking/src/main/java/org/jboss/seam/examples/booking/BeanLookup.java
===================================================================
--- examples/trunk/servlet-booking/src/main/java/org/jboss/seam/examples/booking/BeanLookup.java	2009-04-23 23:49:28 UTC (rev 10622)
+++ examples/trunk/servlet-booking/src/main/java/org/jboss/seam/examples/booking/BeanLookup.java	2009-04-24 01:02:30 UTC (rev 10623)
@@ -14,7 +14,7 @@
    public void lookupManager() {
       try {
          InitialContext ic = new InitialContext();
-         Manager manager = (Manager) ic.lookup("java:comp/env/jcdi/Manager");
+         Manager manager = (Manager) ic.lookup("java:comp/env/app/Manager");
          if (manager != null) {
             Logger logger = Logger.getLogger(BeanLookup.class.getName());
             logger.log(Level.INFO, "JCDI manager: " + manager.toString());

Modified: examples/trunk/servlet-booking/src/main/webapp/META-INF/context.xml
===================================================================
--- examples/trunk/servlet-booking/src/main/webapp/META-INF/context.xml	2009-04-23 23:49:28 UTC (rev 10622)
+++ examples/trunk/servlet-booking/src/main/webapp/META-INF/context.xml	2009-04-24 01:02:30 UTC (rev 10623)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Context>
    <Manager pathname=""/> <!-- disables storage of sessions across restarts -->
-   <Resource name="jcdi/Manager"
+   <Resource name="app/Manager"
       auth="Container"
       type="javax.inject.manager.Manager"
       factory="org.jboss.webbeans.resources.ManagerObjectFactory"/>


Property changes on: examples/trunk/servlet-booking/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
   + classes
lib


Modified: examples/trunk/servlet-booking/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/servlet-booking/src/main/webapp/WEB-INF/faces-config.xml	2009-04-23 23:49:28 UTC (rev 10622)
+++ examples/trunk/servlet-booking/src/main/webapp/WEB-INF/faces-config.xml	2009-04-24 01:02:30 UTC (rev 10623)
@@ -3,20 +3,4 @@
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">
-    
-   <application>
-      <!-- disable after upgrading to JSF 2 -->
-      <!--
-      <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
-      -->
-   </application>
-
-   <!--
-   <managed-bean>
-      <managed-bean-name>beanLookup</managed-bean-name>
-      <managed-bean-class>org.jboss.seam.examples.booking.BeanLookup</managed-bean-class>
-      <managed-bean-scope>request</managed-bean-scope>
-   </managed-bean>
-   -->
-
 </faces-config>

Modified: examples/trunk/servlet-booking/src/main/webapp/WEB-INF/jetty-env.xml
===================================================================
--- examples/trunk/servlet-booking/src/main/webapp/WEB-INF/jetty-env.xml	2009-04-23 23:49:28 UTC (rev 10622)
+++ examples/trunk/servlet-booking/src/main/webapp/WEB-INF/jetty-env.xml	2009-04-24 01:02:30 UTC (rev 10623)
@@ -2,19 +2,10 @@
 <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
    "http://jetty.mortbay.org/configure.dtd">
 <Configure id="webAppCtx" class="org.mortbay.jetty.webapp.WebAppContext">
-   <!--
-   <New id="jdci" class="org.mortbay.jetty.plus.naming.Resource">
+   <New id="appManager" class="org.mortbay.jetty.plus.naming.Resource">
       <Arg><Ref id="webAppCtx"/></Arg> 
-      <Arg>jcdi/Manager</Arg>
+      <Arg>app/Manager</Arg>
       <Arg>
-         <New class="org.jboss.webbeans.resources.ManagerObjectFactoryReference"/>
-      </Arg>
-   </New>
-   -->
-   <New id="jdciManager" class="org.mortbay.jetty.plus.naming.Resource">
-      <Arg><Ref id="webAppCtx"/></Arg> 
-      <Arg>jcdi/Manager</Arg>
-      <Arg>
          <New class="javax.naming.Reference">
             <Arg>javax.inject.manager.Manager</Arg> 
             <Arg>org.jboss.webbeans.resources.ManagerObjectFactory</Arg>

Modified: examples/trunk/servlet-booking/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/servlet-booking/src/main/webapp/WEB-INF/web.xml	2009-04-23 23:49:28 UTC (rev 10622)
+++ examples/trunk/servlet-booking/src/main/webapp/WEB-INF/web.xml	2009-04-24 01:02:30 UTC (rev 10623)
@@ -6,15 +6,7 @@
 
    <display-name>Seam Booking Example (Servlet Container)</display-name>
    
-   <!-- disable after upgrading to JSF 2 -->
-   <!--
    <context-param>
-      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
-      <param-value>.xhtml</param-value>
-   </context-param>
-   -->
-   
-   <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
    </context-param>
@@ -40,7 +32,7 @@
 
    <resource-env-ref>
      <description>Object factory for the JCDI Manager</description>
-     <resource-env-ref-name>jcdi/Manager</resource-env-ref-name>
+     <resource-env-ref-name>app/Manager</resource-env-ref-name>
      <resource-env-ref-type>javax.inject.manager.Manager</resource-env-ref-type>
    </resource-env-ref>
    




More information about the seam-commits mailing list