On Fri, Mar 6, 2009 at 2:47 AM, Tony Nelson <tonynelso
...@gmail.com> wrote:
> Couldn't you simply set your annotation to <entry
> key="cs:transaction">?
> -Tony
> On Mar 4, 5:38 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote:
>> Thanks for the enhancement Mark. Definitely looks promising. Wondering
>> if you add support to namespace the annotations (configurable).
>> Something like:
>> <bean id="TransactionAdvisor"
>> class="coldspring.aop.support.AnnotationPointCutAdvisor">
>> <property name="advice">
>> <ref bean="TransactionAdvice" />
>> </property>
>> <property name="annotations">
>> <map>
>> <entry key="transaction">
>> <value>true</value>
>> </entry>
>> </map>
>> </property>
>> <property name="namespacePrefix"><value>cs</value></property>
>> </bean>
>> And then the method would look something like this:
>> <cffunction name="loginUser" access="public" returntype="boolean"
>> output="false" cs:transaction="true">
>> This way it's a lot easier to see that the annotation belongs to
>> ColdSpring and not part of some magic CFML stuff. Thoughts?
>> Best,
>> Peter
>> Mark Mandel said the following on 3/4/2009 5:29 PM:
>> > Hey guys,
>> > I've committed a couple of enhancements to ColdSpring CVS that may be
>> > useful to you all.
>> > The first is PointCutAdvisor that uses annotations (extra meta data on
>> > cffunction), to specify where you want to use Advice.
>> > Example usage:
>> > <cffunction name="loginUser" hint="logs in a user" access="public"
>> > returntype="boolean" output="false" transaction="true">
>> > <cfargument name="username" hint="the username" type="string"
>> > required="Yes">
>> > <cfargument name="password" hint="the password" type="string"
>> > required="Yes">
>> > //stuff
>> > </cffunction>
>> > Where 'transaction' is the annotation.
>> > To configure the annotation, there is a <map> passed into the
>> > AnnotationPointCutAdvisor, with key-value pairs for the annotation to
>> > look for, and the value it should have.
>> > <!-- User Service -->
>> > <bean id="UserService" class="coldspring.aop.framework.ProxyFactoryBean">
>> > <property name="target">
>> > <ref bean="UserServiceTarget"/>
>> > </property>
>> > <property name="interceptorNames">
>> > <list>
>> > <value>TransactionAdvisor</value>
>> > </list>
>> > </property>
>> > </bean>
>> > <!-- AOP Classes -->
>> > <bean id="TransactionAdvice" class="model.java.cs.TransactionAdvice"/>
>> > <bean id="TransactionAdvisor"
>> > class="coldspring.aop.support.AnnotationPointCutAdvisor">
>> > <property name="advice">
>> > <ref bean="TransactionAdvice" />
>> > </property>
>> > <property name="annotations">
>> > <map>
>> > <entry key="transaction">
>> > <value>true</value>
>> > </entry>
>> > </map>
>> > </property>
>> > </bean>
>> > To map to any value of the annotation (or really just check that it is
>> > there), you can use the wildcard '*' as
>> > <bean id="TransactionAdvisor"
>> > class="coldspring.aop.support.AnnotationPointCutAdvisor">
>> > <property name="advice">
>> > <ref bean="TransactionAdvice" />
>> > </property>
>> > <property name="annotations">
>> > <map>
>> > <entry key="transaction">
>> > <value>*</value>
>> > </entry>
>> > </map>
>> > </property>
>> > </bean>
>> > The second is a Transaction Advice, that is nestable - i.e. if a
>> > Transaction Advised method calls another Transaction Advised method,
>> > the inner one will be escaped, and will be merged into the Outer
>> > transaction.
>> > You can apply the Transaction advice as per normal (I like it with the
>> > AnnoationPointCutAdvisor myself), and can be configured as such:
>> > <bean id="TransactionAdvice"
>> > class="coldspring.aop.advice.SimpleTransactionAdvice"/>
>> > Let me know if you run into any issues.
>> > Mark