|
From: Matthew E. P. <ma...@me...> - 2004-01-05 05:43:48
|
I have written a class implementing MethodInterceptor. Currently, the class checks the method name to decide whether or not to apply the interceptor logic. I am curious if there is a better way to do this in Spring. It would be nice if there was a way to specify the method names in the applicationContext.xml. All help/advice is appreciated! Cheers, matthew |
|
From: Ross M. <ro...@at...> - 2004-01-05 06:34:00
|
Hi Matthew, I think you can create an Advisor such as DefaultInterceptionAroundAdvisor add your MethodInterceptor as a ref and also define a PointCut. The PointCut is a composition of a MethodMatcher and ClassFilter. Your MethodMatcher implementation could accept, say a regex (which can be configured in the applicationContext.xml) to filter the correct methods. I haven't really played with the aop stuff so I may be off the mark, but sounds sensible to me... ;-) Cheers, Ross btw Happy new year! Matthew E. Porter wrote: > I have written a class implementing MethodInterceptor. Currently, the > class checks the method name to decide whether or not to apply the > interceptor logic. I am curious if there is a better way to do this in > Spring. It would be nice if there was a way to specify the method names > in the applicationContext.xml. > > All help/advice is appreciated! > > > Cheers, > matthew > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: Rod J. <rod...@in...> - 2004-01-05 09:16:15
|
Ross You're on the right track. There is actually a RegExpPointcut, which should enable you to move the matching rule into XML. Please feedback any comments about its usability, as we may try to improve it for 1.0 final. In general, the interceptor should not do matching, unless the matching is relevant to it's work (e.g. it behaves differently for methods starting with some prefix, returning void, or whatever). Even in that case, it might be better to use several simpler interceptors with corresponding pointcuts to facilitate reuse. Regards, Rod ----- Original Message ----- From: "Ross Mason" <ro...@at...> To: <spr...@li...> Sent: Monday, January 05, 2004 6:33 AM Subject: Re: [Springframework-developer] Method Interception By Name > Hi Matthew, > > I think you can create an Advisor such as > DefaultInterceptionAroundAdvisor add your MethodInterceptor as a ref and > also define a PointCut. The PointCut is a composition of a MethodMatcher > and ClassFilter. Your MethodMatcher implementation could accept, say a > regex (which can be configured in the applicationContext.xml) to filter > the correct methods. > > I haven't really played with the aop stuff so I may be off the mark, but > sounds sensible to me... ;-) > > Cheers, > > Ross > > btw Happy new year! > > Matthew E. Porter wrote: > > > I have written a class implementing MethodInterceptor. Currently, the > > class checks the method name to decide whether or not to apply the > > interceptor logic. I am curious if there is a better way to do this in > > Spring. It would be nice if there was a way to specify the method names > > in the applicationContext.xml. > > > > All help/advice is appreciated! > > > > > > Cheers, > > matthew > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: IBM Linux Tutorials. > > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: John K.W. <jo...@sl...> - 2004-01-05 14:04:47
|
What would improve usability in this area would be the chapter on AOP in the docs which hasn't been written yet. I spent about a day poring through the source and the tests to find some examples of how to make all this work. It's definitely non-obvious at the moment. Some of the class names are really quite hideous, also. That all being said, it seemed to work as advertised once I understood what was going on. :) John On Jan 5, 2004, at 1:15 AM, Rod Johnson wrote: > Ross > > You're on the right track. There is actually a RegExpPointcut, which > should > enable you to move the matching rule into XML. Please feedback any > comments > about its usability, as we may try to improve it for 1.0 final. > > In general, the interceptor should not do matching, unless the > matching is > relevant to it's work (e.g. it behaves differently for methods > starting with > some prefix, returning void, or whatever). Even in that case, it might > be > better to use several simpler interceptors with corresponding > pointcuts to > facilitate reuse. > > Regards, > Rod > > ----- Original Message ----- > From: "Ross Mason" <ro...@at...> > To: <spr...@li...> > Sent: Monday, January 05, 2004 6:33 AM > Subject: Re: [Springframework-developer] Method Interception By Name > > >> Hi Matthew, >> >> I think you can create an Advisor such as >> DefaultInterceptionAroundAdvisor add your MethodInterceptor as a ref >> and >> also define a PointCut. The PointCut is a composition of a >> MethodMatcher >> and ClassFilter. Your MethodMatcher implementation could accept, say a >> regex (which can be configured in the applicationContext.xml) to >> filter >> the correct methods. >> >> I haven't really played with the aop stuff so I may be off the mark, >> but >> sounds sensible to me... ;-) >> >> Cheers, >> >> Ross >> >> btw Happy new year! >> >> Matthew E. Porter wrote: >> >>> I have written a class implementing MethodInterceptor. Currently, >>> the >>> class checks the method name to decide whether or not to apply the >>> interceptor logic. I am curious if there is a better way to do this >>> in >>> Spring. It would be nice if there was a way to specify the method >>> names >>> in the applicationContext.xml. >>> >>> All help/advice is appreciated! >>> >>> >>> Cheers, >>> matthew >>> >>> >>> >>> ------------------------------------------------------- >>> This SF.net email is sponsored by: IBM Linux Tutorials. >>> Become an expert in LINUX or just sharpen your skills. Sign up for > IBM's >>> Free Linux Tutorials. Learn everything from the bash shell to sys > admin. >>> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click >>> _______________________________________________ >>> Springframework-developer mailing list >>> Spr...@li... >>> https://lists.sourceforge.net/lists/listinfo/springframework- >>> developer >>> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: IBM Linux Tutorials. >> Become an expert in LINUX or just sharpen your skills. Sign up for >> IBM's >> Free Linux Tutorials. Learn everything from the bash shell to sys >> admin. >> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-developer >> > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for > IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys > admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Rod J. <rod...@in...> - 2004-01-05 14:11:18
|
John I know doco is lacking in this area. I'm gradually adding to the AOP docs, although due to time constraints, only at the rate of about half an hour a day until the end of the month, when I should have time to finish it off properly. Which class names do you consider hideous? I'm wondering whether it's AOP-speak hideousness or Spring hideousness. It might be possible to address the latter category of hideousness (although we want to keep changes to a minimum until 1.0 final). Regards, Rod ----- Original Message ----- From: "John K.Watson" <jo...@sl...> To: <spr...@li...> Sent: Monday, January 05, 2004 2:04 PM Subject: Re: [Springframework-developer] Method Interception By Name > What would improve usability in this area would be the chapter on AOP > in the docs which hasn't been written yet. I spent about a day poring > through the source and the tests to find some examples of how to make > all this work. It's definitely non-obvious at the moment. Some of the > class names are really quite hideous, also. That all being said, it > seemed to work as advertised once I understood what was going on. :) > John > > On Jan 5, 2004, at 1:15 AM, Rod Johnson wrote: > > > Ross > > > > You're on the right track. There is actually a RegExpPointcut, which > > should > > enable you to move the matching rule into XML. Please feedback any > > comments > > about its usability, as we may try to improve it for 1.0 final. > > > > In general, the interceptor should not do matching, unless the > > matching is > > relevant to it's work (e.g. it behaves differently for methods > > starting with > > some prefix, returning void, or whatever). Even in that case, it might > > be > > better to use several simpler interceptors with corresponding > > pointcuts to > > facilitate reuse. > > > > Regards, > > Rod > > > > ----- Original Message ----- > > From: "Ross Mason" <ro...@at...> > > To: <spr...@li...> > > Sent: Monday, January 05, 2004 6:33 AM > > Subject: Re: [Springframework-developer] Method Interception By Name > > > > > >> Hi Matthew, > >> > >> I think you can create an Advisor such as > >> DefaultInterceptionAroundAdvisor add your MethodInterceptor as a ref > >> and > >> also define a PointCut. The PointCut is a composition of a > >> MethodMatcher > >> and ClassFilter. Your MethodMatcher implementation could accept, say a > >> regex (which can be configured in the applicationContext.xml) to > >> filter > >> the correct methods. > >> > >> I haven't really played with the aop stuff so I may be off the mark, > >> but > >> sounds sensible to me... ;-) > >> > >> Cheers, > >> > >> Ross > >> > >> btw Happy new year! > >> > >> Matthew E. Porter wrote: > >> > >>> I have written a class implementing MethodInterceptor. Currently, > >>> the > >>> class checks the method name to decide whether or not to apply the > >>> interceptor logic. I am curious if there is a better way to do this > >>> in > >>> Spring. It would be nice if there was a way to specify the method > >>> names > >>> in the applicationContext.xml. > >>> > >>> All help/advice is appreciated! > >>> > >>> > >>> Cheers, > >>> matthew > >>> > >>> > >>> > >>> ------------------------------------------------------- > >>> This SF.net email is sponsored by: IBM Linux Tutorials. > >>> Become an expert in LINUX or just sharpen your skills. Sign up for > > IBM's > >>> Free Linux Tutorials. Learn everything from the bash shell to sys > > admin. > >>> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > >>> _______________________________________________ > >>> Springframework-developer mailing list > >>> Spr...@li... > >>> https://lists.sourceforge.net/lists/listinfo/springframework- > >>> developer > >>> > >> > >> > >> ------------------------------------------------------- > >> This SF.net email is sponsored by: IBM Linux Tutorials. > >> Become an expert in LINUX or just sharpen your skills. Sign up for > >> IBM's > >> Free Linux Tutorials. Learn everything from the bash shell to sys > >> admin. > >> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > >> _______________________________________________ > >> Springframework-developer mailing list > >> Spr...@li... > >> https://lists.sourceforge.net/lists/listinfo/springframework-developer > >> > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: IBM Linux Tutorials. > > Become an expert in LINUX or just sharpen your skills. Sign up for > > IBM's > > Free Linux Tutorials. Learn everything from the bash shell to sys > > admin. > > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: <jo...@sl...> - 2004-01-05 15:40:20
|
I was thinking of classes like: DynamicMethodMatcherPointcutAroundAdvisor and StaticMethodMatcherPointcutAroundAdvisor I understand that they are what they claim to be and it's hard to make it shorter, but it certainly made my brain shy away from them, if only because there are a lot of words to parse. We could consider putting the= m in a package which would simplify things a little bit, such as org.springframework.aop.support.advisor. That's not a great solution, bu= t it's an idea. I am willing to help out with the docs if there's an easy piece to carve off. I'm pretty new to the framework as a whole, so I'm not sure how muc= h I can add, but I'm willing to pitch in. John > John > > I know doco is lacking in this area. I'm gradually adding to the AOP do= cs, > although due to time constraints, only at the rate of about half an hou= r a > day until the end of the month, when I should have time to finish it of= f > properly. > > Which class names do you consider hideous? I'm wondering whether it's > AOP-speak hideousness or Spring hideousness. It might be possible to > address > the latter category of hideousness (although we want to keep changes to= a > minimum until 1.0 final). > > Regards, > Rod > > ----- Original Message ----- > From: "John K.Watson" <jo...@sl...> > To: <spr...@li...> > Sent: Monday, January 05, 2004 2:04 PM > Subject: Re: [Springframework-developer] Method Interception By Name > > >> What would improve usability in this area would be the chapter on AOP >> in the docs which hasn't been written yet. I spent about a day poring >> through the source and the tests to find some examples of how to make >> all this work. It's definitely non-obvious at the moment. Some of th= e >> class names are really quite hideous, also. That all being said, it >> seemed to work as advertised once I understood what was going on. :) >> John >> >> On Jan 5, 2004, at 1:15 AM, Rod Johnson wrote: >> >> > Ross >> > >> > You're on the right track. There is actually a RegExpPointcut, which >> > should >> > enable you to move the matching rule into XML. Please feedback any >> > comments >> > about its usability, as we may try to improve it for 1.0 final. >> > >> > In general, the interceptor should not do matching, unless the >> > matching is >> > relevant to it's work (e.g. it behaves differently for methods >> > starting with >> > some prefix, returning void, or whatever). Even in that case, it mig= ht >> > be >> > better to use several simpler interceptors with corresponding >> > pointcuts to >> > facilitate reuse. >> > >> > Regards, >> > Rod >> > >> > ----- Original Message ----- >> > From: "Ross Mason" <ro...@at...> >> > To: <spr...@li...> >> > Sent: Monday, January 05, 2004 6:33 AM >> > Subject: Re: [Springframework-developer] Method Interception By Name >> > >> > >> >> Hi Matthew, >> >> >> >> I think you can create an Advisor such as >> >> DefaultInterceptionAroundAdvisor add your MethodInterceptor as a re= f >> >> and >> >> also define a PointCut. The PointCut is a composition of a >> >> MethodMatcher >> >> and ClassFilter. Your MethodMatcher implementation could accept, sa= y >> a >> >> regex (which can be configured in the applicationContext.xml) to >> >> filter >> >> the correct methods. >> >> >> >> I haven't really played with the aop stuff so I may be off the mark= , >> >> but >> >> sounds sensible to me... ;-) >> >> >> >> Cheers, >> >> >> >> Ross >> >> >> >> btw Happy new year! >> >> >> >> Matthew E. Porter wrote: >> >> >> >>> I have written a class implementing MethodInterceptor. Currently, >> >>> the >> >>> class checks the method name to decide whether or not to apply the >> >>> interceptor logic. I am curious if there is a better way to do th= is >> >>> in >> >>> Spring. It would be nice if there was a way to specify the method >> >>> names >> >>> in the applicationContext.xml. >> >>> >> >>> All help/advice is appreciated! >> >>> >> >>> >> >>> Cheers, >> >>> matthew >> >>> >> >>> >> >>> >> >>> ------------------------------------------------------- >> >>> This SF.net email is sponsored by: IBM Linux Tutorials. >> >>> Become an expert in LINUX or just sharpen your skills. Sign up fo= r >> > IBM's >> >>> Free Linux Tutorials. Learn everything from the bash shell to sys >> > admin. >> >>> Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3D= click >> >>> _______________________________________________ >> >>> Springframework-developer mailing list >> >>> Spr...@li... >> >>> https://lists.sourceforge.net/lists/listinfo/springframework- >> >>> developer >> >>> >> >> >> >> >> >> ------------------------------------------------------- >> >> This SF.net email is sponsored by: IBM Linux Tutorials. >> >> Become an expert in LINUX or just sharpen your skills. Sign up for >> >> IBM's >> >> Free Linux Tutorials. Learn everything from the bash shell to sys >> >> admin. >> >> Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dc= lick >> >> _______________________________________________ >> >> Springframework-developer mailing list >> >> Spr...@li... >> >> https://lists.sourceforge.net/lists/listinfo/springframework-develo= per >> >> >> > >> > >> > >> > >> > ------------------------------------------------------- >> > This SF.net email is sponsored by: IBM Linux Tutorials. >> > Become an expert in LINUX or just sharpen your skills. Sign up for >> > IBM's >> > Free Linux Tutorials. Learn everything from the bash shell to sys >> > admin. >> > Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dcl= ick >> > _______________________________________________ >> > Springframework-developer mailing list >> > Spr...@li... >> > https://lists.sourceforge.net/lists/listinfo/springframework-develop= er >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: IBM Linux Tutorials. >> Become an expert in LINUX or just sharpen your skills. Sign up for >> IBM's >> Free Linux Tutorials. Learn everything from the bash shell to sys >> admin. >> Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclic= k >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-developer >> > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM= 's > Free Linux Tutorials. Learn everything from the bash shell to sys admi= n. > Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |