What is the best way to do this configuration without using the mach-ii framework?
In Mach II, the configure() method is essentially what you would normally call the init() method (the framework reserves init() for its internal use). So, just remove extends="MachII.framework.Listener" and rename configure() to init() - now you've got a 'regular' (non-framework) object. Oh, and change the <cfargument> tags to reflect the actual arguments you'll be passing in instead of the event object.
Calling the configure method from the Flash application through Flash Remoting?
When you make a Flash Remoting call, the CFC is created for each call. If you want to maintain state between calls, you need to use a session facade or something similar. Read:
http://www.macromedia.com/devnet/mx/flashremoting/articles/facades.html
I really like the idea behind Sean's pattern but I am not sure how to efficiently adapt it to a non-mach-ii scenario.
Well, it's not *my* pattern - go read the references in the front of the Mach II Development Guide for the origins of the pattern. The pattern itself has nothing to with Mach II and can be implemented easily in any context. The only part of the code you are looking at that is Mach II specific in the 'manager' CFC.
Since that object is designed to work in application scope, you could use write a CFC that is an "application facade" that you call from Flash Remoting:
managerfacade.cfc:
<cfcomponent>
<cffunction name="getManager" access="private" ...>
<cfif not structKeyExists(application,"articleManager")>
<!--- perform initialization --->
<cfset articleManager = createObject("component","articlemanager").init(...) />
</cfif>
<cfreturn articleManager />
</cffunction>
<cffunction name="..." access="remote" ...>
<cfset var artMgr = getManager() />
...
</cffunction>
</cfcomponent>
The "perform initialization" code could read an XML config or whatever you wanted to do. Oh, and you'd need locking in the getManager() method to protect against race conditions:
<cfif not structKeyExists(application,"articleManager")>
<cflock name="application_articleManager"
type="exclusive" ...>
<cfif not
structKeyExists(application,"articleManager")>
...
</cfif>
</cflock>
</cfif>This if-lock-if structure ensures that no locking is used for the normal flow of code but also protects against race conditions at startup.
Regards, Sean
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
