Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Load-time weaving of aspect with dynamically loaded classes

Hello
 
I am working on a system, that supports dynamically loaded 3rd party plugins (have
no source code nor bytecode of them in advance). In the system, there is a particular
class (in the sources I am coding), say A, and I need to be able to define an advice
that gets executed whenever any of these plugins calls some methods on any instance
of A.
 
So, I made an aspect that catches those calls and defines the advice. Now I have
an aspect bytecode as well (thanks to eclipse).
 
Now it seems that what I need to make it working, is a load-time weaving mechanism,
so that whenever the plugin class is dynamically loaded, its weaven with the aspect.
To get it complicated, I have to avoid running the system with 'aj' or with weaving agent.
 
Having the 2 options of 3 total for load-time weaving restricted, it seems that what I need
to do is to use some magic with WeavingURLClassLoader and let it load the plugins.
 
Can anybody please give me a hint how to do that ? Because I have no clue how to use it to
make it to do just that. Is that really what I need and Is what I need even possible ?
 
Thanks in advance
Jozef

Back to the top