[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Re: enabling and disabling aspects dynamically
|
Davi,
This topic has been discussed before
(although I cannot quickly find an example). AspectJ does not explicitly
provide such a mechanism although other AOP frameworks have in the past.
The simplest solution is for each aspect to have an "enabled"
property that can be set at run-time which is use in conjunction with an
if() pointcut for each piece of advice for the most efficient implementation.
You checkbox would then call enable/disable on the aspect accordingly.
You may also like to look at Adrian
Colyer's blog entry about using aspects with Spring: http://www.aspectprogrammer.org/blogs/adrian/2004/05/using_aspectj_w.html.
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM United Kingdom Limited
Hursley Park, Winchester, SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/
"Davi Pires"
<inhodpr@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx
01/02/2007 20:44
Please respond to
aspectj-users@xxxxxxxxxxx |
|
To
| aspectj-users@xxxxxxxxxxx
|
cc
|
|
Subject
| [aspectj-users] Re: enabling and disabling
aspects dynamically |
|
Adding more information...
I know you can load and unload classes dynamically using your own classloaders
[1][2][3]. Does anyone knows if this works for aspects too?
thanks again,
Davi
[1] http://www.cas.unt.edu/~vgb002/Java%20Discussion%20Forums%20-%20Classloader%20unload%20class.htm
[2] http://blog.taragana.com/index.php/archive/how-to-unload-java-class/
[3] http://www.exampledepot.com/egs/java.lang/ReloadClass.html?l=rel
On 2/1/07, Davi Pires <inhodpr@xxxxxxxxx>
wrote:
Hi all,
Is it possible to enable or disable the use of a specific aspect at runtime?
One simple example would be: I have a class that defines a Frame with a
button and two checkboxes. The behaviour of the button is affected by two
aspects, that might be enabled or not based on the value of the checkboxes.
I know I could do it using if's and other simpler things, but I'm really
curious about this.
thanks,
Davi
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU