Migration Solutions for ColdFusion Applications to ASP.NET
      
Vince Bonfanti's Weblog

CFMAPPING: defining per-Application mappings

There's been an interesting discussion recently on the CFCDev mailing list regarding the ability to configure per-Application mappings, and a more general discussion of per-Application configuration settings on Ben Forta's blog. Based on these discussions and a specific request from a BlueDragon customer, we've decided to introduce the CFMAPPING tag in the upcoming BlueDragon 6.2.1 updater.

The CFMAPPING tag will have two required attributes--LOGICALPATH and DIRECTORYPATH--that correspond to the settings in the admin console:

<cfmapping logicalpath="/mypath" directorypath="C:\mymappedpath">

The LOGICALPATH and DIRECTORYPATH attributes will both accept variable expressions as well as string constants.

The DIRECTORYPATH attribute must specify a full physical path. When the CFMAPPPING tag is rendered BlueDragon will verify that the specified DIRECTORYPATH actually exists, is a directory (and not a file), and that BlueDragon can read from that directory; if any of these checks fail, a CFML runtime exception will be thrown.

Mappings specified by CFMAPPING will exist for the duration of the request and survive across CFINCLUDEs, custom tag calls, CFC method calls, etc. You can put a CFMAPPING tag where ever you want in your code, but the most logical place is probably within Application.cfm right after the CFAPPLICATION tag.

The CFMAPPING tag will override mappings configured via the admin console.

That's about it. If you have any feedback on this implementation there's still time--but not much--to adjust things before the BlueDragon 6.2.1 release, so let me know what you think.

P.S. I really like the idea of specifying per-Application configuration settings within Application.cfc instead of defining new tags as we've done here for CFMAPPING. But, BlueDragon doesn't support Application.cfc yet and we have a customer who has an urgent need for this feature, so creating a new tag seemed like the least disruptive way to satisfy his requirement. Also, even after we add support for Application.cfc, there are surely people who will stick with using Application.cfm, especially in legacy applications. When we do add Application.cfc support in the next major release of BlueDragon, we'll likely add the ability to specify a broader range of Application-specific configuration setting (including mappings) at that time.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
I like this implementation the best. Over on Ben's blog, I think they're working on too big of a problem.

I would like to be able to do the following as well, so that I can have possibly different directory structures on different environments that support the same mapping scheme:

<cfmapping logicalpath="/com" relativepath="../com" />

Of course, there could be a serious flaw with this that hasn't crossed my mind.

-Joe
# Posted By Joe Rinehart | 10/5/2005 3:04 PM
Vince, We're finishing up the release of FarCry 3.0 (http://www.farcrycms.org/). We'd love to work on getting the code base BlueDragon compatible. Is there anyone we should be talking to in your team? -- geoff
# Posted By Geoff Bowers | 10/5/2005 7:31 PM
I like Joe's idea a lot! It seems it would allow you to set a mapping for a particular application and be able to simply drop the code for that app in anywhere and it would work without modification. Cool.

And I like your reasoning Vince. The more i think about why a "local" mapping should necessarily be married to the application scope, the less i see why. True, it's today's need to have it more flexible so it can be set on a per application basis. But a mapping is simply a pointer to a location on the hard disk. The other features of CF that are related to the hard disk like cffile or cfdirectory or getdirectoryfrompath() are not application scoped. We would never think of them that way.
# Posted By Nando | 10/5/2005 8:19 PM
Joe, the RELATIVEPATH attribute is an excellent idea. Look for an updated blog entry later today with details.
# Posted By Vince Bonfanti | 10/6/2005 2:09 PM
Geoff, we'll be delighted to work with you to make sure BD 6.2.1 support FarCry 3.0. I'll be in contact with you shortly.
# Posted By Vince Bonfanti | 10/6/2005 2:10 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.2.001. Contact Blog Owner

company media information terms of use privacy policy contact us
This page was dynamically built on the BlueDragon CFML Engine