[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] LTW javax package & dyanmic class loading
|
- From: "Andy Clement" <andrew.clement@xxxxxxxxx>
- Date: Mon, 31 Mar 2008 23:16:40 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=rjsGcR2+dOvuyzf01LhjksqKT4XjvcCuEu5FpNFbv0Q=; b=h6uHwtZ87rI2+0ptICkq3UAGlHmeDI2dpUMNIpXj45q2/G//VHWm1ECNfjPPSoduc7FOfQbA+2ddFLCfymOJsWV19xr/PDZDsXt7cPzPCUCZRAUdpP4KYAcZfGjYKpRmqOxm1VXbCImfwkNtqCaM+YkUYGxjmxlhc3L44StkhWU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=t1xa1g9cyVgH81n4/xFf11l+NPTgCFKxM9Kw3/HIZq32Rco1JHA+YJUfLLuw0dTiDF0nFRDq0zsogzdef+2hctMFQaMrapJMX3/scABQntHROpylcC89GFO+Or5iFQDJdn7AFVgfjVoLciQb0ksfV0DsUefWHEO2mSk6UKsv/Rw=
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
>
>