Kirk, 

You would usually load the appconstants when the framework initialises by
including code in a plugin as below.

<cffunction name="configure" access="public" returntype="void"
output="false">
                <cfscript>
                        var pm = getAppManager().getPropertyManager();
                        //get some constants from the xml file
                        var dsn = pm.getProperty("dsn");        
                        // create a bean of application constants and store
it in                   properties
                        variables.appConstants = createObject
("component""applicationmanager.model.applicationConstantsBean").init(dsn);
                        pm.setProperty("appConstants",
variables.appConstants);
                 </cfscript>
        </cffunction>

When Mach II initialises it calls the configure method on plugins and
listeners. getProperty() will retrieve the value loaded from the XML and
this is then sent as an argument to the appconstants object.  This bean is
then set as a property itself and can be called from init() in other cfc's
using getproperty(). That's' how you can neatly shuttle values around the
application.

With the latest version of Mach-II you can just use setproperty() itself
(and disregard setting variable pm in the above code).

Cheers
Angus




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Kirk Brogdon
Sent: Thursday, 18 November 2004 7:35 AM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Question on machii-info and getDsn()

Can someone tell me how the dsn is getting set in the machii-info
application?  I know (at least I think I know) that the values themselves
are being pulled from the properties of the mach-ii.xml file and I can see
in each of the listeners that the dsn is being set to
appConstants.getDSN()but I haven't been able to figure out where exactly
appConstants is being defined.  There is an applicationConstantsBean.cfm
directly under the model that appears to have the getter and setter methods
needed but I can't see where that component becomes appConstants.  There is
an appConstants.cfm but I don't think it comes into play here (appears to be
there for Flash).

Thanks - Kirk

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at 
[EMAIL PROTECTED]

Reply via email to