Hi
First I will ask if Coldspring can be used with a CF backend that will be accessed via Flex 2 using remoting. If so, great, because I really like the ideas behind Coldspring and AOP. If not, plese ignore the rest of this email :)
I've created an app that will be used as a back end for Flex. At this stage however I am just creating a few DAO / Gateways and am testing them as a normal html web app. However, I cannot get it to work. I've created a ModelGlue app in the past and it worked fine with Coldspring (thanks Sean Corfield). But this app is not to use any framework and I cannot get it to work with Coldspring. Here is what I have done so far (using my MenusGateway.cfc as the cfc I'm trying to inject my datasource name into):
coldspringServices.xml
<beans>
<bean id="dsn"
class="com.tq.utils.db.dsn">
<property name="dsn" type="string"><!-- uses get/set -->
<value>THEZOO_DATASOURCE</value>
</property>
</bean>
<bean id="menusGateway"
class="com.tq.utils.menu.MenusGateway">
<property name="dsn">
<ref bean="dsn"/>
</property>
</bean>
</beans>
Application.cfc
<cffunction name="onApplicationStart">
:
<cfset application.serviceFactory = createObject( "component",
"coldspring.beans.DefaultXmlBeanFactory").init()/>
<cfset application.serviceFactory.loadBeansFromXmlFile(application.serviceDefinitionLocation)/>
:
</cffunction>
MenusGateway.cfc
<cfcomponent>
<cffunction name="setDSN" returntype="void" access="public" output="true">
<cfargument name="dsn" type="com.tq.utils.db.dsn" required="true" />
<cfoutput>setDSN</cfoutput>
<cfset variables.dsn = arguments.dsn.getDSN() />
</cffunction>
<cffunction name="getAll" returntype="com.tq.utils.menu.Menus[]">
<cfset var qRead="">
<cfquery name="qRead" datasource="#variables.dsn.getDSN()#">
QUERY HERE
</cfquery>
:
:
</cfquery>
</cffunction>
</cfcomponent>
I also added some outputs to DefaultXmlBeanFactory.cfc's loadBeanDefinitions:
<cfoutput>beanIx: #beanIx#, beanAttributes.id:#beanAttributes.id#, beanAttributes.class:#beanAttributes.class#<br></cfoutput>
and BeanDefinition.cfc's addProperty function:
<cfoutput>addProperty: #arguments.property.getName()#<br></cfoutput>
to get some debug
When I call MenusGateway's getAll function I get:
beanIx: 1, beanAttributes.id:dsn, beanAttributes.class:com.tq.utils.db.dsn
addProperty: dsn
beanIx: 3, beanAttributes.id:menusGateway, beanAttributes.class:com.tq.utils.menu.MenusGateway
addProperty: dsn
But then it throws the error referring to the qRead query line in MenusGateway.cfc:
Element DSN is undefined in a Java object of type class [Ljava.lang.String
So I thought I had it all set up properly, but it appears not. Does anyone have any suggestions?
Thanks
Nathan Drury
Systems Analyst / Developer
Tourism Queensland - ICT
* [EMAIL PROTECTED]
( +61 7 3535 5037
