Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ and complex system

Oh, I just read this...

>Then, the components of an entity can share the same instance of
> Aspect but two entities cannot share a same instance of aspect.

For those semantics, you probably would want a relational aspect that
only binds Entity instances (or even a perthis/pertarget may suffice).
Depends on your application, really...

Eric

On 03/11/2007, Eric Bodden <eric.bodden@xxxxxxxxxxxxxx> wrote:
> Right, what Dehua proposed allows you to instantiate an aspect per
> executing, called, ... etc. object. If you need more flexibility, you
> might want to consider instead using Relational Aspects, as
> implemented in the AspectBench Compiler (http://tinyurl.com/33p7dm) or
> CaesarJ (http://caesarj.org/). Both allow for a more flexible
> instantiation model.
>
> With a relational aspect, you could for example write:
>
> MyAspect.associate(myEntity, myComponent1);
> MyAspect.associate(myEntity, myComponent2);
>
> This would then declare that both, myComponent1 and myComponent2 are a
> subcomponent of myEntity. You aspect could then look at follows:
>
> relational aspect MyAspect(Entity e, Component c) {
>     String perRelationship;
>     relational after(): call(* *(..)) && target(c) {
>         System.out.println(c+" is part of entity "+e);
>     }
> }
>
> In this aspect, the relational advice is only executed if a method is
> called on a component that has been associated with the aspect, i.e.
> if anything is called on myComponent1 or myComponent2. In the advice
> body, you further have direct access to any enclosing entity, i.e. e
> will here be bound to myEntity. Further, the field "perRelationship"
> exists *for each* entity/component pair and hence allows you to store
> per-relationship state (those semantics hold for any non-static field
> in a relational aspect).
>
> If you are interested in this technology, please drop me a line and I
> can email you our latest version.
>
> Eric
>
> On 03/11/2007, Dehua Zhang <dehua.zhang@xxxxxxxxxxxxxx> wrote:
> >
> > have a look at
> > http://www.eclipse.org/aspectj/doc/released/progguide/quick-aspectAssociations.html
> >
> > --
> > Dehua (Andy) Zhang
> > Sable Research Group, McGill University
> > Montréal, Québec, Canada
> > http://www.cs.mcgill.ca/~dzhang25
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Mahamadou BELEM
> > Sent: Sat 11/3/2007 05:53
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: [aspectj-users] AspectJ and complex system
> >
> > Dear alll
> >
> > I am new in Aspect Technology and I need ome help.
> >
> > I plan to use AspectJ for a complex system development. I want to be sure
> > that AspectJ
> > allows solving my problem.
> > There is my problem:
> > I have a system composed of some entities. Let call them Entity.
> >
> > Each Entity is a compound object composed of a second type of components.
> > Let
> > call them Component. Each component instance is closed to an Entity
> > instance.
> >
> > I want to implement some Aspects that will control the behaviour of my
> > components.  Let call them Aspect.
> >
> > But I want that each instance of Entity instantiates the Aspect class. The
> > components of this entity behaviour will be controlled only by this Aspect
> > instance.  Then, the components of an entity can share the same instance of
> > Aspect but two entities cannot share a same instance of aspect.
> >
> > does AspectJ allow this specification?
> >
> > Please I need your help.
> >
> > Best regards
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
>
>
> --
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top