Skyway Builder 6.3 Feature Preview – #5 Custom Spring Templates using JET
In the last feature review blog post (feature preview #4), I introduced a new feature that provides project-level and artifact-level code generation customization for Spring. This gives Spring developers a lot of flexibility in adapting the generated solution according to their adopted project standards. However, there is a another aspect to code generation that isn’t covered by that feature, and that’s where configurable code generation templates come into play. Before I dive into this new feature, let me take a step back to briefly explain code generation, particularly as it relates to Skyway Builder, the Spring Domain-Specific Language (DSL), and Spring MVC and WebFlow applications.
Our Spring DSL is a formalized set of EMF models and extensions by Skyway that represents the building blocks of an enterprise application. (See Skyway’s “Perspective” on Software Generation) The Spring DSL is the language that the application developer uses to specify the implementation of the desired application. The Spring DSL is appropriate for defining complete Spring applications, but it is also suitable for defining parts of a Spring application. As the developer defines their application using the Spring DSL, the meta-data backing the DSL serves as the input into the code generation engine. Ultimately, the meta-data needs to be converted into a concrete Spring application, and there are two related aspects to code generation that help to accomplish that. First of of all, the code generator needs to know:
- what primary and secondary artifacts need to be generated from the Spring DSL artifact
- what are the desired filenames of the generated artifacts
- where do the artifacts need to be generated to
- what package name should be used (for Java-based assets)
This aspect of code generation is represented by the configurable code generation feature that I discussed in feature preview #4. The second aspect of code generation is the conversion from the Spring DSL into concrete implementations. This is accomplished by using code generation templates that translate the Spring DSL abstractions into Spring, Java, and JPA code and configurations. These templates are implemented using JET, a template engine from the Eclipse M2T project for transforming meta-data/models to concrete code using an approach similar to JavaServer Pages (JSP). By using a standard and easy-to-use template technology, the Spring templates are easy to customize and adapt to different implementation requirements.
Similar to configurable code generation, the customization of code generation templates isn’t new to Skyway Builder. This feature has been available in Skyway Builder from the very beginning, and it’s a very powerful feature that has been leveraged by many developers and architects to customize the transformation and output of the code generation engine. What’s new in Skyway Builder 6.3 Enterprise Edition is the ability for these templates to be customized without requiring custom Eclipse plugin development. In Skyway Builder 6.3 you can create a Skyway Template Project for customizing a full set of code generation templates. The Skyway Template Project is a standard Eclipse project that contains all of the available JET templates for the Spring DSL. Application development projects will by default use the standard templates from the Skyway plugins for Eclipse, but the project can be easily configured to use any Skyway Template Project (in the Eclipse workspace) as the source for the templates.
This enhancement to Skyway Builder enables the following:
- Any developer can customize application templates – Eclipse plugin development experience is not required. The only skillset required to customize templates is is JET, which is very similar to JSP.
- Customized templates can be used on a project by project basis – If needed, each project can have a distinct set of templates.
- Customized templates can be shared across projects – As templates are adapted to conform to company standards and desired implementations, they can be shared across development projects.
- Customizations can be version controlled like standard Eclipse projects – The templates that were used to generate the code and configurations can be version controlled with the application.
- Customization of code generation for Skyway Builder CE and EE – The templates for Skyway Builder Community Edition (CE) and Skyway Builder Enterprise Edition (EE) functionality can be customized. See the Product Features page for a list of CE and EE functionality.
Please remember that this is a feature preview. Skyway Builder 6.3 should be available near the end of August. To stay in the loop on the upcoming 6.3 release, please follow us on Twitter, become a fan of Skyway Builder on Facebook, or join the Skyway Community. As one of the many benefits of joining our community, you will automatically receive product announcements and updates.
Skyway Builder 6.3 Feature Preview Series
- Skyway Builder 6.3 Feature Preview – #1 Enhanced Spring MVC Scaffolding
- Skyway Builder 6.3 Feature Preview – #2 Model Packages
- Skyway Builder 6.3 Feature Preview – #3 Spring DSL Enhancements
- Skyway Builder 6.3 Feature Preview – #4 Configurable Spring Code Generation
- Skyway Builder 6.3 Feature Preview – #5 Custom Spring Templates using JET
- Skyway Builder 6.3 Feature Preview – #6 Spring Services via Javascript/JSON using DWR
Tags: Code Generation, Eclipse EMF, emf, java, JET, Skyway Builder 6.3, Spring DSL, Spring Framework, spring mvc







