>> GreenByte.info By Nick Tong (quiksilv) | Supported by: TalkWebSolutions.co.uk

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.

[More]


A quick review on Brian Rinaldis code generator

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:
screen shot 1

To get the app to generate code for you, you simply:

  • select the database you want
  • select the database table
  • select the template type (default, prototype or transfer)
  • select your CFC path
  • and select a path for your code output (used for saving generated code)
  • click generate

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:

[More]


Setting up Coldspring within fusebox via the CS lexicons

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:

<appinit>
   <fuseaction action="m.coldSpringSetup" />
</appinit>
NB: Make sure you use "fuseaction action="m.coldSpringSetup" and not "do action="m.coldSpringSetup" "

Then inside my model circuit i have this fuseaction

[More]


Multipul name spaces in fusebox for lexicons

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:

<circuit access="internal" xmlns:cs="coldspring/">

You can then use the name space to reference you lexicons:

<cs:get bean="categoryService" returnvariable="variables.categoryService" coldspringfactory="application.serviceFactory"/>
NB: 'get' is the name of your lexicon

Okay this all works fine but what if you have 2 different lexicon directories, one for coldspring and one for custom tags?

[More]

BlogCFC was created by Raymond Camden. This blog is running version 5.5.1.