In my current project we need to generate two kind of artifacts, some Java classes that represents bottom up Web Services, and very few XML, the Axis2 descriptor to expose these services.
I admit it, XSLT engines scares me! I've been looking for solutions and it seems that the best approach are template engines. The code to generate is very simple, but i want an MVC approach. I can generate XML with standard apis, using java.xml.Transformer but i didn't found a similar approach to metagenerate Java with a predefined view and controller. Anyway it would be two different apis to manage.
A Template engine is a unified approach for the two artifacts generation, it generates a output based in a template in a language which works with the model.
The template language is the main difference between Apache Velocity and Eclipse JET. Velocity seems more powerful but JET has the advantage that the templates are written in JSP syntax. The other main advantage is that is integrated in Eclipse IDE environment to generate a Java class from the template that performs the transformation, so you can use the template "compiled" in a standalone environment.
As JET is part of Eclipse Modeling Framework EMF, you can use in combination with an EMF meta-model, but we are not going to use this feature.
The next release of JET, JET2 is included in another Eclipse subproject, M2T and it will include new interesting features like JSTL tags and a powerful visual editor.
As there's not a stable release of JET2 and for our requirements version 1 is capable and runs with our Eclipse version we are going to use the stable release.
If you want to start with JET (version 1) these are two fantastic introductory resources:
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario