The patch I uploaded last week to the 'init' method JIRA ticket (#50) does a metadata traversal for both 'init' and 'setBeanFactory', so the BeanFactoryAware item got fixed as well. I can see the validity of the arguments (though I don't agree) that init should be local and not inherited. But with setBeanFactory, all those arguments are meaningless.
As for adding a pre-load pass to figure all that stuff out ahead of time, I personally don't see the benefit as worthwhile. Because CF cache metadata per CFC, you're only going to save one traversal. I didn't implement it in my patch (because I didn't think about prototype beans), but you can have the traversal method just set a flag in the raw CFC metadata named 'hasInitMethod' or whatever, and have it check for tha's existance before it does it's traversal. So you'll get a traversal for each method (with singleton or prototype beans), rather than a single traversal for the whole bean (saving one traversal). That's a pretty light price for gatting to avoid building a separate metadata object and maintaining all the different flags separate from the code that uses them. At the top of my traversal method put this code: <cfif structKeyExists(md, "has#methodName#Method")> <cfreturn md["has#method#Method"] /> </cfif> and then at the bottom: <cfset md["has#methodName#Method"] = result /> And actually, now that I think about it, you could on the first call to the traversal method, "flatten" the method list as cache it in the metadata as well, thereby avoiding the scan up the tree for subsequent traversals and turning the second and subsequent invocations into nothing more than a struct lookup. cheers, barneyb On 5/14/06, Chris Scott <[EMAIL PROTECTED]> wrote:
I just committed a couple of little tweaks, one is pretty important, as it fixes an issue that came up when I fixed the circular reference over an aop proxy factory. It became impossible to use nonSingleton aspects. That's now fixed. Also fixed an issue where the RemoteFactoryBean was broken (Simeon, it should be cool now). Playing around this weekend brought up another issue, so I think we need an extra vote or 2. I added the 'BeanFactoryAware' addition as a DuckType implementation, so if there's a method in a bean 'setBeanFactory' coldspring will supply a reference to the current bean factory. This can be very handy to preform post creation processing, if necessary. The big question is, that should probably search metadata.extends to find the method in any cfc in the hierarchy, no? Also it seems like we will be doing this for init as well, because even though I may not agree, you can call init on a cfc which doesn't have init in it, but extends a cfc that does. It's the way ColdFusion works, so I guess ColdSpring needs to work that way as well... So what to you think about creating a metadata object for beanDefinitions, and having it search through metadata, so it will only happen once and find all the flags we will need as we go along making the bean?? Chris Scott [EMAIL PROTECTED] http://cdscott.blogspot.com/ http://www.coldspringframework.org/
-- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites.
