On May 3, 2005, at 3:21 AM, Peter H wrote:

Hi there,

A few guys have mentioned using factories to provide their DAOs and Gateways, I believe some are also using caching to get maximum performance. Would be great to see how you're doing it. Any chance you could post some code?

Pete,

We do this for facades, DAOs, gateways, and utility CFCs. The following describes how we do it for facades, similar to how it is setup for the other three.

We maintain an XML file mapping short "nicknames" to components. For example, mapping "edu.ucsb.graddiv.common.major.majorDAO" to "major.majorDAO". A facadeManager is instantiated with the location of the XML file. The file is parsed and the last modified date is stored. This allows us to check later if the XML file has been changed and re-read the file if necessary, very similar to how the mach-ii.xml file is checked.

Outside code that needs a facade calls getFacade(facadeNickname), returning a reference to a ready to go facade. This is the factory pattern part.

When a facade is requested, and does not already exist in the server scope, a facade is instantiated and stored in the server scope. Therefore, only one facade is instantiated server-wide at any time. This is the singleton pattern part.

HTH,

Chris


--


***************************************
Chris Dempsey
Director, Information Services
UCSB Graduate Division
Quidquid latine dictum sit, altum videtur.



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]




Reply via email to