Thanks very much Fintan, I'm close to getting it working, but no cigar.
I think this is because the method I am targetting is inherited.
I have a class called CallForOfferServer which inherits the method
action() from a class called Behaviour as follows:
Behaviour
^
SimpleBehaviour
^
LifeCycle
^
CallForOfferServer
I am trying to advise the action() method only when it is called from the
class CallForOfferServer, but just can't nail it.
Any help would be great. This is my failing code:
*pointcut* callAction() : *call*(* jade.core.behaviours.Behaviour.action())
&& *target*(apoptotic.bookTrading.BookSellerAgent.CallForOfferServer);
*void* *around*( ): callAction()
{
\\ do something
}
Really appreciate your help
Thanks
Rob
On 05/11/2007, Fintan Conway <[EMAIL PROTECTED]> wrote:
>
> Hi Rob,
>
> Instead of a "before" advice, use an "around" advice. With an around
> advice you need to call the method *proceed()* to run the original
> method. Thus in your advice if the security test allows the method to
> proceed you call the proceed() keyword, otherwise skip.
>
> Regards,
>
> Fintan
>
> -----Original Message-----
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Rob Austin
> *Sent:* 05 November 2007 11:44
> *To:* [email protected]
> *Subject:* [aspectj-users] Removing functionality with AspectJ?
>
> Hi there,
>
> I'm completely new to AspectJ and was wondering if there is anyway to
> cause a method to be "skipped" with AspectJ.
>
> Apologies if the question sounds silly, but I am using AspectJ to monitor
> what is going on in an object for security purposes.
>
> If certain conditions have been met, a rule engine implemented in a before
> advice determines that the code in that method should be skipped. Naturally,
> for this to be in anyway feasible, the method in question would need not to
> return anything, something like *
>
> public
> **void* action()
>
> I guess I need something like a decorator pattern that removes
> functionality rather than adds it. The only way I can currently think do to
> this is to use my aspect to change the value of a boolean variable in the
> target method which causes the code to exit without doing anything.
>
> Really appreciate your help
>
> Thanks
>
> Rob
>
>
>
> **
>
> * ** *** ** * ** *** ** * ** *** ** *
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed.
> Any views or opinions presented are solely those of the author, and do not
> necessarily
> represent those of ESB.
> If you have received this email in error please notify the sender.
>
> Although ESB scans e-mail and attachments for viruses, it does not guarantee
> that either are virus-free and accepts no liability for any damage sustained
> as a result of viruses.
>
> Company Registration Information: http://www.esb.ie/companies
> * ** *** ** * ** *** ** * ** *** ** *
>
>
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users