Creating A CFC Generator Object With Illudium

In my last post I showed the raw code that you would need to call the Illudium PU-36 Code Generator outside of it's Flex front-end. That code is just ripe for abstraction. Really all you want is an object with a method signature that takes maybe a com-path, datasource, and table name and does the work of generating the CFCs for you right? OK, now that we're all agreed. The CFC is attached in a zip (just click the "download" link down yonder).

And here is some sample code showing how easy it is to use now that it's packaged up.

<cfset generator = CreateObject('component','_testing.CFC.generator') />
<cfset generator.init('YOURCFADMINPASSWORD','_testing.CFC.generated') />
<cfset generator.GenerateTableCFCs(DataSource='YOURDATASOURCE', Table='SOMETABLE') />

There is one thing that you might want to change depending on your usage. The generator is set up to generate two sets of CFCs based off of two Illudium template sets. A base/volatile set and a custom/non-volatile set. It will always overwrite the base/volatile set. But, it will only write the custom/non-volatile set if it does not exist.

Disclaimer: You will most likely need to edit the CFC a little for pathing issues. And this will not work unless you have patched Illudium per my previous article.(Or until Brian rolls the patch in, which i think he's gonna).

Related Blog Entries

Comments
doug's Gravatar hey chris, this is a great series! I've been a lurker for the last two posts as I had not even heard of illidium until you began writing about it. I haven't seen mention, nor have I looked yet, regarding generation of .as VOs along with CFCs. Does/can illidium provide some functionality such as is found in the Flex CF database wizard?
# Posted By doug | 3/13/08 8:40 PM
Chris Phillips's Gravatar @Doug,

Absolutely it can. In fact, some of the built in templates have VO generation. I think that even the base templates are better than the ColdFusion CFC generation tools from Adobe. Not only that. But, it's a templating engine. So, you put a little bit of work into customizing the templates, and then it generates exactly what you need. :-) It also comes with some ColdSpring and Transfer templates too. At it's heart, Illudium is a generic templating engine.
# Posted By Chris Phillips | 3/13/08 10:09 PM
doug's Gravatar Chris, aha - I visit the illidium project home and my q is answered in the first sentence (-;. This is cool, I think I'm gonna give this a spin at home and see how this would work for me, potentially, in my current project at work. I'm getting ready to start work on a series of .cfc .as mappings. It's not a ton of work to do it using the Flex tools but this appears to be well worth a look. This would be a good demo for PDXRIA???
# Posted By doug | 3/14/08 10:13 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.6.002.