[jboss-cvs] JBossAS SVN: r62909 - projects/aop/trunk/aop/docs/examples/metadata.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 8 17:40:29 EDT 2007


Author: kabir.khan at jboss.com
Date: 2007-05-08 17:40:29 -0400 (Tue, 08 May 2007)
New Revision: 62909

Modified:
   projects/aop/trunk/aop/docs/examples/metadata/build.xml
   projects/aop/trunk/aop/docs/examples/metadata/metadata.html
Log:
[JBAOP-399] metadate example working with repackaging

Modified: projects/aop/trunk/aop/docs/examples/metadata/build.xml
===================================================================
--- projects/aop/trunk/aop/docs/examples/metadata/build.xml	2007-05-08 21:19:06 UTC (rev 62908)
+++ projects/aop/trunk/aop/docs/examples/metadata/build.xml	2007-05-08 21:40:29 UTC (rev 62909)
@@ -1,52 +1,35 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<project default="run" name="JBoss/AOP">
-   <target name="prepare">
-      <property name="jboss.aop.root" value="../../../.."/>
-      <property name="jboss.aop.lib" value="${jboss.aop.root}/lib"/>
-      <property name="jboss.aop.lib50" value="${jboss.aop.root}/lib-50"/>
+<project default="usage" name="JBoss/AOP">
 
-      <path id="jboss.aop.classpath">
-         <fileset dir="${jboss.aop.lib}">
-            <include name="*.jar"/>
-         </fileset>
-      </path>
+   <import file="../examples-build.xml"/>
 
-      <path id="jboss.aop.classpath50">
-         <fileset dir="${jboss.aop.lib50}">
-            <include name="*.jar"/>
-         </fileset>
-      </path>
+   <target name="annotationc" depends="_prepare">
+      <!-- The annotation compiler only exists in the jdk 1.4 dist -->
+      <taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpathref="jboss.aop.classpath14"/>
+      <annotationc compilerclasspathref="classpath14" classpathref="classpath14" output="metadata-aop.xml" xml="true">
+         <src path="."/>
+      </annotationc>
+   </target>
 
-      <path id="classpath">
-         <path refid="jboss.aop.classpath"/>
-         <pathelement path="."/>
-      </path>
+   <target name="aopc50" depends="_compile50, annotationc">
+      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="jboss.aop.classpath50"/>
 
-      <property name="aop50jar" value="${jboss.aop.lib50}/jboss-aop-jdk50.jar"/>
+      <aopc compilerclasspathref="classpath50" classpathref="classpath50" verbose="true">
+         <classpath path="."/>
+         <src path="."/>
+         <aoppath>
+            <pathelement path="jboss-aop.xml"/>
+            <pathelement path="metadata-aop.xml"/>
+         </aoppath>
+      </aopc>
 
-      <path id="classpath50">
-         <path refid="jboss.aop.classpath50"/>
-         <pathelement path="."/>
-      </path>
-
-      <taskdef name="annotationc" classname="org.jboss.aop.ant.AnnotationC" classpathref="jboss.aop.classpath"/>
-      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="jboss.aop.classpath"/>
    </target>
 
-   <target name="compile" depends="prepare">
-      <annotationc compilerclasspathref="classpath" classpathref="classpath" output="metadata-aop.xml" xml="true">
-         <src path="."/>
-      </annotationc>
-      <javac srcdir="."
-         destdir="."
-         debug="on"
-         deprecation="on"
-         optimize="off"
-         includes="**">
-         <classpath refid="classpath"/>
-      </javac>
-      <aopc compilerclasspathref="classpath" classpathref="classpath" verbose="true">
+   <target name="aopc14" depends="_compile14, annotationc">
+      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="jboss.aop.classpath14"/>
+
+      <aopc compilerclasspathref="classpath50" classpathref="classpath14" verbose="true">
          <classpath path="."/>
          <src path="."/>
          <aoppath>
@@ -54,35 +37,51 @@
             <pathelement path="metadata-aop.xml"/>
          </aoppath>
       </aopc>
+
    </target>
 
-   <target name="run" depends="compile">
+   <target name="run.aopc.50" depends="aopc50">
       <java fork="yes" failOnError="true" className="Driver">
          <sysproperty key="jboss.aop.path" value="metadata-aop.xml${path.separator}jboss-aop.xml"/>
-         <classpath refid="classpath"/>
+         <classpath refid="classpath50"/>
       </java>
    </target>
 
-   <target name="compile50standalone" depends="prepare">
-      <annotationc compilerclasspathref="classpath" classpathref="classpath" output="metadata-aop.xml" xml="true">
-         <src path="."/>
-      </annotationc>
-      <javac srcdir="."
-         destdir="."
-         debug="on"
-         deprecation="on"
-         optimize="off"
-         includes="**">
+   <target name="run.loadtime.50" depends="_compile50, annotationc">
+      <java fork="yes" failOnError="true" className="Driver">
+         <sysproperty key="jboss.aop.path" value="metadata-aop.xml${path.separator}jboss-aop.xml"/>
          <classpath refid="classpath50"/>
