Shawn,

Coincidentally I've run through all the avenues you are speaking of as
I'm conflicted with the same issue. Here's my idea, although the
security may not be 'tight' enough for you.

My setup looks like this

com.theSystem.utils (Holds universal methods like 'getDataType')
com.theSystem.applicationA
com.theSystem.applicationB

Nearly everything under theSystem should have rights to 'utils'. However
it doesn't make sense to store the util cfcs in theSystem, since they
are universal. So I've placed a controller-like CFC in theSystem
(com.theSystem.applicationUtils) which loads certain cfcs from utils
into itself, which than can be accessed by the subsequent application.
The only argument I pass to applicationUtils is the location of the
calling CFC in dot notation form, which determines what methods should
be loaded.

Although I'm offering this as a possible solution to your problem, I'm
anxious to hear criticism on this design.

Fire away.
 
Adam Wayne Lehman
Web Systems Developer
Johns Hopkins Bloomberg School of Public Health
Distance Education Division


-----Original Message-----
From: Shawn Grover [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2003 6:32 PM
To: CF-Talk
Subject: How do you pass the location of your CFCs to other CFCs?

We are trying to follow good OO coding standards as we develop our CFCs,
but
have hit a minor snag.

Basically, an action page will call a business rule component.  But
first,
it needs to know where we've stored the components.  That's fine, I can
set
a variable in Application.cfm.  Now the business rule component may have
need to access other components (other BR or data access components), I
can
hard code the path to the components during development, but it'd be
VERY
nice if I didn't have to replace these values when the project is
delivered
(different server and base directory) or we moved our development
server.
How do YOU handle this?

We've toyed with the idea of using a central configuration object which
all
objects could instantiate if needed, but then how does the CFC know
where
the config.cfc is?  Next, we considered specifying a variable in the
Request
scope, but this means the components MUST know something about the
environement they are being used in, which breaks OO coding standards
(think
black box).  So, the only other option we can think off is to pass the
path
to the objects, either on a per function basis, or through an "init"
function right after the component is created.  This option is probably
the
most robust overall, but means revising a number of components that
already
exist.  So, I'm thinking that leaves us with the Request scope variable.
Are there any other options we're missing?  (reading from a file
presents
the same problem - how does the cfc know where the file is located
without
breaking OO standards?).

Thanks for any input/suggestions.

Shawn

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to