| Package: MachII.properties |
| Inherits from: framework.BaseComponent < framework.Property |
| A Mach-II application property for easy ColdSpring integration |
<!--- License: Copyright 2008 GreatBizTools, LLC 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. Copyright: GreatBizTools, LLC Author: Peter J. Farrell (peter@mach-ii.com) $Id: ColdspringProperty.cfc 984 2008-08-27 21:55:46Z peterfarrell $ Created version: 1.5.0 Updated version: 1.6.0 Original license from the ColdSpring project (http://www.coldspringframework.org): ------------------------------------------------------------------------------------------ Copyright (c) 2007, David Ross, Chris Scott, Kurt Wiersma, Sean Corfield, Peter J. Farrell 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. ------------------------------------------------------------------------------------------ Notes: A Mach-II property that provides easy ColdSpring integration with Mach-II applications. Special thanks to GreatBizTools, LLC and Peter J. Farrell for donating the improvements to this integration component for Mach-II. N.B. Compatible with Mach-II 1.5.0 or higher. Usage: <property name="coldSpringProperty" type="MachII.properties.ColdspringProperty"> <parameters> <!-- Name of a Mach-II property name that will hold a reference to the ColdSpring beanFactory Default: 'coldspring.beanfactory.root' --> <parameter name="beanFactoryPropertyName" value="serviceFactory"/> <!-- Takes the path to the ColdSpring config file (required) --> <parameter name="configFile" value="/path/to/services.xml"/> <!-- Flag to indicate whether supplied config path is relative (mapped) or absolute Default: FALSE (absolute path) --> <parameter name="configFilePathIsRelative" value="true"/> <!-- Flag to indicate whether to resolve dependencies for listeners/filters/plugins/properties using introspection and new dynamic autowire method generation feature. Default: FALSE --> <parameter name="resolveMachIIDependencies" value="false"/> <!-- Indicates a scope to pull in a parent bean factory into a child bean factory Default: application <parameter name="parentBeanFactoryScope" value="application"/> --> <!-- Indicates a key to pull in a parent bean factory from the application scope Default: FALSE <parameter name="parentBeanFactoryKey" value="serviceFactory"/> --> <!-- Indicates whether or not to place the bean factory in the application scope Default: FALSE <parameter name="placeFactoryInApplicationScope" value="false" /> --> <!-- Indicates whether or not to place the bean factory in the server scope Default: FALSE <parameter name="placeFactoryInServerScope" value="false" /> --> <!-- Flag to indicate whether to automatically generate remote proxies for you Does not generate remote proxies in parent bean factories. Default: FALSE <parameter name="generateRemoteProxies" value="true" /> --> <!-- Indicates the autowire attribute name to introspect in cfcomponent tags Default: 'depends' <parameter name="autowireAttributeName" value="depends" /> --> <!-- Indicates where to write the temporary CFCs of the dynamic autowire method generation feature. Specify a path that can be expanded via expandPath(). Default: to current location of ColdspringProperty.cfc DO NOT DEFINE THESE PARAMETERS UNLESS YOU WANT TO OVERRIDE THE DEFAULT <parameter name="cfcGenerationLocation" value="PathThatCanBeExpanded" /> --> <!-- Indicates the dot path to where the temporary CFCs of the dynamic autowire method generation feature. DO NOT DEFINE THESE PARAMETERS UNLESS YOU WANT TO OVERRIDE THE DEFAULT <parameter name="dotPathToCfcGenerationLocation" value="DotPathToCFCGenerationLocation" /> --> <!-- Struct of bean names and corresponding Mach-II property names for injecting back into Mach-II Default: does nothing if struct is not defined <parameter name="beansToMachIIProperties"> <struct> <key name="ColdSpringBeanName1" value="MachIIPropertyName1" /> <key name="ColdSpringBeanName2" value="MachIIPropertyName2" /> </struct> </parameter> --> </parameters> </property> The [beanFactoryPropertyName] parameter value is the name of the Mach-II property name that will hold a reference to the ColdSpring beanFactory. This parameter defaults to "coldspring.beanfactory.root" if not defined. The [configFile] paramater value holds the path of the ColdSpring configuration file. The path can be an relative, ColdFusion mapped or absolute path. If you are using a relative or mapped path, be sure to set the [configFilePathIsRelative] parameter to TRUE or the ColdSpring will not find your configuration file. The [configGilePathIsRelative] parameter value defines if the configure file is an relative (including ColdFusion mapped) or absolute path. If you are using a relative or mapped path, be sure to set the [configFilePathIsRelative] parameter to TRUE or the property will not find your configuration file. - TRUE (for relative or mapped configuration file paths) - FALSE (for absolute configuration file paths) The [resolveMachIIDependencies] parameter value indicates if the property to "automagically" wire Mach-II listeners/filters/plugins/properties. This parameter defaults to FALSE if not defined. - TRUE (resolves all Mach-II dependencies) - FALSE (does not resolve Mach-II dependencies) The [parentBeanFactoryScope] parameter values defines which scope to pull in a parent bean factory. This parameter defaults to 'false' if not defined and indicates that a parent bean factory does not need to be referenced. The [parentBeanFactoryKey] parameter values defines a key to pull in a parent bean factory from the scope specified in the [parentBeanFactoryKey] parameter. This parameter defaults to 'false' if not defined and indicates that a parent bean factory does not need to be referenced. The [placeFactoryInApplicationScope] parameter indicates whether or not to place the bean factory in the application scope. This parameter is used to for setting your bean factory for use as a parent. The key that used is driven from the value from of the [beanFactoryPropertyName] parameter. If the parent uses the same value for the beanFactoryPropertyName, the module name (e.g. "_account") is append to the end of the key to eliminate namespace conflicts in the application scope. This parameter defaults to 'false' if not defined and indicates that this bean factory should not be placed in the application scope. The [placeFactoryInServerScope] parameter indicates whether or not to place the bean factory in the server scope. This parameter is used to for setting your bean factory for use as a parent. The key that used is driven from the value from of the [beanFactoryPropertyName] parameter. If the parent uses the same value for the beanFactoryPropertyName, the module name (e.g. "_account") is append to the end of the key to eliminate namespace conflicts in the server scope. This parameter defaults to 'false' if not defined and indicates that this bean factory should not be placed in the server scope. The [autowireAttributeName] parameter indicates the name of the attribute to introspect for in cfcomponent tags when using the dynamic autowire method generation feature of the Coldspring Property. Autowire method generation injection allows you to put a list of ColdSpring bean names in the autowire attribute (which default to 'depends') in cfcomponent tag of your listeners, filters, plugins and properties CFC in Mach-II. ColdSpring property will automatically generate and dynamically inject getters/setters for the listed bean names into your target cfc at runtime. This does not modify the contents of the cfc file, but injects dynamically while the cfc is in memory. This feature allows you to stop having to type out getters/setters for the service that you want ColdSpring to inject into your cfc. Example: |
| Method Summary | |
|---|---|
| private void |
autowireByDefinedSetters(any targetObj, any targetObjMetadata)
Autowires by defined setters. |
| private void |
autowireByDynamicMethodGeneration(string targetKey, any targetObj, any targetObjMetadata, string autowireAttributeName)
Autowires by dynamic method generation. |
| private array |
buildConfigFilePaths(string baseConfigFilePath)
Builds an array of config file paths. |
| public void |
configure()
I initialize this property during framework startup. |
| public void |
generateRemoteProxies()
Generates all the remote proxies that are of type 'coldspring.aop.framework.RemoteFactoryBean'. |
| private string |
getConfigFileReloadHash()
Get the current reload hash of the bean factory config file and imports files. The hash is based on dateLastModified and size of the file. |
| private void |
getConfigurableProperties(struct targets)
Get the configurable property targets. |
| private void |
getFilters(struct targets)
Get the filter targets. |
| private void |
getListeners(struct targets)
Gets the listener targets. |
| private void |
getPlugins(struct targets)
Get the plugin targets. |
| private void |
resolveDependencies(string autowireAttributeName)
Resolves Mach-II dependencies. |
| public boolean |
shouldReloadConfig()
Checks if the bean factory config file or any of its' imports have changed. |
| Methods inherited from framework.Property: init |
|---|
| Methods inherited from framework.BaseComponent: announceEvent , isParameterDefined , bindValue , setParameter , getParameter , buildUrlToModule , getAppManager , getComponentNameForLogging , getLog , getParameterNames , setProperty , hasParameter , getPropertyManager , announceEventInModule , setAppManager , getProperty , getParameters , setLog , setParameters , buildUrl |
|---|
| Method Detail |
|---|
| autowireByDefinedSetters |
|---|
private void autowireByDefinedSetters( any targetObj, any targetObjMetadata )
Autowires by defined setters.
Parameters:
| any targetObj |
| any targetObjMetadata |
Code:
<cffunction name="autowireByDefinedSetters" access="private" returntype="void" output="false"
hint="Autowires by defined setters.">
<cfargument name="targetObj" type="any" required="true" />
<cfargument name="targetObjMetadata" type="any" required="true" />
<cfset var beanFactory = getProperty(getProperty("beanFactoryName")) />
<cfset var functionMetadata = "" />
<cfset var setterName = "" />
<cfset var beanName = "" />
<cfset var access = "" />
<cfset var i = 0 />
<cfif StructKeyExists(arguments.targetObjMetadata, "functions")>
<cfloop from="1" to="#ArrayLen(arguments.targetObjMetadata.functions)#" index="i">
<cfset functionMetadata = arguments.targetObjMetadata.functions[i] />
<cfif StructKeyExists(functionMetadata, "access")>
<cfset access = functionMetadata.access />
<cfelse>
<cfset access = "public" />
</cfif>
<cfif Left(functionMetadata.name, 3) EQ "set" AND Arraylen(functionMetadata.parameters) EQ 1 AND access NEQ "private">
<cfset setterName = Mid(functionMetadata.name, 4, Len(functionMetadata.name) - 3) />
<cfif beanFactory.containsBean(setterName)>
<cfset beanName = setterName />
<cfelseif ArrayLen(functionMetadata.parameters) GT 0
AND StructKeyExists(functionMetadata.parameters[1], "type")>
<cfset beanName = beanFactory.findBeanNameByType(functionMetadata.parameters[1].type) />
<cfelse>
<cfset beanName = "" />
</cfif>
<cfif Len(beanName)>
<cfinvoke component="#arguments.targetObj#" method="set#setterName#">
<cfinvokeargument name="#functionMetadata.parameters[1].name#" value="#beanFactory.getBean(beanName)#" />
</cfinvoke>
</cfif>
</cfif>
</cfloop>
</cfif>
</cffunction>
| autowireByDynamicMethodGeneration |
|---|
private void autowireByDynamicMethodGeneration( string targetKey, any targetObj, any targetObjMetadata, string autowireAttributeName )
Autowires by dynamic method generation.
Parameters:
| string targetKey |
| any targetObj |
| any targetObjMetadata |
| string autowireAttributeName |
Code:
<cffunction name="autowireByDynamicMethodGeneration" access="private" returntype="void" output="false"
hint="Autowires by dynamic method generation.">
<cfargument name="targetKey" type="string" required="true" />
<cfargument name="targetObj" type="any" required="true" />
<cfargument name="targetObjMetadata" type="any" required="true" />
<cfargument name="autowireAttributeName" type="string" required="true" />
<cfset var beanFactory = getProperty(getProperty("beanFactoryName")) />
<cfset var autowireBeanNames = "" />
<cfset var beanName = "" />
<cfset var autowireCfc = "" />
<cfset var targetType = "" />
<cfset var targetName = "" />
<cfset var i = 0 />
<cfif StructKeyExists(arguments.targetObjMetadata, arguments.autowireAttributeName)>
<cfset autowireBeanNames = ListToArray(arguments.targetObjMetadata[arguments.autowireAttributeName]) />
<cfset autowireCfc = createAutowireDynamicMethodsComponent(autowireBeanNames) />
<cfloop from="1" to="#ArrayLen(autowireBeanNames)#" index="i">
<cfset beanName = Trim(autowireBeanNames[i]) />
<cfset arguments.targetObj["_methodInject"] = autowireCfc["_methodInject"] />
<cfif NOT StructKeyExists(arguments.targetObj, "get" & beanName)>
<cfset arguments.targetObj._methodInject("get" & beanName, autowireCfc["get" & beanName]) />
</cfif>
<cfif NOT StructKeyExists(arguments.targetObj, "set" & beanName)>
<cfset arguments.targetObj._methodInject("set" & beanName, autowireCfc["set" & beanName]) />
</cfif>
<cfif beanFactory.containsBean(beanName)>
<cfinvoke component="#arguments.targetObj#" method="set#beanName#">
<cfinvokeargument name="#beanName#" value="#beanFactory.getBean(beanName)#" />
</cfinvoke>
<cfelse>
<cfset targetType = ListFirst(arguments.targetKey, "_") />
<cfset targetName = ListDeleteAt(arguments.targetKey, 1, "_") />
<cfthrow type="MachII.properties.ColdspringProperty"
message="Cannot find bean named '#beanName#' to autowire by method injection in a #targetType# named '#targetName#' in module '#getAppManager().getModuleName()#'."
detail="Check that there is a bean named '#beanName#' defined in your ColdSpring bean factory." />
</cfif>
<cfset StructDelete(arguments.targetObj, "_methodInject") />
</cfloop>
</cfif>
</cffunction>
| buildConfigFilePaths |
|---|
private array buildConfigFilePaths( string baseConfigFilePath )
Builds an array of config file paths.
Parameters:
| string baseConfigFilePath |
Code:
<cffunction name="buildConfigFilePaths" access="private" returntype="array" output="false"
hint="Builds an array of config file paths.">
<cfargument name="baseConfigFilePath" type="string" required="true" />
<cfset var configFiles = ArrayNew(1) />
<cfset var imports = StructNew() />
<cfset var i = "" />
<cfset getProperty(getProperty("beanFactoryName")).findImports(imports, arguments.baseConfigFilePath) />
<cfloop collection="#imports#" item="i">
<cfset ArrayAppend(configFiles, i) />
</cfloop>
<cfreturn configFiles />
</cffunction>
| configure |
|---|
public void configure( )
I initialize this property during framework startup.
Parameters:
Code:
<cffunction name="configure" access="public" returntype="void" output="false"
hint="I initialize this property during framework startup.">
<cfset var bf = "" />
<cfset var factoryKey = "" />
<cfset var i = 0 />
<cfset var propertyManager = getPropertyManager() />
<cfset var serviceDefXmlLocation = "" />
<cfset var defaultProperties = StructNew() />
<cfset var defaultAttributes = StructNew() />
<cfset var bfUtils = CreateObject("component", "coldspring.beans.util.BeanFactoryUtils").init() />
<cfset var parentBeanFactoryScope = getParameter("parentBeanFactoryScope", "application") />
<cfset var parentBeanFactoryKey = getParameter("parentBeanFactoryKey", "") />
<cfset var localBeanFactoryKey = getParameter("beanFactoryPropertyName", bfUtils.DEFAULT_FACTORY_KEY) />
<cfset var autowireAttributeName = getParameter("autowireAttributeName", "depends") />
<cfif isParameterDefined("cfcGenerationLocation")>
<cfset setCfcGenerationLocation(ExpandPath(getParameter("cfcGenerationLocation"))) />
<cfelse>
<cfset setCfcGenerationLocation(GetDirectoryFromPath(GetCurrentTemplatePath())) />
</cfif>
<cfif isParameterDefined("dotPathTocfcGenerationLocation")>
<cfset setDotPathToCfcGenerationLocation(getParameter("dotPathTocfcGenerationLocation") & ".") />
<cfelse>
<cfset setDotPathToCfcGenerationLocation("") />
</cfif>
<cfif isParameterDefined("configFile")>
<cfset serviceDefXmlLocation = getParameter("configFile") />
<cfelse>
<cfthrow type="ColdspringProperty.configFileParameterNotDefined"
message="You must specify a parameter named 'configFile'." />
</cfif>
<cfset StructAppend(defaultProperties, propertyManager.getProperties()) />
<cfif IsObject(getAppManager().getParent())>
<cfset StructAppend(defaultProperties, propertyManager.getParent().getProperties(), false) />
</cfif>
<cfloop collection="#defaultProperties#" item="i">
<cfif IsSimpleValue(defaultProperties[i]) AND REFindNoCase("\${(.)*?}", defaultProperties[i])>
<cfset defaultProperties[i] = Evaluate(Mid(defaultProperties[i], 3, Len(defaultProperties[i]) -3)) />
</cfif>
</cfloop>
<cfset bf = CreateObject("component", "coldspring.beans.DefaultXmlBeanFactory").init(defaultAttributes, defaultProperties) />
<cfif len(parentBeanFactoryKey) AND bfUtils.namedFactoryExists(parentBeanFactoryScope, parentBeanFactoryKey)>
<cfset bf.setParent(bfUtils.getNamedFactory(parentBeanFactoryScope, parentBeanFactoryKey))/>
</cfif>
<cfif getParameter("configFilePathIsRelative", false)>
<cfset serviceDefXmlLocation = ExpandPath(serviceDefXmlLocation) />
</cfif>
<cfset request._MachIIAppManager = getAppManager() />
<cfset bf.loadBeansFromXmlFile(serviceDefXmlLocation, true) />
<cfset setProperty("beanFactoryName", localBeanFactoryKey) />
<cfset setProperty(localBeanFactoryKey, bf) />
<cfset factoryKey = localBeanFactoryKey />
<cfif Len(getAppManager().getModuleName()) AND getAppManager().getParent().getPropertyManager().isPropertyDefined(localBeanFactoryKey)>
<cfset factoryKey = factoryKey & "_" & getAppManager().getModuleName() />
</cfif>
<cfif getParameter("placeFactoryInApplicationScope", false)>
<cfset bfUtils.setNamedFactory("application", factoryKey, bf) />
</cfif>
<cfif getParameter("placeFactoryInServerScope", false)>
<cfset bfUtils.setNamedFactory("server", factoryKey, bf) />
</cfif>
<cfif getParameter("resolveMachIIDependencies", false)>
<cfset resolveDependencies(autowireAttributeName) />
</cfif>
<cfif getParameter("generateRemoteProxies", false)>
<cfset generateRemoteProxies() />
</cfif>
<cfif isParameterDefined("beansToMachIIProperties")>
<cfif IsStruct(getParameter("beansToMachIIProperties"))>
<cfset referenceBeansToMachIIProperties(getParameter("beansToMachIIProperties")) />
<cfelse>
<cfthrow type="ColdspringProperty.beansToMachIIPropertiesInvalidType"
message="The value of a parameter named 'beansToMachIIProperties' must contain a struct." />
</cfif>
</cfif>
<cfset setConfigFilePaths(buildConfigFilePaths(serviceDefXmlLocation)) />
<cfset setLastReloadHash(getConfigFileReloadHash()) />
<cfset setLastReloadDatetime(Now()) />
</cffunction>
| generateRemoteProxies |
|---|
public void generateRemoteProxies( )
Generates all the remote proxies that are of type 'coldspring.aop.framework.RemoteFactoryBean'.
Parameters:
Code:
<cffunction name="generateRemoteProxies" access="public" returntype="void" output="false"
hint="Generates all the remote proxies that are of type 'coldspring.aop.framework.RemoteFactoryBean'.">
<cfset var beanFactory = getProperty(getProperty("beanFactoryName")) />
<cfset var remoteProxyNames = beanFactory.findAllBeanNamesByType("coldspring.aop.framework.RemoteFactoryBean", false) />
<cfset var remoteProxy = "" />
<cfset var i = "" />
<cfloop from="1" to="#ArrayLen(remoteProxyNames)#" index="i">
<cfset remoteProxy = beanFactory.getBean("&" & remoteProxyNames[i]) />
<cfif remoteProxy.isConstructed()>
<cfset remoteProxy.destoryRemoteProxy() />
</cfif>
<cfset remoteProxy.createRemoteProxy() />
</cfloop>
</cffunction>
| getConfigFileReloadHash |
|---|
private string getConfigFileReloadHash( )
Get the current reload hash of the bean factory config file and imports files. The hash is based on dateLastModified and size of the file.
Parameters:
Code:
<cffunction name="getConfigFileReloadHash" access="private" returntype="string" output="false" hint="Get the current reload hash of the bean factory config file and imports files. The hash is based on dateLastModified and size of the file."> <cfset var configFilePaths = getConfigFilePaths() /> <cfset var directoryResults = "" /> <cfset var hashableString = "" /> <cfset var i = "" /> <cfloop from="1" to="#ArrayLen(configFilePaths)#" index="i"> <cfdirectory action="LIST" directory="#GetDirectoryFromPath(configFilePaths[i])#" name="directoryResults" filter="#GetFileFromPath(configFilePaths[i])#" /> <cfset hashableString = hashableString & directoryResults.dateLastModified & directoryResults.size /> </cfloop> <cfreturn Hash(hashableString) /> </cffunction>
| getConfigurableProperties |
|---|
private void getConfigurableProperties( struct targets )
Get the configurable property targets.
Parameters:
| struct targets |
Code:
<cffunction name="getConfigurableProperties" access="private" returntype="void" output="false" hint="Get the configurable property targets."> <cfargument name="targets" type="struct" required="true" /> <cfset var propertyManager = getAppManager().getPropertyManager() /> <cfset var configurablePropertyNames = propertyManager.getConfigurablePropertyNames() /> <cfset var i = 0 /> <cfloop from="1" to="#ArrayLen(configurablePropertyNames)#" index="i"> <cfset targets["property_" & configurablePropertyNames[i]] = propertyManager.getProperty(configurablePropertyNames[i]) /> </cfloop> </cffunction>
| getFilters |
|---|
private void getFilters( struct targets )
Get the filter targets.
Parameters:
| struct targets |
Code:
<cffunction name="getFilters" access="private" returntype="void" output="false" hint="Get the filter targets."> <cfargument name="targets" type="struct" required="true" /> <cfset var filterManager = getAppManager().getFilterManager() /> <cfset var filterNames = filterManager.getFilterNames() /> <cfset var i = 0 /> <cfloop from="1" to="#ArrayLen(filterNames)#" index="i"> <cfset targets["filter_" & filterNames[i]] = filterManager.getFilter(filterNames[i]) /> </cfloop> </cffunction>
| getListeners |
|---|
private void getListeners( struct targets )
Gets the listener targets.
Parameters:
| struct targets |
Code:
<cffunction name="getListeners" access="private" returntype="void" output="false" hint="Gets the listener targets."> <cfargument name="targets" type="struct" required="true" /> <cfset var listenerManager = getAppManager().getListenerManager() /> <cfset var listenerNames = listenerManager.getListenerNames() /> <cfset var i = 0 /> <cfloop from="1" to="#ArrayLen(listenerNames)#" index="i"> <cfset targets["listener_" & listenerNames[i]] = listenerManager.getListener(listenerNames[i]) /> </cfloop> </cffunction>
| getPlugins |
|---|
private void getPlugins( struct targets )
Get the plugin targets.
Parameters:
| struct targets |
Code:
<cffunction name="getPlugins" access="private" returntype="void" output="false" hint="Get the plugin targets."> <cfargument name="targets" type="struct" required="true" /> <cfset var pluginManager = getAppManager().getPluginManager() /> <cfset var pluginNames = pluginManager.getPluginNames() /> <cfset var i = 0 /> <cfloop from="1" to="#ArrayLen(pluginNames)#" index="i"> <cfset targets["plugin_" & pluginNames[i]] = pluginManager.getPlugin(pluginNames[i]) /> </cfloop> </cffunction>
| resolveDependencies |
|---|
private void resolveDependencies( string autowireAttributeName )
Resolves Mach-II dependencies.
Parameters:
| string autowireAttributeName |
Code:
<cffunction name="resolveDependencies" access="private" returntype="void" output="false" hint="Resolves Mach-II dependencies."> <cfargument name="autowireAttributeName" type="string" required="true" /> <cfset var targets = StructNew() /> <cfset var targetObj = 0 /> <cfset var targetMetadata = "" /> <cfset var key = "" /> <cfset getListeners(targets) /> <cfset getFilters(targets) /> <cfset getPlugins(targets) /> <cfset getConfigurableProperties(targets) /> <cfloop collection="#targets#" item="key"> <cfset targetObj = targets[key] /> <cfset targetMetadata = GetMetadata(targetObj) /> <cfset autowireByDynamicMethodGeneration(key, targetObj, targetMetadata, arguments.autowireAttributeName) /> <cfset autowireByDefinedSetters(targetObj, targetMetadata) /> </cfloop> </cffunction>
| shouldReloadConfig |
|---|
public boolean shouldReloadConfig( )
Checks if the bean factory config file or any of its' imports have changed.
Parameters:
Code:
<cffunction name="shouldReloadConfig" access="public" returntype="boolean" output="false" hint="Checks if the bean factory config file or any of its' imports have changed."> <cfset var result = false /> <cfif CompareNoCase(getLastReloadHash(), getConfigFileReloadHash()) NEQ 0> <cfset result = true /> </cfif> <cfreturn result /> </cffunction>