-      </javac>
+         <jvmarg value="-javaagent:${aop50jar}"/>
+      </java>
    </target>
 
-   <target name="run.50.instrumented" depends="compile50standalone">
+   <target name="run.aopc.14" depends="aopc14">
       <java fork="yes" failOnError="true" className="Driver">
          <sysproperty key="jboss.aop.path" value="metadata-aop.xml${path.separator}jboss-aop.xml"/>
-         <jvmarg value="-javaagent:${aop50jar}"/>
-         <classpath refid="classpath50"/>
+         <classpath refid="classpath14"/>
       </java>
    </target>
 
+   <target name="run.loadtime.14" depends="_compile14, annotationc">
+      <!-- Create the classloader hook -->
+      <mkdir dir="jboss.aop.lib14/jdk14hook"/>
+      <java fork="yes" classname="org.jboss.aop.hook.GenerateInstrumentedClassLoader">
+         <classpath>
+            <path refid="jboss.aop.classpath14"/>
+         </classpath>
+         <arg value="${jboss.aop.lib14}/jdk14hook"/>
+      </java>
+
+      <path id="bootclasspath">
+         <pathelement location="${jboss.aop.lib14}/jdk14hook"/>
+         <path refid="jboss.aop.classpath14"/>
+      </path>
+      <property name="bootclasspath" refid="bootclasspath"/>
+
+      <java fork="yes" failOnError="true" className="Driver">
+         <sysproperty key="jboss.aop.path" value="metadata-aop.xml${path.separator}jboss-aop.xml"/>
+         <jvmarg value="-Xbootclasspath/p:${bootclasspath}"/>
+         <classpath path="."/>
+      </java>
+   </target>
 </project>

Modified: projects/aop/trunk/aop/docs/examples/metadata/metadata.html
===================================================================
--- projects/aop/trunk/aop/docs/examples/metadata/metadata.html	2007-05-08 21:19:06 UTC (rev 62908)
+++ projects/aop/trunk/aop/docs/examples/metadata/metadata.html	2007-05-08 21:40:29 UTC (rev 62909)
@@ -6,7 +6,14 @@
 </p><p>
 <h4>Overview</h4>
 
-JBoss Metadata is alot like JDK 5's annotations(<a href="http://www.jcp.org/en/jsr/detail?id=175">JSR-175</a>) except it is driven and applied through XML.  JBossAOP has the ability to define metadata in XML or as Doclet tags that are then parsed to generate XML when you are not using JDK 5 or higher.  You can use the same pointcut annotation expressions to reference JBossAOP XML metadata expressions.  This metadata is different than regular JDK annotations in that they are untyped.  If you've read the <a href="../annotations14/annotation.html">Annotations with JDK 1.4</a>.  You can handcode this XML or have the Annotation compiler generate them from doclet tags using the -xml option.
+JBoss Metadata is alot like JDK 5's annotations(<a href="http://www.jcp.org/en/jsr/detail?id=175">JSR-175</a>) except it is
+driven and applied through XML.  JBossAOP has the ability to define metadata in XML or as Doclet tags that are then parsed to
+generate XML when you are not using JDK 5 or higher.  You can use the same pointcut annotation expressions to reference JBossAOP
+XML metadata expressions.  This metadata is different than regular JDK annotations in that they are untyped.  If you've read
+the <a href="../annotation14/annotation.html">Annotations with JDK 1.4</a>.  You can handcode this XML or have the Annotation
+compiler generate them from doclet tags using the -xml option. Having run this example, you can find the metadata in
+<i>metadata-aop.xml</i>.
+
 </p><p>
 <h4>Example code</h4>
 
@@ -71,14 +78,15 @@
 </p><p>
 <h4>Running</h4>
 
-To compile and run:
+<b>THIS EXAMPLE REQUIRES JDK 5!! For other options, please look at the
+<a href="../valid_targets_not_annotated.html"/>non-annotated examples guide</a></b> To compile and run:</p>
 <pre>
-  $ ant
+  $ run.aopc.50
 </pre>
 It will run the annotationc compiler on the source files to generate metadata in metadata-aop.xml, then javac the files and then run the AOPC precompiler to manipulate the bytecode, then finally run the example. Note that there are two XML aop deployment descriptors: metadata-aop.xml and jboss-aop.xml.  The System Property jboss.aop.path can accept a list of files delimited by the platform classpath separator. ';' on windows ':' on unix. Running the example should produce:
 </p><p>
 <pre>
-run:
+run.aopc.50:
      [java] --- new POJO(); ---
      [java] billing amount: $0.01
      [java] &lt;&lt;&lt; Trace : executing constructor public POJO()




More information about the jboss-cvs-commits mailing list