Playing with Model-Glue Unity
After watching Joe Rinehart's video on the coolness of Model-Glue: Unity, I had to download and play a bit. Pretty amazing stuff. I liked how easy it was to set up some basic functionality for a simple table. The combination of MG, ColdSpring and Reactor is quite powerful. The scaffolding (where it automatically built some event-handlers and views) part was really impressive.
The only problem I had with some of this type of automation is that I didn't feel like I had access to a separated model that I would be able to reuse elsewhere. Some of the Generic Database Modeling that MG has built into the controller would be difficult to use if I want to take MG out of the equation and reuse a part of my model. But perhaps I didn't play long enough to get a full understanding.
I briefly looked at the idea of "actionpacks" and read through the one Email Service actionpack that is available through the SVN site. This looks really cool. The Email Service is a prebuilt model that is used by simple calls to an API (e.g., setTo, setSubject()...). It comes with the necessary ColdSpring config xml, the MG Controller and the MG xml. This little actionpack would be very easy to adapt to Mach-II. It is a good example of how a part of a model can be written and reused.
Good job Joe and everyone who contributed.
Working on sample Service/DAO/Bean files
I'm working on a set of CFCs that is the basic idea of a Person that has multiple Addresses (simple database with 2 tables: Person and Address). Because there seem to have been quite a few questions (on the CF-Talk, Model-Glue, etc. lists) regarding Service Objects lately, I'll try to post this as sample code this weekend. I probably won't do a full app, or even tie it to a framework. Instead, there will be a simple cfm file that makes calls against the Service CFC.
The first iteration will be standalone, but a ColdSpring version may follow as I feel using ColdSpring makes implementing a Service layer much cleaner. And if anyone is interested, I could demo how this can tie into Mach-II or Model-Glue.
If anyone has any suggestions or ideas for this type of sample code, please leave a comment.
Note on using Model-Glue or Mach-II with ColdSpring and Reactor
Just a reminder that in order to use Model-Glue or Mach-II with ColdSpring and Reactor you must get the latest version of all of the above. The most recent versions of MG and M-II are available at their respective web sites as they are the most recent 'stable' version. For ColdSpring and Reactor, however, you'll have to go to version control repositories. ColdSpring has the CVS login details on its website (Eclipse has a built in CVS checkout client). Reactor is harder to find. I downloaded the Tortoise SVN client (google it, download it, install it). It's repository is at svn://alagad.com/reactor/trunk (this is listed in the Reactor documentation).
There have been a lot of recent changes to the repository versions of both ColdSpring and Reactor so there is no guarantee you can get this combo to work. I do have a version of CS and Reactor that work with at least one sample application (see previous blog entry). And remember that they are both in alpha, meaning issues are being found and fixed all the time.
I'll be happy to email zips of these to whoever needs it. I'd post them here, but I don't think this free blog gives me enough file space or bandwidth. If you need them emailed, leave a comment and I can get to your email address.
Controlling the Mach II (or Model Glue) xml file size
I found a blog entry by Wayne Graham on the mach-ii.info web site. It explains how you can use XML Entities to "include" external xml files. In the case of Mach II and Model-Glue, you could separate out parts of the config file into different xml files. The short of it is you end up with a config file that looks like this (example is for Model-Glue, but can apply to Mach II):
<!DOCTYPE [
<!ENTITY mapping "/modelgluesamples">
<!ENTITY appName "StockQuote">
<!ENTITY folder "stockquote">
<!ENTITY hello "HelloWorld">
<!ENTITY config SYSTEM "c:/websites/localhost/modelgluesamples/templates/config.xml">
<!ENTITY controllers SYSTEM "http://localhost/modelgluesamples/templates/stockquote/controllers.xml">
<!ENTITY events SYSTEM "http://localhost/modelgluesamples/templates/stockquote/event-handler.xml">
]>
<modelglue>
&config;
&controllers;
&events;
</modelglue>







