On 3/5/06, Sean Corfield <[EMAIL PROTECTED]> wrote:
> <cfloop condition="structKeyExists(md,'extends')">
>     <cfif structKeyExists(md,"functions")>
>         <cfloop ... arraylen(md.functions) ... >
>             ...
>         </cfloop>
>     </cfif>
>     <cfset md = md.extends />
> </cfloop>

I went ahead and did this in ProxyFactoryBean.createProxyInstance()
just to test locally and I can now use AOP on Reactor objects (but I
suspect this change needs to be made in a number of other places for
consistency). It still won't address injected methods, but it will
address inheritance.

FYI, here's the patch of what I did locally (it looks more of a change
than it really is because I indented the loop body further):

Index: ProxyFactoryBean.cfc
===================================================================
RCS file: /coldspring/coldspring/aop/framework/ProxyFactoryBean.cfc,v
retrieving revision 1.9
diff -u -r1.9 ProxyFactoryBean.cfc
--- ProxyFactoryBean.cfc        14 Feb 2006 21:03:29 -0000      1.9
+++ ProxyFactoryBean.cfc        5 Mar 2006 22:18:49 -0000
@@ -133,32 +133,37 @@
                <!--- first we need to build the advisor chain to search for
pointcut matches --->
                <cfset buildAdvisorChain() />
                
-               <!--- now we'll loop through the target's methods and search for
advice to add to the advice chain --->
-               <cfloop from="1" to="#arraylen(md.functions)#" 
index="functionIx">
-               
-                       <cfset functionName = md.functions[functionIx].name />
-                       
-                       <cfif not ListFindNoCase('init', functionName)>
-                               <cfloop from="1" 
to="#ArrayLen(variables.advisorChain)#" index="advisorIx">
-                                       <cfif 
variables.advisorChain[advisorIx].matches(functionName)>
-                                               <!--- if we found a mathing 
pointcut in an advisor, make sure
this method has an adviceChain started --->
-                                               <cfif not 
StructKeyExists(methodAdviceChains, functionName)>
-                                                       <cfset 
methodAdviceChains[functionName] =
CreateObject('component','coldspring.aop.AdviceChain').init() />
-                                               </cfif>
-                                               <cfset advice = 
variables.advisorChain[advisorIx].getAdvice() />
-                                               <!--- and duplicate the advice 
to this method's advice chain
-                                               <cfset 
methodAdviceChains[functionName].addAdvice(
-                                                          
variables.aopProxyUtils.clone(variables.advisorChain[advisorIx].getAdvice())
) /> --->
-                                               <!--- add the advice to this 
method's advice chain' --->
-                                               <cfset 
methodAdviceChains[functionName].addAdvice(advice) />
+               <cfloop condition="structKeyExists(md,'extends')">
+                       <cfif structKeyExists(md,'functions')>
+                               <!--- now we'll loop through the target's 
methods and search for
advice to add to the advice chain --->
+                               <cfloop from="1" to="#arraylen(md.functions)#" 
index="functionIx">
+                               
+                                       <cfset functionName = 
md.functions[functionIx].name />
+                                       
+                                       <cfif not ListFindNoCase('init', 
functionName)>
+                                               <cfloop from="1" 
to="#ArrayLen(variables.advisorChain)#"
index="advisorIx">
+                                                       <cfif 
variables.advisorChain[advisorIx].matches(functionName)>
+                                                               <!--- if we 
found a mathing pointcut in an advisor, make sure
this method has an adviceChain started --->
+                                                               <cfif not 
StructKeyExists(methodAdviceChains, functionName)>
+                                                                       <cfset 
methodAdviceChains[functionName] =
CreateObject('component','coldspring.aop.AdviceChain').init() />
+                                                               </cfif>
+                                                               <cfset advice = 
variables.advisorChain[advisorIx].getAdvice() />
+                                                               <!--- and 
duplicate the advice to this method's advice chain
+                                                               <cfset 
methodAdviceChains[functionName].addAdvice(
+                                                                          
variables.aopProxyUtils.clone(variables.advisorChain[advisorIx].getAdvice())
) /> --->
+                                                               <!--- add the 
advice to this method's advice chain' --->
+                                                               <cfset 
methodAdviceChains[functionName].addAdvice(advice) />
+                                                       </cfif>
+                                               </cfloop>
+                                               <!--- now freeze the method 
invocation chain for this method
+                                               <cfset 
methodAdviceChains[functionName].buildInterceptorChain() /> --->
+                                               <!--- so here's where we'll 
inject intercept methods --->
+                                               <cfset 
variables.aopProxyUtils.createUDF(md.functions[functionIx],
aopProxyBean) />
                                        </cfif>
+                                       
                                </cfloop>
-                               <!--- now freeze the method invocation chain 
for this method
-                               <cfset 
methodAdviceChains[functionName].buildInterceptorChain() /> --->
-                               <!--- so here's where we'll inject intercept 
methods --->
-                               <cfset 
variables.aopProxyUtils.createUDF(md.functions[functionIx],
aopProxyBean) />
                        </cfif>
-                       
+                       <cfset md = md.extends />
                </cfloop>
                
                <!--- now give the proxy object the advice chains --->

--
Sean A Corfield -- http://corfield.org/
Got frameworks?

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Reply via email to