Posts

Showing posts from January, 2006

TML

All I wanted was to write a useful document on how to use AppGen. Since I had to publish this on to my website at nagesh.net, it had to be html. Now I really am not big with WYSIWYG-editors so I was looking around for a very clean and easy to use html generator which just let me worry about the content rather than the presentation. After a little searching, I found TML which does pretty much everything that I need and in a clean way. You just have to write your *.tml files in wiki like syntax and run the tml tool i.e. org.antlr.tml.Tool , which has the ability to generate either Lout or HTML. I was just interested in the html part and it works pretty well. Infact the entire antlr and stringtemplate site is based on TML which is pretty neat. Two small things : If you are writing your *.tml files on Windows then you have to convert the '\r\n' s to '\n' before you pass it on to the TML tool. (Small little quirk) You can rewrite your tml.sh to look like #/bin

AppGen

Finally, I've uploaded an initial cut at appgen. The current version is 0.1 and links and documentation can be found at http://www.nagesh.net/appgen/ The initial release can be used to generate webapp artifacts namely Filters Servlets Listeners web.xml and weblogic.xml descriptors build.xml It extensively uses StringTemplate for all the code generation. In addition to all the above features , it can also generate empty implementations for any arbitrary java interface in its classpath. I haven't exposed that feature yet but intend to do it in a future release. Read more on http://www.nagesh.net/appgen

Occasional

No, I'm not apologizing for not blogging for so long. Infact after looking at my long history of blogging, I decided to update the description on my blog to add "Very occasional blogger" :-) Its exactly a year since I last blogged and by some divine call I decided it was time to write another short note this year. I hope my next blog is atleast on 8th Jan 2007. Happy New year

Code generation using StringTemplate

I've been using StringTemplate ( http://www.stringtemplate.org ) for some cool code generation for some time and its ease has really impressed me. I first used it to generate some templates to send email and got hooked on. The simplicity is just awesome. After reading some codegen articles by Terence listed here , I decided to use it to generate java files. Update: Here is a link one should read to understand code generation with StringTemplate. http://www.codegeneration.net/tiki-read_article.php?articleId=65 What I like about StringTemplate: Strict MVC which is very important IMO. I've fallen into traps using other engines where the model can be modified from within the view. As soon as I wanted to add a new view, I was totally lost. I had to go into the old view and find all places where I set some magic value into the model. I like StringTemplate's policy of just disallowing it instead of giving you an option :-) Flexibility of using various delimiters such as &#