PDA

View Full Version : AttributeMatchMethodPointcutAdvisor ?


Bruno Baia
10-21-2005, 11:29 PM
Hi,

There is a AttributeMatchMethodPointcut class, but no AttributeMatchMethodPointcutAdvisor ?
Is there a reason ?
I added one, and it seems to work.

Anyway, can we associate Pointcuts to advices in config file without advisors classes ?

Aleks Seovic
10-22-2005, 12:20 AM
I guess it would make sense to add one to allow for simple attribute-based aspect definition, but I never got to it because it's not really necessary. You can easily define any advisor using DefaultPointcutAdvisor as in the example below:


<object id="cacheAspect" type="Spring.Aop.Support.DefaultPointcutAdvisor, Spring.Aop">
<property name="Pointcut">
<object type="Spring.Aop.Support.AttributeMatchMethodPointcut, Spring.Aop">
<property name="Attribute" value="Spring.Attributes.CacheAttribute, Spring.Core"/>
</object>
</property>
<property name="Advice" ref="aspNetCacheAdvice"/>
</object>


As a sidenote, I will be working on a greatly simplified AOP configuration soon, which should make a number of these things obsolete from the end user perspective.

In the meantime, if you can email me the advisor you implemented I will be more than happy to review it and check it in.

Later,

Aleks

Bruno Baia
10-22-2005, 05:10 PM
Perfect, thanks.
Maybe u should add a sample using DefaultPoincutAdvisor in the documentation.

i got something like that with the advisor that i sent u :


<object id="AspNetCacheAdvice" type="Spring.Aop.Support.AttributeMatchMethodPointcutAdv isor, Spring.Aop">
<property name="advice">
<object type="Aspect.AspNetCacheAdvice, Aspect"/>
</property>
<property name="attribute" value="Framework.AspNetCacheAttribute, Framework" />
</object>


I was testing Spring.Aop with a generic AspNetCacheAdvice, that u can configure with a method Attribute (timespan, priority, etc...).
But i see with ur sample there will be the same in Spring.Web.

Aleks Seovic
10-22-2005, 09:31 PM
Cool, I got your email, will look at the advisor and check it in.

Yes, there is already cache advice in the framework (as of Web Preview release), which is implemented as a strategy in order to be able to plug in different caching solutions. Right now there are two implementations in CVS -- AspNetCacheAdvice within Spring.Web, and another within EntLib integration that uses Caching Application Block instead.

Second one is interesting because it allows you to persist cached objects on a disk (as long as they are serializable), and it also works within applications other than web apps.

Later,

Aleks