RE: How do you pass the location of your CFCs to other CFCs?
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=subscribeforumid=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
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=subscribeforumid=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
RE: How do you pass the location of your CFCs to other CFCs?
If the CFCs are related, why not use the same directory? Ie /root /root/wwwroot (web files here) /root/cfcs If your app was Foo.com, you could make a mapping that points to root, then all your cfcs would have the path: foo.cfc.whatever And of course, if whatever needs to access whoever in the same package, it can just call whoever. === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Shawn Grover [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 4: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=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How do you pass the location of your CFCs to other CFCs?
If we had a single folder for CFCs, then I can see this working. However, we've separated our CFCs like so... /appRoot/cfc /appRoot/cfc/data /appRoot/cfc/rules /appRoot/cfc/display We are using the folder to separate data access components, business rule components, and presentation layer components. I guess we can maybe move our components into appRoot/cfc and distinquish them via a naming standard... But I'm still looking for an alternative. Just re-read your message - We might be able to assume the components will be in a fixed root folder - That would solve our problem - instead of using appRoot.cfc.data.component we'd be able to reliably use cfc.type.component. I need to think this through some more and speak with the client regarding folder location/naming (the app will be deployed to an existing web server), but right now I can't see why it wouldn't work right. Thanks. -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 4:35 PM To: CF-Talk Subject: RE: How do you pass the location of your CFCs to other CFCs? If the CFCs are related, why not use the same directory? Ie /root /root/wwwroot (web files here) /root/cfcs If your app was Foo.com, you could make a mapping that points to root, then all your cfcs would have the path: foo.cfc.whatever And of course, if whatever needs to access whoever in the same package, it can just call whoever. === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Shawn Grover [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 4: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=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: How do you pass the location of your CFCs to other CFCs?
That's exactly the way I'd do it. If your CFCs cover two roles, businessLogic and, um, Foo, I'd just use something like: root.cfcs.businesLogic.* root.cfcs.foo.* === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Shawn Grover [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 6:08 PM To: CF-Talk Subject: RE: How do you pass the location of your CFCs to other CFCs? If we had a single folder for CFCs, then I can see this working. However, we've separated our CFCs like so... /appRoot/cfc /appRoot/cfc/data /appRoot/cfc/rules /appRoot/cfc/display We are using the folder to separate data access components, business rule components, and presentation layer components. I guess we can maybe move our components into appRoot/cfc and distinquish them via a naming standard... But I'm still looking for an alternative. Just re-read your message - We might be able to assume the components will be in a fixed root folder - That would solve our problem - instead of using appRoot.cfc.data.component we'd be able to reliably use cfc.type.component. I need to think this through some more and speak with the client regarding folder location/naming (the app will be deployed to an existing web server), but right now I can't see why it wouldn't work right. Thanks. -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 4:35 PM To: CF-Talk Subject: RE: How do you pass the location of your CFCs to other CFCs? If the CFCs are related, why not use the same directory? Ie /root /root/wwwroot (web files here) /root/cfcs If your app was Foo.com, you could make a mapping that points to root, then all your cfcs would have the path: foo.cfc.whatever And of course, if whatever needs to access whoever in the same package, it can just call whoever. == == === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Shawn Grover [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 4: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=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com