[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Re: [NEWSDELIVER] Multiple instances of the same class woven against different aspects in an Eclipse plugin [Cross-post]
|
Didier,
There are 3 possible approaches:
1. Read Adrian's blog: http://www.aspectprogrammer.org/blogs/adrian/2005/03/perinstance_asp.html.
Your class will be woven with all the aspects but you can choose which
ones are active for a given instance.
2. Some AOP frameworks use proxies to
allow advice to be added removed. However this is not yet supported by
AspectJ
3. Create 2 different subclasses of
C and weave those with the desired aspects.
Cheers
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM 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/
To:
Matthew Webster/UK/IBM@IBMGB
cc:
Subject:
Re: [NEWSDELIVER]
Multiple instances of the same class woven against different aspects in
an Eclipse plugin [Cross-post]
Hi Mattew!
Thanks for your quick answer.
Let me give you an example of what i try to achieve:
I've got a class C, and two aspect A1 and A2 and i need to instanciate
some instance of C with application of A1 and some instance of C with
application of A2.
As a real-world example, i could say:
I've got base implementation C of a graph of processing node.
A1 is the composition of three aspects: event management (aka observer),
assertions checkings and change collection/application/propagation on
the network
A2 is the composition of two aspects: change
collection/application/propagation on the network and mapping to an
external processor.
Thus in the same VM i may use two versions of C.
Am I more clear ?
Thanks for your help!
Didier.
Matthew Webster wrote:
>
> Didier,
>
> >I try to write an RCP app in which i need multiple instances of
the same
> >classes woven against different aspects.
> I'm not quite sure I understand what you are trying to do. The JVM
> will only allow one version of a class in the system at once unless
> they are defined in different, unrelated bundles. Can you explain
what
> you are trying to achieve.
>
> The simplest way to try LTW is to use the Java 5 agent
> (http://www.eclipse.org/aspectj/doc/next/adk15notebook/ltw-agents.html).
> We have also just launched an Equinox incubator project to better
> support aspects in OSGi
> (http://www.eclipse.org/equinox/incubator/aspects/index.php). Over
the
> next few weeks we will be filling out the Web site and populating
the
> repository.