root/coldbox/trunk/system/eventhandler.cfc @ 1772

Revision 1772, 3.1 kB (checked in by lmajano, 5 years ago)

Happy weekend!!!

  • Property svn:executable set to *
Line 
1<!-----------------------------------------------------------------------
2********************************************************************************
3Copyright 2005-2008 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
4www.coldboxframework.com | www.luismajano.com | www.ortussolutions.com
5********************************************************************************
6
7Author      :   Luis Majano
8Date        :   September 23, 2005
9Description :
10        This is a cfc that all event handlers should extend
11
12Modification History:
1301/12/2006 - Added fix for whitespace management.
1406/08/2006 - Updated for coldbox
1507/29/2006 - Datasource support via getdatsource()
16
17----------------------------------------------------------------------->
18<cfcomponent name="eventhandler"
19                         hint="This is the event handler base cfc."
20                         output="false"
21                         extends="frameworkSupertype">
22
23<!------------------------------------------- CONSTRUCTOR ------------------------------------------->
24
25        <cffunction name="init" access="public" returntype="any" output="false" hint="The event handler controller">
26                <cfargument name="controller" type="any" required="true" hint="coldbox.system.controller">
27                <cfscript>
28                        /* Register Controller */
29                        setController(arguments.controller);
30                       
31                        /* Inject user dependencies. */
32                        includeUDF(getController().getSetting("UDFLibraryFile"));
33
34                        /* Return Instance */
35                        return this;
36                </cfscript>
37        </cffunction>
38
39<!------------------------------------------- PUBLIC ------------------------------------------->
40
41        <!--- Invoker Mixin --->
42        <cffunction name="_privateInvoker" hint="calls private/packaged/public methods. Used internally by coldbox to execute private events" access="public" returntype="any" output="false">
43                <!--- ************************************************************* --->
44                <cfargument name="method"                type="string" required="Yes" hint="Name of the method to call">
45                <cfargument name="argCollection" type="struct" required="No"  hint="Can be called with an argument collection struct">
46                <cfargument name="argList"               type="string" required="No"  hint="Can be called with an argument list, for simple values only: ex: 'plugin=logger,number=1'">
47                <!--- ************************************************************* --->
48                <cfset var results = "">
49                <cfset var key = "">
50               
51                <!--- Determine type of invocation --->
52                <cfif structKeyExists(arguments,"argCollection")>
53                        <cfinvoke method="#arguments.method#"
54                                          returnvariable="results"
55                                          argumentcollection="#arguments.argCollection#" />
56                <cfelseif structKeyExists(arguments, "argList")>
57                        <cfinvoke method="#arguments.method#"
58                                          returnvariable="results">
59                                <cfloop list="#argList#" index="key">
60                                        <cfinvokeargument name="#listFirst(key,'=')#" value="#listLast(key,'=')#">
61                                </cfloop>
62                        </cfinvoke>
63                <cfelse>
64                        <cfinvoke method="#arguments.method#"
65                                          returnvariable="results" />
66                </cfif>
67               
68                <!--- Return results if Found --->
69                <cfif isDefined("results")>
70                        <cfreturn results>
71                </cfif>
72        </cffunction>
73
74<!------------------------------------------- PRIVATE ------------------------------------------->
75
76</cfcomponent>
Note: See TracBrowser for help on using the browser.