<commit_before><!---
	  
  Copyright (c) 2005, <NAME>
  All rights reserved.
	
  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.

 $Id: AopProxyBean.cfc,v 1.6 2005/10/07 13:13:13 scottc Exp $
 $log$
	
---> 
 
<cfcomponent name="${name}" 
			displayname="AopProxyBean" 
			extends="${extends}"
			hint="Abstract Base Class for Aop Proxy Bans" 
			output="false">
			
	<cffunction name="init" access="public" returntype="${extends}" output="false">
		<cfargument name="target" type="any" required="true" />
		<cfset variables.target = arguments.target />
		<cfreturn this />
	</cffunction>
	
	<cffunction name="setAdviceChains" access="public" returntype="void" output="false">
		<cfargument name="adviceChains" type="struct" required="true" />
		<cfset variables.adviceChains = arguments.adviceChains />
	</cffunction>
	
	<cffunction name="getAdviceChains" access="public" returntype="struct" output="false">
		<cfreturn variables.adviceChains />
	</cffunction>

	<cffunction name="callMethod" access="public" returntype="any">
		<cfargument name="methodName" type="string" required="true" />
		<cfargument name="args" type="struct" required="true" />
		<cfset var method = CreateObject('component','coldspring.aop.Method') />
		<cfset var rtn = 0 />
		<cfset var adviceChain = 0 />
		<cfset var advice = 0 />
		<cfset var advIx = 0 />
		
		<!--- first create a method object to pass through advice chain --->
		<cfset method.init(variables.target, arguments.methodName, arguments.args) />
		
		<!--- now find advice chains to call --->
		<cfif StructKeyExists(variables.adviceChains, arguments.methodName)>
			<!--- first call any before methods --->
			<cfset adviceChain = variables.adviceChains[arguments.methodName].getAdvice('before') />
			<cfloop from="1" to="#ArrayLen(adviceChain)#" index="advIx">
				<cfset adviceChain[advIx].before(method, arguments.args, variables.target) />
			</cfloop>
			
			<!--- next around advice
			<cfset adviceChain = variables.adviceChains[arguments.methodName].getAdvice('around') />
			<cfif ArrayLen(adviceChain)>
				<!--- now if there's an around advice call that --->
				<cfset rtn = adviceChain[1].around(method, arguments.args, variables.target) />
			<cfelse>
				<!--- or call the method --->
				<cfset rtn = method.proceed() />
			</cfif> --->
			
			<!--- NEW for methodInterceptors, the advice chain will create a proper interceptorChain --->
			<cfset adviceChain = variables.adviceChains[arguments.methodName].getInterceptorChain(method, arguments.args, variables.target) />
			<cfset rtn = adviceChain.proceed() />
			
			<!--- now any after returning advice --->
			<cfset adviceChain = variables.adviceChains[arguments.methodName].getAdvice('afterReturning') />
			<cfloop from="1" to="#ArrayLen(adviceChain)#" index="advIx">
				<cfset rtn = adviceChain[advIx].afterReturning(rtn, method, arguments.args, variables.target) />
			</cfloop>
		<cfelse>
			<!--- if there's no advice chains to execute, just call the method --->
			<cfset rtn = method.proceed() />
		</cfif>
		
		<cfif isDefined('rtn')>
			<cfreturn rtn />
		</cfif>
	</cffunction>
	
</cfcomponent><commit_msg>removed around advice method invocation<commit_after><!---
	  
  Copyright (c) 2005, <NAME>
  All rights reserved.
	
  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.

 $Id: AopProxyBean.cfc,v 1.7 2005/10/09 16:12:58 scottc Exp $
 $log$
	
---> 
 
<cfcomponent name="${name}" 
			displayname="AopProxyBean" 
			extends="${extends}"
			hint="Abstract Base Class for Aop Proxy Bans" 
			output="false">
			
	<cffunction name="init" access="public" returntype="${extends}" output="false">
		<cfargument name="target" type="any" required="true" />
		<cfset variables.target = arguments.target />
		<cfreturn this />
	</cffunction>
	
	<cffunction name="setAdviceChains" access="public" returntype="void" output="false">
		<cfargument name="adviceChains" type="struct" required="true" />
		<cfset variables.adviceChains = arguments.adviceChains />
	</cffunction>
	
	<cffunction name="getAdviceChains" access="public" returntype="struct" output="false">
		<cfreturn variables.adviceChains />
	</cffunction>

	<cffunction name="callMethod" access="public" returntype="any">
		<cfargument name="methodName" type="string" required="true" />
		<cfargument name="args" type="struct" required="true" />
		<cfset var method = CreateObject('component','coldspring.aop.Method') />
		<cfset var rtn = 0 />
		<cfset var adviceChain = 0 />
		<cfset var advice = 0 />
		<cfset var advIx = 0 />
		
		<!--- first create a method object to pass through advice chain --->
		<cfset method.init(variables.target, arguments.methodName, arguments.args) />
		
		<!--- now find advice chains to call --->
		<cfif StructKeyExists(variables.adviceChains, arguments.methodName)>
			<!--- first call any before methods --->
			<cfset adviceChain = variables.adviceChains[arguments.methodName].getAdvice('before') />
			<cfloop from="1" to="#ArrayLen(adviceChain)#" index="advIx">
				<cfset adviceChain[advIx].before(method, arguments.args, variables.target) />
			</cfloop>
			
			<!---  for methodInterceptors, the advice chain will create a proper interceptorChain --->
			<cfset adviceChain = variables.adviceChains[arguments.methodName].getInterceptorChain(method, arguments.args, variables.target) />
			<cfset rtn = adviceChain.proceed() />
			
			<!--- now any after returning advice --->
			<cfset adviceChain = variables.adviceChains[arguments.methodName].getAdvice('afterReturning') />
			<cfloop from="1" to="#ArrayLen(adviceChain)#" index="advIx">
				<cfset rtn = adviceChain[advIx].afterReturning(rtn, method, arguments.args, variables.target) />
			</cfloop>
		<cfelse>
			<!--- if there's no advice chains to execute, just call the method --->
			<cfset rtn = method.proceed() />
		</cfif>
		
		<cfif isDefined('rtn')>
			<cfreturn rtn />
		</cfif>
	</cffunction>
	
</cfcomponent>
{'fraction_non_alphanumeric': 0.14163401538238282, 'fraction_numerical': 0.008852125961398926, 'mean_word_length': 3.9905865314989137, 'pattern_counts': {'":': 0, '<': 110, '<?xml version=': 0, '>': 110, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1856547', 'n_tokens_mistral': 2406, 'n_tokens_neox': 2128, 'n_words': 582}