Re: [aspectwerkz-user] Expression problem

Alexandru Popescu <[email protected]> Mon, 30 May 2005 11:32:36 +0200
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
#: on behalf of Simon Faress :: 5/30/2005 10:02 AM :#
> Thanks for your reply alex.
> 
> I tried your solution but it does not work. My avice
> is never used ...
> 
> Another solution ?
> 
> --- Alexandru Popescu <[email protected]> a
> écrit:
>> #: on behalf of Simon Faress :: 5/26/2005 5:37 PM :#
>> > Hi,
>> > 
>> > I can advice the execution of every methods under
>> the
>> > package com.myProject by using this expression :
>> > execution(* com.myProject..*.*(..))
>> > 
>> > But now, I would like to advice the execution of
>> every
>> > methods under the package com.myProject excepted
>> > getter and setters. But I can't make it work.
>> > 
>> > My XML looks like this :
>> > 
>> > <!DOCTYPE aspectwerkz PUBLIC
>> "-//AspectWerkz//DTD//EN"
>> >
>>
> "http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
>> > <aspectwerkz>
>> >     <system id="sequence">
>> >         <package
>> >
>> name="com.myOtherProject.composant.aspect.sequence">
>> >             <aspect class="SequenceAspect">
>> >                 <pointcut name="sequence_pc"
>> > expression="execution(* com.myProject..*.*(..))
>> AND
>> > !withincode(* com.myProject..*.get*(..)) AND
>> > !withincode(* com.myProject..*.set*(..)) " />
>> > 				<advice name="beforeExecution" type="before"
>> > bind-to="sequence_pc" />
>> > 				<advice name="afterExecution" type="after"
>> > bind-to="sequence_pc" />
>> >             </aspect>
>> >         </package>
>> >     </system>
>> > </aspectwerkz>
>> > 
>> > What am I doing wrong ?
>> > 
>> > Any help would be muchly appreciated
>> > 
>> > 
>> > 	
>> > 
>> > 	
>> > 		
>> >
>>
> _____________________________________________________________________________
>> 
>> > Découvrez le nouveau Yahoo! Mail : 1 Go d'espace
>> de stockage pour vos mails, photos et vidéos ! 
>> > Créez votre Yahoo! Mail sur
>> http://fr.mail.yahoo.com
>> > 
>> This should work:
>> 
>> pointcut_all_methods: execution(* foo.bar..*.*(..))
>> pointcut_get_methods: execution(*
>> foo.bar..*.get(..))
>> pointcut_set_methods: execution(*
>> foo.bar..*.set(..))
>> 
>> your_pointcut pointcut_all_method &&
>> !pointcut_get_methods && !pointcut_set_methods
>> 
>> :alex |.::the_mindstorm::.|
>> 
> 
> 
> 	
> 
> 	
> 		
> _____________________________________________________________________________ 
> Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, photos et vidéos ! 
> Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com
> 

Simon it should definitely work ;-). Try reducing the scopes of the pointcuts to some single class
and see if it gets weaved. Also you can enable the AW logging to find out more about what's
happening behind the scenes. I think these may help you:

-Daspectwerkz.transform.details=true
-Daspectwerkz.transform.verbose=true
-Daspectwerkz.transform.dump=* (and than with a bytecode tool see if the bytecode is there).

:alex |.::the_mindstorm::.|