[jboss-cvs] jboss-tomcat/docs/examples/FIELDWithAnnotation14 ...

Ben Wang bwang at jboss.com
Wed Jul 19 21:02:26 EDT 2006


  User: bwang   
  Date: 06/07/19 21:02:26

  Modified:    docs/examples/FIELDWithAnnotation14    Tag: Branch_4_0
                        build.xml readme.txt
  Added:       docs/examples/FIELDWithAnnotation14    Tag: Branch_4_0
                        PojoCacheTasks.xml
  Log:
  upd
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +18 -48    jboss-tomcat/docs/examples/FIELDWithAnnotation14/Attic/build.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: build.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-tomcat/docs/examples/FIELDWithAnnotation14/Attic/build.xml,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -b -r1.1.2.3 -r1.1.2.4
  --- build.xml	28 Feb 2006 15:42:57 -0000	1.1.2.3
  +++ build.xml	20 Jul 2006 01:02:26 -0000	1.1.2.4
  @@ -5,31 +5,26 @@
     <property name="build.sysclasspath" value="ignore"/>
     <property name="junit.timeout" value="180000"/> <!-- 3 minutes -->
     
  +  <!-- Check this property file as well!! -->
     <property file="./build.properties"/>
   
  -  <!-- set local properties for this build -->
  -  <path id="lib.classpath">
  -     <fileset dir="${lib}">
  -       <include name="qdox.jar" />
  -     </fileset>
  -     <fileset dir="${jboss.root.lib}">
  -        <include name="jboss-common.jar" />
  -        <include name="concurrent.jar" />
  -     </fileset>
  -     <fileset dir="${jboss.deploy}">
  -       <include name="jboss-aop*.deployer/**.jar" />
  -     </fileset>
  -     <fileset dir="${jboss.deploy}">
  -       <include name="tc5-cluster.aop" />
  -     </fileset>
  +   <!-- Need to define these before importing PojoCacheTasks.xml -->
  +   <!-- You define your own classpath here -->
  +   <path id="user.classpath">
  +      <pathelement path="${build}"/>
     </path>
  +   <property name="user.build" value="${build}"/>
  +   <property name="user.source" value="${source}"/>
  +
  +   <import file="PojoCacheTasks.xml"/>
  +
  +  <!-- set local properties for this build -->
   
     <target name="help" description="help page">
  -      <echo message="build.sh &lt;command&gt; where command is:" />
  +      <echo message="ant &lt;command&gt; where command is:" />
        <echo message="         compile       -- compile the examples code" />
  -     <echo message="         aopcWithAnnoc -- precompile the examples POJO code" />
         <echo message="         clobber       -- clean up the whole directory" />
  -      <echo message="         war           -- package the war file" />
  +      <echo message="        dist          -- package the war file" />
     </target>
   
     <!-- set up directory -->
  @@ -59,7 +54,7 @@
              debug="true"
              deprecation="true">
         <classpath>
  -        <path refid="lib.classpath" />
  +        <path refid="pojocache.lib.classpath" />
         </classpath>
       </javac>
   
  @@ -71,32 +66,7 @@
      
     </target>  
   
  -  <!-- pre-compile directory with annotationc using jdk1.4 -->
  -  <target name="annoc" depends="compile" description="Annotation precompiler for aop class">
  -      
  -     <taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpathref="lib.classpath"/>
  -      
  -      <annotationc compilerclasspathref="lib.classpath" bytecode="true">
  -         <classpath refid="lib.classpath"/>
  -         <classpath path="${build}"/>
  -         <classpath path="${output}/etc"/>
  -         <src path="${source}"/>
  -         <include name="examples/**/*.java"/>
  -      </annotationc>
  -  </target>
  -
  -   <!-- pre-compile directory with aopc -->
  -   <target name="aopcWithAnnoc" depends="annoc" description="Precompile aop test classes after annoc">
  -   	
  -      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="lib.classpath"/>
  -   	
  -      <aopc compilerclasspathref="lib.classpath" classpathref="lib.classpath" verbose="true">
  -        <src path="${build}/examples"/>
  -        <classpath path="${build}"/>
  -      </aopc>
  -   </target>
  -
  -  <target name="dist" depends="compile, aopcWithAnnoc" description="run standalone server replicator.">
  +  <target name="dist" depends="aopc" description="run standalone server replicator.">
      <war warfile="${dist}/test-http-scoped-FIELD.war"
         webxml="${output}/etc/WEB-INF/web.xml">
         <webinf dir="${output}/etc/WEB-INF">
  
  
  
  1.1.2.7   +31 -23    jboss-tomcat/docs/examples/FIELDWithAnnotation14/Attic/readme.txt
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: readme.txt
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-tomcat/docs/examples/FIELDWithAnnotation14/Attic/readme.txt,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -b -r1.1.2.6 -r1.1.2.7
  --- readme.txt	4 Mar 2006 17:21:17 -0000	1.1.2.6
  +++ readme.txt	20 Jul 2006 01:02:26 -0000	1.1.2.7
  @@ -4,11 +4,11 @@
     03-06
   
   This is an example that illustrates how to use the FIELD replication
  -granularity to replicate over a clustered state information about
  -students and the courses they take in JBoss AS4.0.4 and up (I am
  +granularity to replicate state information about
  +students and the courses they take over a JBoss AS 4.0.4 or higher cluster (I am
   currently running it using 4.0.4.CR2). In addition,
  -the application is run with the JBoss scoped class loader. If you don't
  -need it, you can comment it out from jboss-web.xml (in etc/WEB-INF).
  +the application is run with the JBoss scoped classloader. If you don't
  +need the scoped classloader, you can comment it out from jboss-web.xml (in etc/WEB-INF).
   
   In this example, where necessary the domain model classes have been
   annotated with "@@org.jboss.web.tomcat.tc5.session.AopMarker" and
  @@ -28,42 +28,44 @@
   while a Student can be registered for 0 or more Courses (use of Collection
   here).
   
  -Note that in order to run this example, you will need to have run the JBoss
  -web clustering before (e.g., how to use the load balancer, failvoer, sticky session).
  +Note that in order to run this example, you will need to have run JBoss
  +web clustering before (e.g., know how to use a load balancer, failover, and sticky sessions).
   If you have not done that, please refer to
   http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHA. Please refer to:
    http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfiguringMultipleJBossInstancesOnOneMachine
  -on how to setup two separate JBoss instances on the same machine,
  +for info on how to setup two separate JBoss instances on the same machine,
   and also go through the "Web Clustering" section, specifically, this wiki:
   http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss. It will
  -be a little involved to set it up first to make sure sticky session and
  -loadbalancing is working correctly. But if you use a HW load balancer, I think
  +be a little involved to set it up first to make sure sticky sessions and
  +loadbalancing are working correctly. But if you use a HW load balancer, I think
   life will be easier for you (well, to some extent).
   
  -To run it, 
  +Also, note that this example requires Ant 1.6.5 and higher to run, and the JDK required is 1.4.2 and up.
  +
  +To run it:
   
   1) build the war file (by typing "ant dist -Djboss.config=XXX") where
  -"XXX" is your jboss config directory. (Note that if you have spaces in
  +"XXX" is the path to your jboss config directory (e.g. /home/jdoe/jboss-4.0.4.GA/server/all). That is,
  +you need to define jboss.config first. (Note that if you have spaces in
   your jboss.config path, you can enclose it with "".) This will produce
  -a war file called test-http-scoped-FIELD.war. Also note that this example
  -requires ant 1.6.5 and higher to run, and the JDK required is 1.4.2 and up.
  +a war file called test-http-scoped-FIELD.war under the dist directory.
   
  -Finally, we have bundled a third-party library (qdox.jar) under "lib"
  -directory to support JDK1.4 annotation. This is used for "annoc" target
  -only.
  +Note that we have bundled a third-party library (qdox.jar) under "lib"
  +directory to support JDK1.4 annotation. This is used for the "annoc" target
  +only; it is not needed at runtime.
   
   2) Copy this war file to your jboss clustered deploy directories, an equivalent
    of "all/deploy", e.g.). In my case, they are node0 and node1 (and the jvmRoute that
    I assigned for jk loadbalancer are "node0" and "node1" as well).
   
   3) Start up your 2 JBoss instances. For example, in my case,
  -"run.sh -c node0 -b ${MYTESTIP_1}" and "run.sh -c node1 -b ${MYTESTIP_2}.
  +"run.sh -c node0 -b $MYTESTIP_1" and "run.sh -c node1 -b $MYTESTIP_2".
   
   4) The relevant urls are:
     http://hostX/test-http-scoped-FIELD/setSession.jsp
     http://hostX/test-http-scoped-FIELD/modifyAttribute.jsp
     http://hostX/test-http-scoped-FIELD/getAttribute.jsp
  -here hostX points to the loadbalancer, e.g., Apache.
  +where hostX points to the loadbalancer, e.g., Apache.
   
   You can examine the jsps under the etc directory. Basically, setSession.jsp
   tries to store the POJOS in the http session using session.setAttribute(),
  @@ -74,17 +76,23 @@
   clustered node of 0 & 1):
   a) setSession.jsp (should go to node0)
   b) getAttribute.jsp (go to node0)
  -c) kill node0 and failover to node1
  +c) kill node0 (so the next request will failover to node1)
   d) getAttribute.jsp to validate the values (go to node1 now)
   e) modifyAttribute.jsp to modify the POJOs (go to node1)
   f) restart node0 to join the cluster
   g) kill node1 so it will failover back to node0
  -h) getAttribute.jsp (this is node0)
  +h) getAttribute.jsp (go to node0 now)
  +
  +Note that you can check the session id for the jvmRoute suffix to check which
  +node the request went to.
   
  -Note if you can check the session id postfix for the jvmRoute to make sure which
  -node that the request goes to.
  +When you get to this far, you can also modify the jsps and experiment further!
   
  -When you get to this far, you can also modify your jsp and experiment with it!
  +To help make it easier to use annoc and aopc in your own builds, the example uses an 
  +Ant script PojoCacheTasks.xml that is an independent declaration
  +of the aopc and annoc targets.  A copy of this file can be directly imported into to your 
  +project's build using the ant <import/> task. Take a look at the example's build.xml 
  +to see how this can be used.
   
   Please report problems to the Clustering user forum:
   http://www.jboss.com/index.html?module=bb&op=viewforum&f=64
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +76 -0     jboss-tomcat/docs/examples/FIELDWithAnnotation14/Attic/PojoCacheTasks.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PojoCacheTasks.xml
  ===================================================================
  RCS file: PojoCacheTasks.xml
  diff -N PojoCacheTasks.xml
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ PojoCacheTasks.xml	20 Jul 2006 01:02:26 -0000	1.1.2.1
  @@ -0,0 +1,76 @@
  +<?xml version="1.0"?>
  +
  +<project name="PojoCache tasks">
  +   <!--
  +   Tasks definition for JDK1.4 annoc and aopc. In addition to annotate your POJO with JDK-14 style
  +   annotation, you will also need to define the "source" and "build" directory. It will byte-code
  +   instrumented your POJOs and update them under build directory. You can verify this by doing
  +   a listing there to confirm creation of new (and additional) classes.
  +
  +   To use this, you can use Ant import to import it into you regular build.xml (see the example
  +   build.xml here). You will need to pass in the following properties: user.source, where your java source
  +   is located; user.build, where you output classes is located, and finally user.classpath is the
  +   path element that your java class is using.
  +
  +   Finally, you will also need to specify the jboss installation as a "jboss.config" system property,
  +   e.g., path to "all" directory. The JBoss AS version tested is 4.0.4.
  +   -->
  +
  +   <!-- set local properties for this build -->
  +   <path id="pojocache.lib.classpath">
  +      <!-- set local properties for this build -->
  +      <fileset dir="${lib}">
  +        <include name="qdox.jar" />
  +      </fileset>
  +      <fileset dir="${jboss.lib}">
  +        <include name="javassist.jar" />
  +        <include name="jboss-cache.jar" />
  +      </fileset>
  +      <fileset dir="${jboss.root.lib}">
  +         <include name="jboss-common.jar" />
  +         <include name="concurrent.jar" />
  +      </fileset>
  +      <fileset dir="${jboss.deploy}/tc5-cluster.sar">
  +        <include name="tc5-cluster.aop" />
  +      </fileset>
  +      <fileset dir="${jboss.deploy}">
  +         <include name="jboss-aop.deployer/trove.jar" />
  +         <include name="jboss-aop.deployer/jboss-aspect-library.jar" />
  +      </fileset>
  +   </path>
  +
  +   <path id="jboss.aop.classpath">
  +      <fileset dir="${jboss.deploy}">
  +        <include name="jboss-aop.deployer/jboss-aop.jar" />
  +      </fileset>
  +   </path>
  +
  +   <property name="jbossaop.xml.location" value="${jboss.deploy}/tc5-cluster.sar/META-INF"/>
  +
  +
  +   <!-- pre-compile directory with annotationc using jdk1.4 -->
  +   <target name="annoc" depends="compile" description="Annotation precompiler for aop class">
  +      <taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpathref="jboss.aop.classpath"/>
  +      <annotationc compilerclasspathref="jboss.aop.classpath" bytecode="true">
  +         <classpath refid="pojocache.lib.classpath"/>
  +         <classpath refid="jboss.aop.classpath"/>
  +         <classpath refid="user.classpath"/>
  +         <src path="${user.source}"/>
  +         <!--include name="examples/*.java"/-->
  +         <!--exclude name="test/*.java"/-->
  +      </annotationc>
  +   </target>
  +
  +   <!-- pre-compile directory with aopc -->
  +   <target name="aopc" depends="annoc" description="Precompile aop test classes after annoc">
  +      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="jboss.aop.classpath"/>
  +      <aopc compilerclasspathref="jboss.aop.classpath" verbose="true">
  +         <!-- Can be more specific here -->
  +         <!--src path="${build}/examples"/-->
  +         <src path="${user.build}"/>
  +         <!--classpath refid="jboss.aop.classpath"/-->
  +         <classpath refid="pojocache.lib.classpath"/>
  +         <classpath refid="user.classpath"/>
  +      </aopc>
  +   </target>
  +</project>
  
  
  



More information about the jboss-cvs-commits mailing list