Skip to main content

[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

Unfortunately no.

I need to be able to get to instance of the plugin (that is calling the method) thus
it has to be in the context of the plugin so that
   this(instance)
pointcut would make that instance available.

--------------------------------------------------
From: "Andrew Eisenberg" <andrew@xxxxxxxxxxxx>
Sent: Thursday, April 22, 2010 5:49 AM
To: <aspectj-users@xxxxxxxxxxx>
Subject: Re: [aspectj-users] Load-time weaving of aspect with dynamically loaded classes

Hi Jozef,

Perhaps I am misunderstanding, but if your class A is a source class
that you control, can you not use execution advice instead of call so
that there is no need for load time weaving?

I'm thinking something like:

pointcut callsToA() : execution (* * A.*(..));

before() : callsToA() {
 doYourStuff();
}

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


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top