On 2/11/06, Kurt Wiersma <[EMAIL PROTECTED]> wrote:
> <bean id="playerDAO"
>                         factory-bean="reactorFactory" 
> factory-method="createDAO">
>                 <constructor-arg 
> name="name"><value>players</value></constructor-arg>
>         </bean>
>         <bean id="playerGateway"
>                         factory-bean="reactorFactory" 
> factory-method="createGateway">
>                 <constructor-arg 
> name="name"><value>players</value></constructor-arg>
>         </bean>

Note: the latest version of Reactor uses objectAlias as the
constructor-arg name.

Question to Chris / Dave / Kurt: would you expect ColdSpring to be
able to generate a proxy bean for beans that are actually created by
non-ColdSpring bean factories, like those shown above? I.e., Can I
apply AOP to beans that ColdSpring creates via external factory beans?

I'm asking because I can't get it to work and before I spend too much
time on it, I want to know if it's even supposed to work. The symptoms
I've encountered so far are:

1. ProxyFactoryBean.createProxyInstance() fails (at line 137) because
the metadata contains no functions: arraylen(md.functions) throws an
exception.

I worked around that by adding a check fo
structKeyExists(md,"functions") however then I hit the following:

2. type not found in <cfset setterType = method.parameters[1].type />
- ModelGlue.cfc, line 155 - because the bean has no type specified.
This is a bug in Model-Glue that I fixed by moving that assignment
into the conditional else:

<cfset setterName = right(method.name,len(method.name)-3) />
<!--- <cfset setterType = method.parameters[1].type /> moved into
cfelse below --->

<cfif beanFactory.containsBean(setterName)>
        <cfset beanName = setterName />
<cfelse>
        <cfset setterType = method.parameters[1].type />
        <cfset beanName = beanFactory.findBeanNameByType(setterType) />
</cfif>

3. The value returned from function _getReactorFactory() is not of
type reactor.reactorFactory. This happens inside Reactor for the base
abstractObject type when I'm trying to create my gateway (which is
proxied). It's hard to tell at this point what is failing :(

Here's my CS XML file:

<beans>
        <bean id="reactorFactory" class="reactor.reactorFactory">
                <constructor-arg name="configuration">
                        <value>/ggcc10/config/reactor.xml</value>
                </constructor-arg>
        </bean>
        
        <bean id="taskDAOTarget" factory-bean="reactorFactory"
                factory-method="createDAO">
                <constructor-arg name="objectAlias">
                        <value>task</value>
                </constructor-arg>
        </bean>
        
        <bean id="taskGatewayTarget" factory-bean="reactorFactory"
                factory-method="createGateway">
                <constructor-arg name="objectAlias">
                        <value>task</value>
                </constructor-arg>
        </bean>
        
        <bean id="xfa" class="ggcc10.beans.xfa">
                <property name="contact" type="string">
                        <value>ggcc.contact</value>
                </property>
        </bean>

        <bean id="checkIdentity" class="ggcc10.aspects.checkIdentity">
                <property name="reactorFactory" type="reactor.reactorFactory">
                        <ref bean="reactorFactory"/>
                </property>
        </bean>

        <bean id="securityAdvisor"
                class="coldspring.aop.support.NamedMethodPointcutAdvisor">
                <property name="advice">
                        <ref bean="checkIdentity" />
                </property>
                <property name="mappedNames">
                        <value>*</value>
                </property>
        </bean>

        <bean id="taskDAO" class="coldspring.aop.framework.ProxyFactoryBean">
                <property name="target">
                        <ref bean="taskDAOTarget" />
                </property>
                <property name="interceptorNames">
                        <list>
                                <value>securityAdvisor</value>
                        </list>
                </property>
        </bean>

        <bean id="taskGateway" 
class="coldspring.aop.framework.ProxyFactoryBean">
                <property name="target">
                        <ref bean="taskGatewayTarget" />
                </property>
                <property name="interceptorNames">
                        <list>
                                <value>securityAdvisor</value>
                        </list>
                </property>
        </bean>

</beans>
--
Sean A Corfield -- http://corfield.org/
Got frameworks?

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Reply via email to