[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] LTW javax package & dyanmic class loading
|
On the second question:
> The other question relates to a custom classloader. Again, searching the
> internet gave me useful insight, but not precisely what I was looking for,
> neither are there many examples. What I would like todo is associate certain
> aspects with certain classes -- at runtime. Formulated as a solution:
>
> A custom weave classloader which loads the target class and weaves my
> defined aspects.
>
> I haven't made much progress with this problem. Mostly because the Javadocs
> are useless. The best I got was creating a new WeavingURLClassLoader, but I
> couldn't get it to work with my arguments.. I must be doing something wrong
> in the formatting. Thereby, I would rather have to give it a path to an
> aop.xml, as to be able to declare aspects in a separate file.
>
This has been done - dynamically creating the aspects that will be
woven at runtime. I don't recall specifics unfortunately. I think
initially it was done by writing out aop.xml's then using those.
Subsequently it was changed to supply a custom weaving context
(implementing IWeavingContext).
Andy.
On 27/03/2008, Mark Stobbe <markstobbe@xxxxxxxxx> wrote:
>
>
> Hello all,
>
> I have two questions, both pretty advanced I would think.
>
> My first question relates to weaving of Java core packages. I have searched
> the internet for *working* examples, but I don't seem to be able to find
> any. Could someone please supply me a working example of weaving a java
> class. For example, the following aspect should go around any setVisible
> call, ie:
>
> import java.awt.*;
> import javax.swing.*;
>
> public aspect MyAspect
> void around(Window window): target(window) && call(void
> Window.setVisible(boolean))
> {
> System.out.println("Window.setVisible(..)");
> }
> }
>
> ---
> With aop.xml:
> ---
>
> <aspectj>
> <weaver options="-Xset:weaveJavaPackages=true">
> <include within="*"/>
> <include within="java..*"/>
> <include within="javax..*"/>
> </weaver>
> <aspects>
> <aspect name="MyAspect"/>
> </aspects>
> </aspectj>
>
> However, it doesn't work. Can someone make this work?
>
> =====
> The other question relates to a custom classloader. Again, searching the
> internet gave me useful insight, but not precisely what I was looking for,
> neither are there many examples. What I would like todo is associate certain
> aspects with certain classes -- at runtime. Formulated as a solution:
>
> A custom weave classloader which loads the target class and weaves my
> defined aspects.
>
> I haven't made much progress with this problem. Mostly because the Javadocs
> are useless. The best I got was creating a new WeavingURLClassLoader, but I
> couldn't get it to work with my arguments.. I must be doing something wrong
> in the formatting. Thereby, I would rather have to give it a path to an
> aop.xml, as to be able to declare aspects in a separate file.
>
> I hope I gave enough details for both questions.. hopefully someone can help
> me.
> Mark
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>