Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] checkpoint

You need to use control-flow based pointcut. Try the following
modified advice:

>   String around(String tablename,Vector values): 
>      insert_checkpoint(tablename,values)
       && !cflowbelow(insert_checkpoint(String, Vector))
>   {
>     .....
>   }

This will prevent advice being applied to insert called
from insertExp().

-Ramnivas

--- lily lily <lixiaojiao@xxxxxxxxxxx> wrote:
> Hi:
> I want to write an aspect which will be executed before the insert
> and 
> insertExp method.
> 
> The insert method is like this:
> public String insert(String tablename, Vector values)
> {
>   ...
> }
> 
> The insertExp methos is like this:
> public String insertExp(String tablename, Vector values)
> {
>   ...
>   insert(table,values); //call the insert method inside insertExp
> ...
> }
> 
> And the aspect is like this:
> aspect AccessControl
> {
> 
>   pointcut insert_checkpoint(String tablename,Vector values):
>     within(tableBean) && execution(public String 
> tableBean.insert(String,Vector))
>     || execution(public String tableBean.insertExp(String,Vector)) &&
> 
> args(tablename,values);
> 
>   String around(String tablename,Vector values): 
> insert_checkpoint(tablename,values)
>   {
>     .....
>   }
> 
> }
> 
> The problem is that,the aspect will be executed before every insert
> and 
> insertExp method,
> including the one which is called inside the insertExp method. But
> this is 
> not what I want. I do not
> want the insert method being called inside insertExp method to be
> disturbed. 
> That is , the aspect
> should be executed only before insertExp, but not before the insert
> method 
> within the insertEXp body.
> 
> Is there any idea? I know there must be a way to solve it.
> 
> Thank you for your help.
> 
> Lily
> 
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online  
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


Back to the top