I misunderstood the issue. I thought that you had already done this but
were concerned about the proliferation of managers.
As for where to get the reference Nathan said it better, but in short at
some point you've got make at least something concrete.
There must be some mechanism in Mach II to persist information. You might
consider a persistent function that simply returns or creates a reference to
the Manager Manager.
My own framework mirrors the CF Application framework (there's an
Application.CFC, Session.CFC and Request.CFC). Something like this would be
instantiated in whatever scope was appropriate and always exist.
Again I'm not sure how Mach II handles such things, but I would expect there
to be a way.
If I were to do this I would probably make such a thing a property of the
Application.cfc. It would then be called (from anyplace in the application)
with something like this ("DP" is the name of the application.cfc instance):
Application.DP.Managers.getManager("MyCFC").getInstance()
If you really wanted the CFCs themselves to be unaware (not a bad thing) you
could also pass in a reference to the Managers instance as a parameter of
the CFC. Then the other CFCs of the application don't technically need
awareness of the application scope.
Jim Davis
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Matt Liotta
> Sent: Monday, September 06, 2004 11:21 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] singleton pattern
>
> > The Managers component would only be responsible for managing managers,
> > not
> > singletons themselves.
> >
> It is the same problem... I have a random CFC that wants a reference to a
> singleton, so I need to ask a manager for it. Where do I get the reference
> for a manager? You are suggesting I can get the reference from a manager
> manager, but where do I get a reference for a manager manager?
>
> You can add any number of levels of abstraction CFCs and the problem is
> still the same.
>
> -Matt
>
> ----------------------------------------------------------
> 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 www.mail-
> archive.com/[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 www.mail-archive.com/[EMAIL PROTECTED]