Model Glue Tips: Splitting out ColdSpring
October 28, 2007 ·
A comment posted in my entry about
Model Glue Tips Part 1: Separate out your Model-Glue file reminded me that I should continue with some of those postings.
One of the things that happens when you start building larger applications is that you get a lot of objects that you are managing with ColdSpring. This means that the file can get rather large, and again that is a bad thing right (I keep going on about this to lots of people that write CF, the same goes for your XML files).
There are other reasons to split out the ColdSpring file, apart from a neatness. One of our applications actually creates other ModelGlue applications. And each one of these has separate configurations and in fact available objects (they are automatically written out) as well as maybe some custom configurations.
The problem would be that if you update the core code, that is, objects that are core to the system, you dont want to be messing about with merging these files together, so I tend to split things out something like:
- ColdSpring.xml <- Main (Core) ColdSpring File
- ColdSpring_Config.xml <- Automatically written file that has our DSN, reactor and other site specific settings
- ColdSpring_Custom.xml <- Custom settings and mappings for the application
All these files are complete ColdSpring files in themselves (that is, they start with <beans>) and are imported into the main ColdSpring file as imports:
<beans>
<import requires="config/ColdSpring_Config.xml" />
<import requires="config/ColdSpring_Custom.xml" />
....
</beans>
Once you have done this, beans in the external files are loaded as normal.
A quick note, and I haven't checked this properly, but this works in the bleeding edge version of ColdSpring which you can get through CVS following the instructions here:
http://www.coldspringframework.org/index.cfm?objectid=2DD5F8AF-DD05-F8C8-7860429E21850D7E
Tags: ColdSpring, ColdFusion, ModelGlue
Tags: coldfusion · coldspring
5 responses
1 Dave Ross // Sep 22, 2008 at 4:13 PM
2 Mark Drew // Sep 22, 2008 at 4:13 PM
3 Mark Drew // Sep 22, 2008 at 4:13 PM
Very odd
4 James Allen // Sep 22, 2008 at 4:13 PM
I'm currently playing with the main release and so can't use the <import> tag.
I wasn't sure whether to use the latest as I don't want to come across any bugs in CS which might make developing the huge project I'm about to start work on even more complicated.
I'm learning Model-Glue on the job so want to try and minimise potential issues as much as possible. :)
If it's usually pretty stable though it might be worth it. I really just want the <import> tag so that I can mirror how I'm sub-dividing my Model-Glue config files and controllers.
5 Adam Tuttle // Sep 22, 2008 at 4:14 PM