[seam-commits] Seam SVN: r9719 - in trunk/examples: booking and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Dec 4 03:26:45 EST 2008


Author: dan.j.allen
Date: 2008-12-04 03:26:45 -0500 (Thu, 04 Dec 2008)
New Revision: 9719

Added:
   trunk/examples/booking/resources/META-INF/jboss.xml
Modified:
   trunk/examples/booking/readme.txt
   trunk/examples/booking/resources/WEB-INF/components.xml
   trunk/examples/booking/resources/WEB-INF/web.xml
   trunk/examples/booking/resources/components.properties
   trunk/examples/build.xml
Log:
JBSEAM-3397 add farm targets to example build and necessary configs to allow booking example to run in JBoss AS cluster


Modified: trunk/examples/booking/readme.txt
===================================================================
--- trunk/examples/booking/readme.txt	2008-12-04 08:25:03 UTC (rev 9718)
+++ trunk/examples/booking/readme.txt	2008-12-04 08:26:45 UTC (rev 9719)
@@ -7,4 +7,21 @@
 
 This example runs on JBoss AS as an EAR or Tomcat with JBoss Embedded as a WAR.
 
-example.name=booking
+ example.name=booking
+
+To deploy this application to a cluster, first follow the steps 1-9 clustering-howto.txt in the root folder of the Seam distribution. Then execute the following command:
+
+ ant farm
+
+This command will deploy the archive to the farm directory of the "all" JBoss AS domain. To undeploy, run the following command:
+
+ ant unfarm
+
+HTTP session replication is enabled by default. You can disable it with the following commandline switch:
+
+ -Dsession.replication=false
+
+You can also toggle Seam's ManagedEntityInterceptor for any deployment with the following commandline switch:
+
+ -Ddistributable=false
+

Added: trunk/examples/booking/resources/META-INF/jboss.xml
===================================================================
--- trunk/examples/booking/resources/META-INF/jboss.xml	                        (rev 0)
+++ trunk/examples/booking/resources/META-INF/jboss.xml	2008-12-04 08:26:45 UTC (rev 9719)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
+<jboss>
+   <enterprise-beans>
+      <session>
+         <ejb-name>BookingListAction</ejb-name>
+         <clustered>@distributable@</clustered>
+      </session>
+      <session>
+         <ejb-name>HotelBookingAction</ejb-name>
+         <clustered>@distributable@</clustered>
+      </session>
+      <session>
+         <ejb-name>HotelSearchingAction</ejb-name>
+         <clustered>@distributable@</clustered>
+      </session>
+   </enterprise-beans>
+</jboss>

Modified: trunk/examples/booking/resources/WEB-INF/components.xml
===================================================================
--- trunk/examples/booking/resources/WEB-INF/components.xml	2008-12-04 08:25:03 UTC (rev 9718)
+++ trunk/examples/booking/resources/WEB-INF/components.xml	2008-12-04 08:26:45 UTC (rev 9719)
@@ -10,7 +10,7 @@
                  http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                  http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
 
-    <core:init jndi-pattern="@jndiPattern@" debug="true"/>
+    <core:init jndi-pattern="@jndiPattern@" debug="true" distributable="@distributable@"/>
 
     <core:manager conversation-timeout="120000"
                   concurrent-request-timeout="500"

Modified: trunk/examples/booking/resources/WEB-INF/web.xml
===================================================================
--- trunk/examples/booking/resources/WEB-INF/web.xml	2008-12-04 08:25:03 UTC (rev 9718)
+++ trunk/examples/booking/resources/WEB-INF/web.xml	2008-12-04 08:26:45 UTC (rev 9719)
@@ -3,7 +3,9 @@
     xmlns="http://java.sun.com/xml/ns/javaee"
     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-app_2_5.xsd">
-    
+
+	<!-- <distributable/> -->
+
     <display-name>Seam Booking Example</display-name>
     
     <!-- Seam -->

Modified: trunk/examples/booking/resources/components.properties
===================================================================
--- trunk/examples/booking/resources/components.properties	2008-12-04 08:25:03 UTC (rev 9718)
+++ trunk/examples/booking/resources/components.properties	2008-12-04 08:26:45 UTC (rev 9719)
@@ -1,3 +1,4 @@
 # The pattern in components.xml is replaced by an application server specific value in the ant build. This value is used for running tests
 
-jndiPattern \#{ejbName}/local
\ No newline at end of file
+jndiPattern \#{ejbName}/local
+distributable true

Modified: trunk/examples/build.xml
===================================================================
--- trunk/examples/build.xml	2008-12-04 08:25:03 UTC (rev 9718)
+++ trunk/examples/build.xml	2008-12-04 08:26:45 UTC (rev 9719)
@@ -36,6 +36,7 @@
 	<!-- Deployment directories -->
 	<property name="deploy.dir" value="${jboss.home}/server/default/deploy" />
 	<property name="tomcat.deploy.dir" value="${tomcat.home}/webapps" />
+	<property name="farm.deploy.dir" value="${jboss.home}/server/all/farm" />
 	<property name="conf.dir" value="${jboss.home}/server/default/conf" />
 
 	<!-- Library directories -->
@@ -594,10 +595,15 @@
 		<copy todir="${jar.dir}">
 			<fileset refid="jar.resources" />
 			<fileset refid="jar.extras" />
+			<filterset>
+				<filter token="distributable" value="${distributable}" />
+			</filterset>
 		</copy>
 	</target>
 	
-	<target name="init.war" />
+	<target name="init.war">
+		<property name="distributable" value="false"/>
+	</target>
 
 	<!-- Build the exploded war -->
 	<target name="war" depends="compile, init.war">
@@ -652,19 +658,26 @@
 			<fileset refid="war.resources" />
 			<filterset>
 				<filter token="debug" value="${debug}" />
