Documentation home page

MachII.framework.invokers
Component CFCInvoker_Event

framework.ListenerInvoker
  |
  +--framework.invokers.CFCInvoker_Event

DEPRECATED. ListenerInvoker that invokes a Listener's method passing the Event as the sole argument.

Method Summary
public CFCInvoker_Event init()
          DEPRECATED. Used by the framework for initialization. Do not override.
public void invokeListener(Event event, Listener listener, string method, [string resultKey=""], [string resultArg=""])
          DEPRECATED. Invokes the Listener.
 

Method Detail

init

public CFCInvoker_Event init()
DEPRECATED. Used by the framework for initialization. Do not override.


Code:
	<cffunction name="init" access="public" returntype="CFCInvoker_Event" output="false"
		hint="DEPRECATED. Used by the framework for initialization. Do not override.">
		<cfreturn this />
	</cffunction>

invokeListener

public void invokeListener(Event event, Listener listener, string method, [string resultKey=""], [string resultArg=""])
DEPRECATED. Invokes the Listener.

Parameters:
Event event - The Event triggering the invocation.
Listener listener - The Listener to invoke.
string method - The name of the Listener's method to invoke.
[string resultKey=""] - The variable to set the result in.
[string resultArg=""] - Not supported.

Code:
	<cffunction name="invokeListener" access="public" returntype="void"
		hint="DEPRECATED. Invokes the Listener.">
		<cfargument name="event" type="MachII.framework.Event" required="true"
			hint="The Event triggering the invocation." />
		<cfargument name="listener" type="MachII.framework.Listener" required="true"
			hint="The Listener to invoke." />
		<cfargument name="method" type="string" required="true"
			hint="The name of the Listener's method to invoke." />
		<cfargument name="resultKey" type="string" required="false" default=""
			hint="The variable to set the result in." />
		<cfargument name="resultArg" type="string" required="false" default=""
			hint="Not supported." />
		
		<cfset var resultValue = "" />
		
		<cftry>
			<cfinvoke 
				component="#arguments.listener#" 
				method="#arguments.method#" 
				event="#arguments.event#" 
				returnvariable="resultValue" />
			
			
			<cfif arguments.resultKey NEQ ''>
				<cfset "#arguments.resultKey#" = resultValue />
			</cfif>
			
			
			<cfthrow type="MachII.framework.deprecatedInvoker"
				message="The CFCInvoker_Event has been deprecated. Please use the EventInvoker." />

			<cfcatch type="MachII.framework.deprecatedInvoker">
				
			</cfcatch>
			<cfcatch type="Any">
				<cfrethrow />
			</cfcatch>
		</cftry>
	</cffunction>

Full Component Code:
<!---
License:
Copyright 2007 GreatBizTools, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Copyright: GreatBizTools, LLC
Author: Ben Edwards (ben@ben-edwards.com)
$Id: CFCInvoker_Event.cfc 333 2007-06-22 20:09:00Z pfarrell $

Created version: 1.0.0
Deprecated in version: 1.1.0
Updated version: 1.5.0


Notes:
This invoker is DEPRECATED and may not be included with future versions of Mach-II.
Please use EventInvoker.cfc instead.
--->
<cfcomponent 
	displayname="CFCInvoker_Event" 
	output="false"
	extends="MachII.framework.ListenerInvoker"
	hint="DEPRECATED. ListenerInvoker that invokes a Listener's method passing the Event as the sole argument.">
	
	<!---
	PROPERTIES
	--->
	
	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" returntype="CFCInvoker_Event" output="false"
		hint="DEPRECATED. Used by the framework for initialization. Do not override.">
		<cfreturn this />
	</cffunction>
	
	<!---
	PUBLIC FUNCTIONS
	--->
	<cffunction name="invokeListener" access="public" returntype="void"
		hint="DEPRECATED. Invokes the Listener.">
		<cfargument name="event" type="MachII.framework.Event" required="true"
			hint="The Event triggering the invocation." />
		<cfargument name="listener" type="MachII.framework.Listener" required="true"
			hint="The Listener to invoke." />
		<cfargument name="method" type="string" required="true"
			hint="The name of the Listener's method to invoke." />
		<cfargument name="resultKey" type="string" required="false" default=""
			hint="The variable to set the result in." />
		<cfargument name="resultArg" type="string" required="false" default=""
			hint="Not supported." />
		
		<cfset var resultValue = "" />
		
		<cftry>
			<cfinvoke 
				component="#arguments.listener#" 
				method="#arguments.method#" 
				event="#arguments.event#" 
				returnvariable="resultValue" />
			
			<!--- resultKey --->
			<cfif arguments.resultKey NEQ ''>
				<cfset "#arguments.resultKey#" = resultValue />
			</cfif>
			<!--- resultArg not supported. --->
			
			<cfthrow type="MachII.framework.deprecatedInvoker"
				message="The CFCInvoker_Event has been deprecated. Please use the EventInvoker." />

			<cfcatch type="MachII.framework.deprecatedInvoker">
				<!--- Do nothing --->
			</cfcatch>
			<cfcatch type="Any">
				<cfrethrow />
			</cfcatch>
		</cftry>
	</cffunction>

</cfcomponent>