anchor.diff:    limitations under the License.
   		
   			
  - $Id: AbstractBeanFactory.cfc,v 1.7 2007/01/01 17:41:36 scottc Exp $
  + $Id: AbstractBeanFactory.cfc,v 1.8 2007/06/02 22:19:20 scottc Exp $
   
   --->
    
  
positive.code: 	<cffunction name="resolveBeanName" access="public" returntype="string" output="false">
  		<cfargument name="name" type="string" required="true" />
  		<cfset var beanName = "" />
  		<cfset var sys = CreateObject('java','java.lang.System') />
  		<!--- first look to resolve alias, if we don;t have the alias mapped, return supplied bean name --->
  		<cflock name="bf_#variables.beanFactoryId#.AliasMap" type="readonly" timeout="5">
  			<cfif StructKeyExists(variables.aliasMap, arguments.name)>
  
negative.code: 	
  	<!--- begining with ColdSpring 1.5, we will use the abstract bean factory for all base implementations
  		  and keep only xml specific processing in DefaultXmlBeanFactory --->
  	<cffunction name="singletonCacheContainsBean" access="public" returntype="boolean" output="false">
  		<cfargument name="beanName" type="string" required="true" />
  		<cfset var objExists = 0 />
  		<cflock name="bf_#variables.beanFactoryId#.SingletonCache" type="readonly" timeout="5">
  			<cfset objExists = StructKeyExists(variables.singletonCache, beanName) />
  		</cflock>
  		<cfif not(objExists) AND isObject(variables.parent)>
  			<cfset objExists = variables.parent.singletonCacheContainsBean(arguments.beanName)>
  		</cfif>
  		<cfreturn objExists />
  	</cffunction>
  	
  	<cffunction name="getBeanFromSingletonCache" access="public" returntype="any" output="false">
  		<cfargument name="beanName" type="string" required="true" />
  		<cfset var objRef = 0 />
  		<cfset var objExists = true />
  		<cflock name="bf_#variables.beanFactoryId#.SingletonCache" type="readonly" timeout="5">
  			<cfif StructKeyExists(variables.singletonCache, beanName)>
  				<cfset objRef = variables.singletonCache[beanName] />
  			<cfelse>
  				<cfset objExists = false />
  			</cfif>
  		</cflock>
  		
  		<cfif not(objExists)>
  			<cfif isObject(variables.parent)>
  				<cfset objRef = variables.parent.getBeanFromSingletonCache(arguments.beanName)>
  			<cfelse>
  				<cfthrow message="Cache error, #beanName# does not exists">
  			</cfif>
  		</cfif>
  		
  		<cfreturn objRef />
  	</cffunction>
  	
  	<cffunction name="addBeanToSingletonCache" access="public" returntype="any" output="false">
  		<cfargument name="beanName" type="string" required="true" />
  		<cfargument name="beanObject" type="any" required="true" />
  		<cfset var error = false />
  		
  		<cflock name="bf_#variables.beanFactoryId#.SingletonCache" type="exclusive" timeout="5">
  			<cfif StructKeyExists(variables.singletonCache, beanName)>
  				<cfset error = true />
  			<cfelse>
  				<cfset variables.singletonCache[beanName] = beanObject />
  			</cfif>
  		</cflock>
  		
  		<cfif error>
  			<cfthrow message="Cache error, #beanName# already exists in cache">
  		</cfif>
  	</cffunction>
  	
  	<cffunction name="getBeanDefinition" access="public" returntype="coldspring.beans.BeanDefinition" output="false"
  				hint="retrieves a bean definition for the specified bean">
  		<cfargument name="beanName" type="string" required="true" />
  		<!--- the supplied 'beanName' could be an alias, so we want to resolve that to the concrete name first --->
  		<cfset var resolvedName = resolveBeanName(arguments.beanName) />
  		<cfif not StructKeyExists(variables.beanDefs, resolvedName)>
  			<cfif isObject(variables.parent)>
  				<cfreturn variables.parent.getBeanDefinition(resolvedName)>
  			<cfelse>
  				<cfthrow type="coldspring.MissingBeanReference" message="There is no bean registered with the factory with the id #arguments.beanName#" />
  			</cfif>
  		<cfelse>
  			<cfreturn variables.beanDefs[resolvedName] />
  		</cfif>
  	</cffunction>
  	
  	<cffunction name="beanDefinitionExists" access="public" returntype="boolean" output="false"
  				hint="searches all known factories (parents) to see if bean definition for the specified bean exists">
  		<cfargument name="beanName" type="string" required="true" />
  		<!--- the supplied 'beanName' could be an alias, so we want to resolve that to the concrete name first --->
  		<cfset var resolvedName = resolveBeanName(arguments.beanName) />
  		<cfif StructKeyExists(variables.beanDefs, resolvedName)>
  			<cfreturn true />
  		<cfelse>
  			<cfif isObject(variables.parent)>
  				<cfreturn variables.parent.beanDefinitionExists(resolvedName)>
  			<cfelse>
  				<cfreturn false />
  			</cfif>
  		</cfif>
  	</cffunction>
  	
  	<cffunction name="getBeanDefinitionList" access="public" returntype="Struct" output="false">
  		<cfreturn variables.beanDefs />
  	</cffunction>
  	
  	<cffunction name="registerAlias" access="public" returntype="void" output="false">
  		<cfargument name="beanName" type="string" required="true" />
  		<cfargument name="alias" type="string" required="true" />
  		<cfset var duplicateAlias = "" />
  		<!--- <cfset var sys = CreateObject('java','java.lang.System') /> --->
  		<cflock name="bf_#variables.beanFactoryId#.AliasMap" type="exclusive" timeout="5">
  			<cfif StructKeyExists(variables.aliasMap, arguments.alias)>
  				<cfset duplicateAlias = variables.aliasMap[arguments.alias] />
  			<cfelse>
  				<cfset variables.aliasMap[arguments.alias] = arguments.beanName />
  				<!--- <cfset sys.out.println("Registering alias #arguments.alias# for bean #arguments.beanName#")/> --->
  			</cfif>
  		</cflock>
  		
  