+				<filter token="distributable" value="${distributable}" />
 				<filter token="jndiPattern" value="${example.name}/#{ejbName}/local" />
-				<filter token="embeddedEjb" value="false" />
 				<filter token="loadPersistenceUnits" value="${loadPersistenceUnits}" />
 			</filterset>
 		</copy>
 	</target>
 
+	<target name="distributable.war" if="use.session.replication">
+		<replace file="${war.dir}/WEB-INF/web.xml">
+			<replacetoken><![CDATA[<!-- <distributable/> -->]]></replacetoken>
+			<replacevalue><![CDATA[<distributable/>]]></replacevalue>
+		</replace>
+	</target>
+
 	<!-- Build the exploded ear -->
 	<target name="ear">
 		<copy todir="${ear.dir}">
 			<fileset refid="seam.jar" />		
+			<fileset refid="ear.resources" />
 			<fileset refid="ear.extras" />
-			<fileset refid="ear.resources" />
 		</copy>
 		<mkdir dir="${ear.dir}/lib" />
 		<copy todir="${ear.dir}/lib">
@@ -695,7 +708,7 @@
 		</copy>
 	</target>
 
-	<target name="archive" depends="jar,jboss.war,ear" description="Package the archives">
+	<target name="archive" depends="jar,jboss.war,distributable.war,ear" description="Package the archives">
 		<jar jarfile="${dist.dir}/${example.name}.jar" basedir="${jar.dir}" />
 		<jar jarfile="${dist.dir}/${example.name}.war" basedir="${war.dir}" />
 		<jar jarfile="${dist.dir}/${example.name}.ear">
@@ -765,6 +778,41 @@
 		</copy>
 	</target>
 
+	<target name="init.distributable">
+		<property name="distributable" value="true"/>
+		<condition property="use.session.replication">
+			<or>
+				<not><isset property="session.replication"/></not>
+				<equals arg1="${session.replication}" arg2="true"/>
+			</or>
+		</condition>
+	</target>
+
+	<target name="farm-archive" depends="init.distributable,archive"/>
+
+	<!-- FIXME Set the deploy.dir dynamically to avoid the duplicate targets for farming -->
+
+	<target name="farm-datasource" description="Deploy the datasource to a JBoss AS cluster">
+		<fail unless="jboss.home">jboss.home not set</fail>
+		<copy todir="${farm.deploy.dir}">
+			<fileset dir="${resources.dir}">
+				<include name="${example.ds}" />
+			</fileset>
+		</copy>
+	</target>
+
+	<target name="farm" depends="farm-archive,farm-datasource" description="Deploy the example to a JBoss AS cluster">
+		<fail unless="jboss.home">
+			jboss.home not set, update build.properties
+		</fail>
+		<copy file="${dist.dir}/${example.name}.ear" todir="${farm.deploy.dir}" />
+	</target>
+
+	<target name="unfarm" description="Undeploy the example from a JBoss AS cluster">
+		<delete file="${farm.deploy.dir}/${example.name}.ear" />
+		<delete file="${farm.deploy.dir}/${example.ds}" />
+	</target>
+
 	<target name="explode" depends="jar,jboss.war,ear,datasource, meldware" description="Deploy the exploded archive">
 		<fail unless="jboss.home">jboss.home not set</fail>
 
@@ -842,8 +890,8 @@
 			<fileset refid="war.resources" />
 			<filterset>
 				<filter token="debug" value="${debug}" />
+				<filter token="distributable" value="${distributable}" />
 				<filter token="jndiPattern" value="#{ejbName}/local" />
-				<filter token="embeddedEjb" value="false" />
 			</filterset>
 		</copy>
 	</target>
@@ -914,14 +962,14 @@
 			<fileset refid="war.resources" />
 			<filterset>
 				<filter token="debug" value="${debug}" />
+				<filter token="distributable" value="${distributable}" />
 				<filter token="jndiPattern" value="#{ejbName}/local" />
-				<filter token="embeddedEjb" value="false" />
 				<filter token="loadPersistenceUnits" value="${loadPersistenceUnits}" />
 			</filterset>
 		</copy>
 	</target>
 
-	<target name="noejb.archive" depends="noejb.jar,noejb.war" description="Package the archives for non-ejb war">
+	<target name="noejb.archive" depends="noejb.jar,noejb.war,distributable.war" description="Package the archives for non-ejb war">
 		<jar jarfile="${dist.dir}/${example.name}.war">
 			<fileset dir="${war.dir}" />
 			<zipfileset dir="${dist.dir}" prefix="WEB-INF/lib">
@@ -942,6 +990,21 @@
 	<target name="jbosswar.undeploy" description="Undeploy the example from JBoss">
 		<delete file="${deploy.dir}/${example.name}.war" />
 	</target>
+
+	<target name="noejb.farm-archive" depends="init.distributable,noejb.archive"/>
+
+	<!-- FIXME Set the deploy.dir dynamically to avoid the duplicate targets for farming -->
+
+	<target name="jbosswar.farm" depends="noejb.farm-archive,farm-datasource" description="Deploy the example to a JBoss AS cluster">
+		<fail unless="jboss.home">
+			jboss.home not set, update build.properties
+		</fail>
+		<copy file="${dist.dir}/${example.name}.war" todir="${farm.deploy.dir}" />
+	</target>
+
+	<target name="jbosswar.unfarm" description="Undeploy the example from a JBoss AS cluster">
+		<delete file="${farm.deploy.dir}/${example.name}.war" />
+	</target>
 	
 	<target name="jbosswar.explode" depends="noejb.jar, noejb.war, datasource" description="Deploy the example (exploded) to JBoss AS">
 		<fail unless="jboss.home">




More information about the seam-commits mailing list