@Dennis
I hear you in regards to not wanting to have to hard-code the
reloadKey/reloadPassword in two places -- here's a solution I have
used to deal with that problem:
<cffunction name="onApplicationStart" output="false">
<!--- Instantiate ColdSpring bean factory & var scope variable for MG
config object --->
<cfset var beanFactory = createObject("component",
"coldspring.beans.DefaultXmlBeanFactory").init() />
<cfset var mgConfig = "" />
<!--- Load ColdSpring beans & set bean factory into the application
scope --->
<cfset
beanFactory.loadBeans(expandPath("/config/ParentColdSpring.xml")) />
<cfset application.beanFactory = beanFactory />
<!--- Retrieve the MG config object & set the reload key/password
values into the application scope --->
<cfset mgConfig =
beanFactory.getBean("modelglue.modelGlueConfiguration") />
<cfset application.reloadKey = mgConfig.getReloadKey() />
<cfset application.reloadPassword = mgConfig.getReloadPassword() />
</cffunction>
<cffunction name="onRequestStart" output="false">
<!--- If the MG reload key/password combo is present in the URL,
reload the application --->
<cfif not structKeyExists(application, "beanFactory") or
(structKeyExists(url, application.reloadKey) and
url[application.reloadKey] is application.reloadPassword)>
<cflock name="reinitApp" timeout="60" type="exclusive">
<cfif not structKeyExists(application, "beanFactory") or
(structKeyExists(url, application.reloadKey) and
url[application.reloadKey] is application.reloadPassword)>
<cfset onApplicationStart() />
</cfif>
</cflock>
</cfif>
</cffunction>
In order for this to work, note that the
modelglue.modelGlueConfiguration bean will need to be moved from MG's
ColdSpring.xml into the parent bean factory's XML config file.
--
Ezra
On Wed, Mar 24, 2010 at 2:24 PM, denstar <[email protected]> wrote:
> On Wed, Mar 24, 2010 at 3:10 PM, Dennis Clark wrote:
> ...
>> framework's ColdSpring.xml and again in my Application.cfc. This is a bit of
>> a "chicken and egg" problem so I doubt there is an elegant solution for it.
>
> Someone mentioned using the built-in XML capabilities of, um, XML to
> pull in stuff from other places on the ColdSpring list.
>
> This was their example:
>
> <!DOCTYPE beans SYSTEM "ColdSpring.dtd"
> [
> <!ENTITY datasource "billingportal">
> ]>
> <beans>
> <bean id="someDsn" class="some.cfc.configuration.Datasource">
> <property name="dsn"><value>&datasource;</value></property>
> <property name="databaseType"><value>oracle</value></property>
> <property name="userName"><value>charge</value></property>
> </bean>
> </beans>
>
> You'd probably want to use a fragment and pull it from another XML
> file, vs. doing the entity deal above, but I just thought it was cool
> because people often forget how powerful plain old XML can be.
>
> :Den
>
> --
> A wise man should so write (though in words understood by all men)
> that wise men only should be able to commend him.
> Thomas Hobbes
>
> --
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en
>
> To unsubscribe from this group, send email to
> model-glue+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>
--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en
To unsubscribe from this group, send email to
model-glue+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.