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


This is definetly an area where documentation is lacking...

If you are able to use your own classloader in the hierarchy, a
WeavingURLClassLoader is what you can use - create it (configured with
an aspect path that points to your aspect) and let it load classes.
If you can't plugin in a classloader you may be able to just use the
WeavingAdaptor which can be plugged into any classloader (if you can
modify that classloader).  See how it is used by the

Your easiest option really would be the javaagent - but I guess if you
cant use it, you cant use it...


2010/4/21 Redeemer <redeemer.sk@xxxxxxxxx>:
> 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
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users