Framework code generation
Over at cfFrameworks.com we are continuing our workshops with Brian Rinaldi. Brian will be giving a workshop on his Illudium PU-36 Code Generator. If you're a Coldspring or Transfer fan then this is a must see workshop.
Over at cfFrameworks.com we are continuing our workshops with Brian Rinaldi. Brian will be giving a workshop on his Illudium PU-36 Code Generator. If you're a Coldspring or Transfer fan then this is a must see workshop.
So after my previous post about not being able to get flex running on my local dev machine I decided to give Brian Rinaldis CFC Object Generator (CFCOG, or as Brian likes to call it: Illudium PU-36 Code Generator) a test from another machine, and boy does it deliver.
First of though what is it:
This project generates ColdFusion components (i.e. bean, DAO, gateway, service), ColdSpring XML, Transfer XML, and ActionScript Value-Objects using the admin api and database introspection. The front-end is built in Flex 2. The code outputted for easily pasting or saving into a project to allow you to get a head-start on some of the grunt work of doing OO in CF. It uses XSL to generate the components and is designed to allow you to easily add to or modify the generated code. You can even create new templates that can be swapped out at run-time.
If you have the system
requirements, you install
the application and are presented with an intuitive interface:
To get the app to generate code for you, you simply:
You will then get an output in the main area of the screen with your generated
code. In my example I'm wishing to generate code for Mark
Mandels Transfer frameworks and depending on which template type you are
using you will get different tab outputs on the following screen. For transfer
you get four tabs:
After a couple of hours chatting back and forth on the fusebox mailing list I've got the coldSpring lexicons working. The reason this took so long was because I had a concern that to use any of the lexicons you have to use the initialize lexicon to setup coldspring (CS). This meant that I had to change my code that I'd already setup, somehow that didn't feel right. That said it's just a 5 min change (once you know what you're doing).
Cutting to the chase:
To get CS setup you need to initilise the CS factory, you do this using the initialize verb mentioned above. The best place to do this is in the appinit section of fusebox.xml.cfm as this is called as you start your app (it's like the onApplicationStart function in application.cfm). Within this function I call a fuseaction in my model circuit:
Then inside my model circuit i have this fuseaction
I've just started using the coldspring lexicon for fusebox5 which is very nice indeed (more to come on this). One of this things you have to do when using lexicons is declare the name space (xmlns) and path for the lexicon:
You can then use the name space to reference you lexicons:
Okay this all works fine but what if you have 2 different lexicon directories, one for coldspring and one for custom tags?