I don't know of any examples with just Coldspring and Reactor but the framework Model Glue uses them both (but trying to get your head around all three at once is even more difficult! :-) )
I suggest reading up on and implementing a simple object factory yourself with dependency injection (the link I sent previously does exactly that) and then Coldspring becomes a lot less intimidating once you see how simple it is (well, the factory side of it at least!) Also, avoid reading things about 'Abstract Factory' and even 'Factory Method' until you have got your head around a very simple factory. They all differ and it can get confusing! There is also a nice CFC Generator - http://code.google.com/p/cfcgenerator/ that creates Service CFC's and Coldspring xml config files that is handy. It also creates DAO's, Gateways and Beans but you're using Reactor so you wont need those. Alan ________________________________________ From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Dave Phipps [EMAIL PROTECTED] Sent: 14 August 2007 14:19 To: [email protected] Subject: Re: [Reactor for CF] Adding a service layer Thanks Alan, Brian and Patrick, I have renamed my categoryManager to categoryService to make it clear that this is a service layer cfc. I have also modified my service cfc's init method to this: <cffunction name="init" displayname="Initialise the service layer" access="public" output="false" returntype="com.categoryService"> <cfargument name="reactor" type="reactor.reactorFactory" required="true" /> <cfset variables.local = StructNew() /> <cfset variables.local.reactor = arguments.reactor /> <cfreturn this /> </cffunction> Is this the way forward? It all seems to come back to ColdSpring! I keep looking into using ColdSpring but either I have a mental block about it or it has a bit of a steep learning curve. Is there a simple demo app that highlights using ColdSpring and Reactor together. I've read the intro docs for ColdSpring and I can get my head around the basics but I can't seem to find any examples of using CS and Reactor? Is there such a thing? Cheers, Dave Brian Kotek wrote: > Comments inline. > > On 8/14/07, *Dave Phipps* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hi, > > I am just starting to put together a new app using FB5.1 and Reactor and > I would like to follow Brian's advice and add a service layer (and > possibly and remoting layer) between fb and reactor and I have a couple > of questions: > > Do I set the reactorFactory into the application scope and then > reference this from within my service layer cfc's? Or is there a > better way? > > > Have ColdSpring inject the Reactor factory into any CFCs that need it. > > Do I need to create different service layer cfc's, for example, for > category, product, customer etc? And do I then split these further into > a Manager, Gateway setup? > > > This sounds reasonable but yes it depends on what you are doing. You > wouldn't "split them further", the service layer CFC will then use the > Gateway or other underlying model components. I'm not sure what your > "manager" components are but they may already be handling service layer > tasks. Some people call service components "managers" so you may already > be most of the way there. > > Could someone let me know if the above sounds about right and any > example snippets/file structure. One thing I am about to try is the > following: > > fusebox.appinit.cfm: > application.reactor = createObject(theusual).init(config) > > Then in my categoryManager.cfc: > > <cffunction name="init" displayname="Initialise the service layer" > access="public" output="false" returntype="com.categoryManager"> > <cfargument name="reactor" type="reactor.reactorFactory" > required="true" /> > <cfset variables.local = StructNew() /> > <cfset variables.local.reactor = arguments.reactor /> > <cfreturn this /> > </cffunction> > > Would it be better to do this instead?: > > <cffunction name="init" displayname="Initialise the service layer" > access="public" output="false" returntype="com.categoryManager"> > <cfset variables.local = StructNew() /> > <cfset variables.local.reactor = application.reactor /> > <cfreturn this /> > </cffunction> > > > No, as a rule you don't want to reference the application scope from > within your CFC. Pass Reactor into the component. > > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > -- -- -- > Reactor for ColdFusion Mailing List > [EMAIL PROTECTED] > Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > -- -- -- -- David Phipps, Director [EMAIL PROTECTED] Chapel Studios / London T +44 (0)20 7100 6980 F +44 (0)20 7100 6981 M +44 (0)7765 240899 New Broad Street House, 35 New Broad Street, London, EC2M 1NH, United Kingdom Visit our website: http://www.chapel-studios.co.uk _____________________________________________________________________________ Chapel Studios is a limited company registered in England. The information in this email is confidential, intended solely for the addressee, and may be legally privileged. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based upon this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [EMAIL PROTECTED] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [EMAIL PROTECTED] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
