Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Question about advising an advice

Hi Herbey,

I'm glad you are seeing value in aspects. 

I am not entirely sure what you are asking. I think AspectJ works well in a
variety of development styles: for agile development, it provides modularity
to more effectively refactor common patterns (Ramnivas Laddad and Miguel
Monteiro have some great articles on this). For more formal development
processes, it also fits naturally to allow decomposition, and there are
books by Clarke and Baniassad and Jacobson and Ng about these too.

AOP can significantly help in improving manageability and security in
computer systems, both of which are important crosscutting concerns.

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Zepeda, Herbey
Sent: Wednesday, September 21, 2005 3:58 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Question about advising an advice

Thank you very much Ron,

I am in the process of planning a new project using AOP. Tjis is enough
to keep me starting for now!!. On the other hand I have a question hope
you can help me with
 
1) What role if such, does aspectj play within the rapid application
development area? Do you have a recommendation regarding a reliable
source for this info? I found some applications in the VLSI design but
not abundant. I am more geared towards secure-but-manageable computer
systems.

Thank you again

Herbey

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
Sent: Wednesday, September 21, 2005 1:26 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Question about advising an advice

Hi Herbey,
 
You might want to just advise the different call join points that occur
within Advised. You could also use cflow to do what you are looking for,
e.g., this matches calls caused by advice execution. If you do NOT want
to
match calls from helper methods, you could exclude those too, although
it's
rare you'd want to do that.
 
aspect Advisor {
    before(): cflow(adviceexecution() && within(Advised)) && call (void
myFun()) { ... }
...
}

I'm not sure what you are looking to do depending on the methods being
called. In some cases you might want to use the AspectJ reflection API
(e.g., if you want to track the method name and parameters), rather than
explictly address the various cases.

A related problem that I've seen is the need to distinguish among
different
advices, which of course aren't named. With Java 5 and AspectJ 5 you
could
use annotations and write a pointcut to match those. For earlier JVM's,
you
can use static inner aspects to give a name to a specific piece of
advice,
e.g.,
 
aspect Advised {
    public pointcut firstpc() : call(* coreClass.fun(..))

    private static aspect SayHello {
        before():firstpc() {
            System.out.println("Hi");
            Advised.aspectOf().myFun();
        }
    }
    ...
}

// assumes you want to distinguish between the different adviceexecution
join points, rather than the calls made from the same advice
aspect Advisor {
    before(): adviceexecution() && within(SayHello) { ... }
...
} 


 

 
________________________________

From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Zepeda, Herbey
Sent: Wednesday, September 21, 2005 10:15 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Question about advising an advice



Hi

 

I have being trying to advice an advice in one aspect using it as the
join
point, with another advice in another aspect.

 

The syntax is something like:

 

Aspect advisor

{

            before(): adviceexecution() && within(advised)

{

            Do something.

}

}

 

Aspect advised

{

            Public pointcut firstpc() :call(* coreClass.fun(..))

before():firstpc()

 {

            System.out.println("Hi");

            myFun();

}

Public void myFun()

{

            System.out.println("Hi Inner fun");

}

 

}

 

coreClass

{

Definition.

Public void fun()

{

Do something

}

 

}

 

--------------

 

When I run this code it works, however, I am not being able to go into
more
detail, I want to specify an advice in the advisor aspect which advices
a
specific function,

For example, in the advised aspect in the advice we have two function
calls,
one to System.out... and the other one to myFun, I want to be able to
differentiate (create a different join point) for the System. and for
myFun
so that the advisor aspect performs different activities for calls to
the
different functions. Something like:

 

Aspect advisor

{

            before(): adviceexecution() && within(advised) && call (void
myFun())

{

            Do something.

}

 

before(): adviceexecution() && within(advised) && call (void
System.*(..))

{

            Do something else.

}

 

}

 

I have tried to run the latter and similar approaches but have not being
successful. I know it can be done as it is mentioned in page 50 of the
book
(AspectJ in action) but have not figured it out, do you have an idea of
how
can I solve this problem?

 

Thank you

 

Herbey

 

 

 


_______________________________________________
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