To develop Aspects using AspectJ you can follow my Blog.
After implementing there comes the work of automating the build process. Since, we use Hudson for build, it can be configured to run an Ant script.
Following are the Jars required in classpath for Ant Script:
1. aspectjtools.jar
2. aspectjrt.jar
You can get the latest release of these Jar from here.
Create following task definition:
<taskdef name="ajc"
classname="org.aspectj.tools.ant.taskdefs.Ajc10" >
<classpath>
<pathelement location="${aspectjtools.loc}"/>
</classpath>
</taskdef>
The code will compiled and weaved using AspectJ compiler which in turn runs on the top of JVM . Hence we can say that all AspectJ compiled code is a valid Java Program.
The compiler's performance is dependent on the performance of the JVM it is running on, so the faster a JVM you can find to run it on, the shorter your compile times will be. At a minimum you need to use a Java 2 or later JVM to run the compiler (J2SE 1.3 for AspectJ 1.1)
Some more faqs and QA’s on AspectJ and ajc compiler can be accessed from here.
Following is build.xml which is created for the code in my previous Blog on Aspects Development using AspectJ . The code can be accessed here.
<project name="AspectJProject" basedir=".">
<property name="aspectjrt.loc" value="war/lib/aspectjrt.jar" />
<property name="build.loc" value="war/classes" />
<property name="aspectjtools.loc" value="war/lib/aspectjtools.jar" />
<property name="src.loc" value="src" />
<taskdef name="ajc"
classname="org.aspectj.tools.ant.taskdefs.Ajc10" >
<classpath>
<pathelement location="${aspectjtools.loc}"/>
</classpath>
</taskdef>
<target name="compile" >
<delete dir="${build.loc}" quiet="true" />
<mkdir dir="${build.loc}"/>
<ajc destdir="${build.loc}" srcdir="${src}">
<classpath>
<pathelement location="${aspectjrt.loc}"/>
</classpath>
</ajc>
</target>
</project>
1 comment:
Very helpful article ! I was always curious about all these complex algorithms that are being used in these ssl encryptions.
Post a Comment