I understand that part, but I am not sure how to go about it.
Been browsing the web looking for eamples and found 1. But do not understand it
enough to know how I send information to it and how it knows where to look for
the other cfc files.
here is the code:
<cfcomponent name="Dispatcher" hint="Dispatcher is an abstract handler that
loads a configuration file and dispatches incoming data to the appropriate
DispatchHandler registered
with the dispatcher. The DispatchHandler is not required to implement anything
from the Dispatcher.">
<cfset variables._handlers = structNew() />
<cfset variables._events = structNew() />
<cffunction name="init" access="public" output="no">
<cfreturn this />
</cffunction>
<cffunction name="registerHandler" access="public" output="no">
<cfargument name="handler" required="yes"
type="cfc.utestutil.common.runtime.AbstractHandler" />
<cfset variables._handlers[ getMetaData( arguments.handler
).name ] = arguments.handler />
</cffunction>
<cffunction name="registerEvent" access="public" output="no">
<cfargument name="event" required="yes" />
<cfargument name="refName" required="yes" />
<cfif NOT structKeyExists( variables._handlers,
arguments.refName )>
<cfthrow message="Referenced Handler does not exists"
detail="The reference handler #arguments.refName# has not been registered with
the Dispatcher." type="runtime.MissingHandlerReference" />
</cfif>
<cfset variables._events[ arguments.event ] =
variables._handlers[ arguments.refName ] />
</cffunction>
<cffunction name="dispatch" access="public" output="no" hint="Abstract
function that must be implemented in all components extending the Dispatcher.">
<cfthrow message="Cannot call method dispatch() from abstract
class Dispatcher." type="AbstractMethodCallException" />
</cffunction>
<cffunction name="handlers" access="public" output="no" hint="Returns a
List of the keys in the Dispatcher properties file.">
<cfreturn createObject( "component",
"cfc.utestutil.common.util.List" ).init( structKeyList( variables._handlers ) )
/>
</cffunction>
<cffunction name="event" access="public" otuput="no">
<cfreturn createObject( "component",
"cfc.utestutil.common.util.List" ).init( structKeyList( variables._events ) ) />
</cffunction>
<cffunction name="getHandler" access="public" hint="Returns the handler
value referenced by the handler key in the properties file. The getHandler()
function will attempt to return the _defaultHandler value if the handler key is
not found. If there is no _defaultHandler and the handler key does not exist
in the properties file, an <i>UnregisteredHandlerExcpetion</i> error is
thrown.">
<cfargument name="event" required="true" />
<cfif NOT structKeyExists( variables._events, arguments.event )>
<cfthrow message="Referenced handler does not exist."
detail="The reference handler key #arguments.event# does not exist."
type="runtime.MissingHandlerReference" />
</cfif>
<cfreturn variables._events[ arguments.event ] />
</cffunction>
</cfcomponent>
----- Original Message -----
From: "Matthew Woodward" <[email protected]>
To: [email protected]
Sent: Thursday, March 1, 2012 1:18:18 PM
Subject: Re: [OpenBD] Doing Ajax via OpenBD without a framework
On Thu, Mar 1, 2012 at 10:15 AM, < [email protected] > wrote:
Is there any examples of a good dispatcher? I was looking at one or 2 but I can
not make heads or tails out of how they work yet.
Basically it's just a CFC that acts as a remote facade, so you centralize any
necessary remote calls into a single CFC, and that CFC calls the methods on
your other CFCs.
--
Matthew Woodward
[email protected]
http://blog.mattwoodward.com
identi.ca / Twitter: @mpwoodward
Please do not send me proprietary file formats such as Word, PowerPoint, etc.
as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html
--
online documentation: http://openbd.org/manual/
google+ hints/tips: https://plus.google.com/115990347459711259462
http://groups.google.com/group/openbd?hl=en
--
online documentation: http://openbd.org/manual/
google+ hints/tips: https://plus.google.com/115990347459711259462
http://groups.google.com/group/openbd?hl=en