[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] LTW weaving with foreign code
|
It occurred to me that I can improve the quality of my question by
putting it this way:
Suppose I ( went crazy and ) wanted to have every method call in the
JDK report soemthing along the lines of
System.out.println(
"------------------- Aspect Advice Logic --------------------");
System.out.println(
"In the advice attached to the call point cut");
System.out.println("Captured target object for the method call: "
+ myObject);
System.out.println(
"------------------------------------------------------------");
I need just one aspect to do this, I'll call it the *.* aspect for
obvious reasons.
How would I invoke the VM and what System variables (if any) would I
have had to define?
I am not having trouble with aspectJ conceptually, but setting up all
the system bits with understanding what needs to be where on my machine
and environment and what magic incantation needs to be used and where
has me stumped.
On 3/28/2012 2:27 PM, Andy Clement wrote:
Hi,
Best solution is to use the agent:
java -javaagent:pathtoaspectj/lib/aspectjweaver.jar SomeMainClass
The weaver will discover its configuration from the CLASSPATH. It
will look out for a file META-INF/aop.xml (or META-INF/aop-ajc.xml)
and use that to configure the weaving.
A typical aop xml might be
<aspectj>
<aspects>
<aspect name="SomeAspect"/>
</aspects>
</aspectj>
But you can create one by passing -outxml when you compile the
aspects. The one created will simply include entries for all aspects
it compiled.
If you need to know about what is going on you can add a weaver
section into the aspectj section:
<weaver options="-debug"/>
cheers,
Andy
On 28 March 2012 11:16, trhouse<trhouse@xxxxxxxxx> wrote:
Hi all,
I am attempting to set up some LTW with a foreign (.class files only) code
base.
After having read the documentation I am not sure what is required.
Specifically
If I provide
-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader
as a VM option, is this sufficient or do I also need to
1) have to set ASPECTPATH as a system variable or is this just for
developing aspects?
2 have to set the ASPECTJ_HOME as a system variable or is this just for
developing aspects when I compile with AJC?
3) add aspectjrt.jar to my CLASSPATH system variable or is this just for
developing aspects when I compile with AJC?
4) somehow include lib/aspectjrt.jar and aspectjweaver.jar to the runtime?
So the idea is clear, I have foreign code. I have aspects already compiled.
I just want to run the foreign code as usual, but have the LTW apply itself
and execute the aspects as appropriate.
Many thanks...
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users