This will not work, because reactor.config.config.init() awaits a path
"pathToConfigXml":

        <cffunction name="init" access="public" hint="I configure this
config bean." output="false" returntype="reactor.config.config">
                <cfargument name="pathToConfigXml" hint="I am the path
to the config XML file." required="yes" type="string" />
                <cfset var xml = 0 />

                <!--- attempt to expand the path to config --->
                <cfif FileExists(expandPath(arguments.pathToConfigXml))>
                        <cfset arguments.pathToConfigXml =
expandPath(arguments.pathToConfigXml) />
                </cfif>

                <!--- read and parse the xml --->
                <cffile action="read" file="#arguments.pathToConfigXml#"
variable="xml" />
                <cfset xml = XMLParse(xml) />

                ...
        </cffunction>

It could be changed to

        <cffunction name="init" access="public" hint="I configure this
config bean." output="false" returntype="reactor.config.config">
                <cfargument name="pathToConfigXml" hint="I am the path
to the config XML file." required="yes" type="string" />
                <cfset var xml = 0 />

                <!--- attempt to expand the path to config --->
                <cfif FileExists(expandPath(arguments.pathToConfigXml))>
                        <cfset arguments.pathToConfigXml =
expandPath(arguments.pathToConfigXml) />
                        <cffile action="read"
file="#arguments.pathToConfigXml#" variable="xml" />
                </cfif>

                <!--- parse the xml --->
                <cfif xml IS 0>
                        <cfset xml = arguments.pathToConfigXml />
                </cfif>
                <cfset xml = XMLParse(xml) />

                ...
        </cffunction>

but this also would be a (ugly) change to the framework.

I updated my CVS Version of ColdSpring but could not find a Reactor code
sample yet.

-Harry


> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Im Auftrag von Tom Chiverton
> Gesendet: Dienstag, 13. Juni 2006 11:03
> An: [email protected]
> Betreff: Re: [Reactor for CF] Dynamic initialisation instead 
> of xml file
> 
> On Tuesday 13 June 2006 09:50, Harry Klein wrote:
> > Is it possible to dynamically intialise Reactor (with data from 
> > another
> > application) whitout changing the framework?
> > This workaround would work, but setConfigXML() must be changed to
> > public:
> 
> Using the reactor.reactorFactory class, you can just pass in 
> your generated XML in the constructor, and get back a factory 
> that lets you call createXxxx().
> 
> This is what ColdSpring uses, for instance.
> 
> --
> Tom Chiverton


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to