in a SaaS environment there would be a custom “accounts” directory that contains a mimic structure of a CB application directory (handlers, interceptors, views, etc, etc) which would be pointed to (at a request or session level) as the externals so that when the user does
That sounds an awful lot like a module. The only issue is, I don’t think it would work to have different modules loaded on each request. The external locations can actually be a list of locations to check. I haven’t tried this, but but what if you had no local assets, and everything was externals? Set up two external locations, the first one would be the “overrides” and the second would be the “default” which would be checked next. I don’t know if you can change app mappings on a per-request basis, or if that would overwrite itself on concurrent requests. Even if you did, the next problem you would run into would be that ColdBox caches handler and view lookups so it doesn’t have to do it every request.
Honestly, I think you need to look into having a separate instance of the ColdBox application in memory for each client. Whether you set up separate web roots, or just dynamically change the ColdFusion application name based on the domain, I’m not sure how you can get a single ColdBox instance to have many different lookup locations for hundreds of clients without modifying the core and disabling all caching of those lookups.
Even if we reversed the order of lookups, you really still have the same problems-- just reversed. You either need 250 site roots (or at least 250 different application scopes), or the ability to have ColdBox load one of 250 different settings (not really possible).
The only way I think that might work is if you built your own layer on top of ColdBox, where you always hit a generic handler which based on logged in user or something would in turn decide which handler to run or which views to render. You’d basically be building the override functionality yourself. We sort of do this where I work where we have a content table in the database that defines different pieces of content as well as the package, handler, action, and layout required to render that content. We send everything through a route that looks like site.com/go/pageSlug and then turn around and run the appropriate event and set the layout based on what we get out of the database (video, audio, article, etc). We don’t do that to have different companies use the app though, we just do that because we built a database-driven CMS on top of ColdBox.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com