The point of putting the variable in as a property is so that you never have
to reference the application scope from your code.  The entire framework is
in the application scope, so you should never need to reference the scope
explicity.

I believe the Listeners get passed a reference to the app manager in their
init() method, which you can use to get the property manager without going
to the application scope.


  -----Original Message-----
  From: Troy Simpson [mailto:[EMAIL PROTECTED]
  Sent: Thursday, October 02, 2003 3:04 PM
  To: CF-Talk
  Subject: Re: Mach-II - Where to set the datasource?


  Thanks for the feed back.

  Just to test this out, I did what Barney suggested and put the property
  in the mach-ii.xml file and then put the following line the frameworks
  index.cfm file to see what I would get:

<cfoutput>#Application.insidewood.apploader.getappmanager().getpropertymanag
er().getproperty("DataSourceName")#</cfoutput>

  It appears that Application.insidewood is a Structure.  The insidewood
  is the application directory name.  The Framework must have gotten
  structure name from somewhere else.

  Additionally,
  When I used <cfdump> on "Application.insidewood", I got back a nice
  pretty definition of the apploader object which helped me drill down.
  <cfdump "#Application.insidewood.apploader#">
  <cfdump var = "#Application.insidewood.apploader.getappmanager()#">

  Nice!!!

  Thanks for the help guys.
  Troy


  Barney Boisvert wrote:

  > Best bet is to set it in the property section of mach-ii.xml, and then
  > read
  > it in via the PropertyManager cfc.  I haven't looked at 1.0.6, but I
  > believe
  > it now exposes the property manager to the Listeners (though probably
not
  > directly), which makes this feasible.  You could just set it in
  > Application.cfm to an application scope variable, but that then
  > requires you
  > to go outside the framework to get it, which isn't good, so I'd
  > recommend a
  > property.
  >
  > Then, once it's there, all the classes that need to use it (except the
  > listeners) should have it passed to their init() method by the
  > listeners so
  > they aren't coupled to the framework's PropertyManager.
  >
  > barneyb
  >   -----Original Message-----
  >   From: Troy Simpson [mailto:[EMAIL PROTECTED]
  >   Sent: Thursday, October 02, 2003 1:55 PM
  >   To: CF-Talk
  >   Subject: Mach-II - Where to set the datasource?
  >
  >
  >   First:
  >   Would this be the right forum for Mach-II or is there another List
that
  >   I should subscribe to for this?
  >
  >   Second:
  >   If I use the Mach-II framework, where am I suppost to set an
Application
  >   Variable for a DataSourceName?
  >
  >   Thanks,
  >   Troy
  >
  >   --
  >   Troy Simpson
  >     Applications Analyst/Programmer, OCPDBA, MCSE, SCSA
  >   North Carolina State University Libraries
  >   Campus Box 7111 | Raleigh | North Carolina
  >   ph.919.515.3855 | fax.919.513.3330
  >   E-mail: [EMAIL PROTECTED]
  >
  >
  >

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to