Ticket #293 (closed defect: invalid)
Inconsistant loading of Coldspring.xml file comapred to other config files
| Reported by: | andrewcs | Owned by: | joe.rinehart |
|---|---|---|---|
| Priority: | high | Milestone: | 2.0 |
| Version: | 2.0.304 | Severity: | normal |
| Keywords: | Cc: |
Description
When making the config file a mapping so that it would appear outside of the siteurl, I discovered an inconstancy in how Coldspring.xml config file is loaded in comparison to other config files in MG:U
For example
<cfparam name="ModelGlue?_LOCAL_COLDSPRING_PATH" type="string" default="#expandPath(".") & "/config/ColdSpring.xml"#" />
Should be
<cfparam name="ModelGlue?_LOCAL_COLDSPRING_PATH" type="string" default="#expandPath("/config/ColdSpring.xml")#" />
This would mean that by default a mapping could be used for /Config (which will load all MG:U files etc.) to load the Coldspring.xml file
as per the Modelglue.unit.loader.FrameworkLoader? as follows.
<cffunction name="load" returntype="ModelGlue?.unity.framework.ModelGlue?" access="public" output="true">
<cfargument name="alternateConfigurationPath" type="string" required="true" default="">
<cfset var cfg = getBean("ModelGlueConfiguration?") /> <cfset var mg = getBean("ModelGlue?").init() /> <cfset var beanFactory = getBeanFactory() /> <cfset var eventLoader = getBean("EventLoader?") /> <cfset var configPath = cfg.getConfigurationPath() /> <cfset var scaffoldPath = cfg.getScaffoldPath() /> <cfset var scaffoldConfigPath = cfg.getScaffoldConfigurationPath() /> <cfset var ormController = "" /> <cfset var ormBeans = "" /> <cfset var sessionTestKey = createUUID() />
<cfset mg.setConfiguration(cfg) />
<cftry>
<cfset session[sessionTestKey] = "" /> <cfset structDelete(session, sessionTestKey) /> <cfcatch>
<cfset mg.setUseSession(false) />
</cfcatch>
</cftry>
<cfif left(configPath, 1) eq "/">
<cfset configPath = expandPath(configPath) />
<cfelse>
<cfset configPath = expandPath(".") & "/" & configPath />
</cfif>
<cfif left(scaffoldPath, 1) eq "/">
<cfset scaffoldPath = expandPath(scaffoldPath) />
<cfelse>
<cfset scaffoldPath = expandPath(".") & "/" & scaffoldPath />
</cfif>
<cfif len(arguments.alternateConfigurationPath)>
<cfset configPath = arguments.alternateConfigurationPath /> <cfset scaffoldPath = getDirectoryFromPath(configPath) & "scaffolds/Scaffolds.xml" />
</cfif>
<cfif left(scaffoldConfigPath, 1) eq "/">
<cfset beanFactory.loadBeans(expandPath(scaffoldConfigPath)) />
<cfelse>
<cfset beanFactory.loadBeans(expandPath(".") & "/" & expandPath(scaffoldConfigPath)) />
</cfif>
<cfset eventLoader.setBeanFactory(beanFactory) /> <cfset mg.setBeanFactory(beanFactory) />
<cfset mg = eventLoader.load(mg, configPath, scaffoldPath) />
<cfset ormController = getBean("ORMController") />
<cfset mg.addListener("ModelGlue?.genericList", ormController, "genericList", false) /> <cfset mg.addListener("ModelGlue?.genericRead", ormController, "genericRead", false) /> <cfset mg.addListener("ModelGlue?.genericCommit", ormController, "genericCommit", false) /> <cfset mg.addListener("ModelGlue?.genericDelete", ormController, "genericDelete", false) />
<cfreturn mg />
</cffunction>
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)