Skip to content

23 ColdSpring fixes #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
4 commits merged into from
Feb 10, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions core/api.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,17 @@
<cffunction name="getBeanListFromColdSpring" access="private" output="false" returntype="string">
<cfset var local = StructNew() />
<cfset local.beans = application._taffy.externalBeanFactory.getBeanDefinitionList() />
<cfset local.beanList = "" />

<cfloop collection="#local.beans#" item="local.beanName">
<cfif local.beans[local.beanName].instanceOf('taffy.core.resource')>
<!---
Can't call instanceOf() method on beans generated by factories; there is no
class property on factory-generated beans, and it throws an error in ColdSpring 1.2.
Temporary patch is to skip those beans, but we'd really either want to examine the
return type metadata on the factory method or find some other way to determine if
this is a Taffy bean.
--->
<cfif local.beans[local.beanName].getBeanClass() NEQ "" and local.beans[local.beanName].instanceOf('taffy.core.resource')>
<cfset local.beanList = listAppend(local.beanList, local.beanName) />
</cfif>
</cfloop>
Expand All @@ -440,7 +449,7 @@

<cffunction name="inspectMimeTypes" access="private" output="false" returntype="void">
<cfargument name="customClassDotPath" type="string" required="true" hint="dot-notation path of representation class" />
<cfif application._taffy.factory.beanExists(arguments.customClassDotPath)>
<cfif application._taffy.factory.containsBean(arguments.customClassDotPath)>
<cfset _recurse_inspectMimeTypes(getMetadata(application._taffy.factory.getBean(arguments.customClassDotPath))) />
<cfelse>
<cfset _recurse_inspectMimeTypes(getComponentMetadata(arguments.customClassDotPath)) />
Expand Down
4 changes: 4 additions & 0 deletions core/factory.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
function init(){
return this;
}
// Proxy to beanExists to provide similar interface to ColdSpring
function containsBean(beanName){
return beanExists(arguments.beanName);
}
function beanExists(beanName){
if (structKeyExists(this.beans, arguments.beanName)){
return true;
Expand Down
2 changes: 1 addition & 1 deletion core/resource.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
--->
<cffunction name="getRepInstance" access="private" output="false">
<cfargument name="repClass" type="string" />
<cfif application._taffy.factory.beanExists(arguments.repClass)>
<cfif application._taffy.factory.containsBean(arguments.repClass)>
<cfreturn application._taffy.factory.getBean(arguments.repClass) />
<cfelse>
<cfreturn createObject("component", arguments.repClass) />
Expand Down