Comments inline. On 8/14/07, Dave Phipps <[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/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
