Getting LightWire to Work with Transfer

0 views
Skip to first unread message

Aaron Roberson

unread,
Mar 1, 2007, 6:41:31 PM3/1/07
to lightwire...@googlegroups.com
Peter,

I just realized something. It is not actually transfer.transferFactory
that I need to pass into all of my objects, it is
transfer.TransferFactory.getTransfer() but there doesn't seem to be a
way to do that in LightWire.

In ColdSpring, instead of supplying a class to the bean definition,
you supply a bean-factory attribute with the value of the factory
class. Here is the code in ColdSpring:

<bean id="transferFactory" class="transfer.TransferFactory" singleton="true" >
...
</bean>
<bean id="transfer" factory-bean="transferFactory"
factory-method="getTransfer" singleton="true" />

How can I do this in LightWire? Here is a proposal if nothing already exists:

variables.Bean.transferFactory.Singleton = 1;
variables.Bean.transferFactory.Path = "transfer.transferFactory";
...
variables.Bean.transfer.Singleton = 1;
variables.Bean.transfer.FactoryBean = "transferFactory";
variables.Bean.transfer.FactoryMethod = "getTransfer";

Aaron Roberson

unread,
Mar 1, 2007, 6:48:22 PM3/1/07
to lightwire...@googlegroups.com
I have tried the following:

variables.transferFactory =
createObject("component","transfer.transferFactory").init("/#application.name#/config/datasource.xml","/#application.name#/config/transfer.xml","/#application.name#/com/transfer/definitions");

transfer = variables.transferFactory.getTransfer();

But I got the following error:

Element transfer is undefined in a CFML structure referenced as part
of an expression.

The error occurred in
C:\Inetpub\wwwroot\WHMedia\com\util\lightwire.cfc: line 168
Called from C:\Inetpub\wwwroot\WHMedia\com\util\lightwire.cfc: line 62
Called from C:\Inetpub\wwwroot\WHMedia\com\util\lightwire.cfc: line 26
Called from C:\Inetpub\wwwroot\WHMedia\Application.cfm: line 12

166 :
167 : // And we need to add its dependencies to this list if it has any
168 : If (StructKeyExists(variables.Bean[LoopObjectName], KeyType))
169 : {
170 : // Set the parent dependency set for this object

Aaron Roberson

unread,
Mar 1, 2007, 8:54:01 PM3/1/07
to lightwire...@googlegroups.com
Woohooo hooo YEA!!! Victory at last!!!!

Here is what I had to do:

variables.transferFactory =
createObject("component","transfer.transferFactory").init("/#application.name#/config/datasource.xml","/#application.name#/config/transfer.xml","/#application.name#/com/transfer/definitions");

variables.transfer = variables.transferFactory.getTransfer();

variables.Bean.userService.Singleton = 1;
variables.Bean.userService.Path = "#application.name#.com.user.userService";
variables.Bean.userService.ConstructorProperties.transfer =
"#variables.transfer#";
variables.Bean.userService.SetterDependencies = "userGateway";

Note that I changed it from ConstructorDependencies to
ConstructorProperties.transfer.

I had to try several different combinations of things before I finally
got, but now it will all be worth it.

Thanks for your help Peter!

Peter Bell

unread,
Mar 1, 2007, 10:05:41 PM3/1/07
to lightwire...@googlegroups.com
Well, I'm glad it is working for you - congrats!

Best Wishes,
Peter

Peter Bell

unread,
Mar 1, 2007, 10:41:21 PM3/1/07
to lightwire...@googlegroups.com
Hey Aaron,

That was what was coming to me as I saw your final solution including a
createobject in the LightWire config. This makes perfect sense and seems to
be a great enhancement. Will get it in shortly!

Thanks!
Peter

Reply all
Reply to author
Forward
0 new messages