I have been in process of moving from Taiwan back to California recently. I'm finally settled in for now. My partner and I finally had acquired some hours to work on the Stripes on Rails idea. The prototype includes features:
- Maven2 Webtype Plugin
- Maven2 Stripes-on-Rails Configuration Archetype
- Corresponding Templates
- Other quirks
- Override default templates
- Inherit configuration to make new configuration
- Add webtype to existing projects
We ended up calling the project Webtype (as oppose to archetype). A webtype is for now geared towards Java web-based applications. A webtype consists of an architecture configuration and corresponding templates. In the Stripes-on-Rails configuration, it includes dependencies such as Stripes, Spring, Hibernate, EJB3 Annotation, and supporting base classes such as BaseCRUDAction, BaseCRUDManager, BaseDAO to scaffold default CRUD behaviors. It would then use the templates to generate the CRUD features from a domain entity, including JSP pages, Spring configuration, Hibernate configuration, etc.
How to Use?
- webtype com.acme.example webapp # create a new webapp/ directory with a project structure
- generate Person # generate CRUD feature and configuration
- export derby # export database schema to Apache Derby database
- initdata derby # load initial data from xml into Apache Derby database
- run # execute the web server
- http://localhost:9090/webapp/Person.action # view the webapp!
The web server will check for class and JSP updates to hot deploy changes.
Play Nice with Existing Project
Webtype is a generic Maven2 plugin that looks for a webtype.xml descriptor either in the current project or in the classpath. Suppose there is an existing Maven2 project that needed quick code generation, one can easily add the descriptor and the corresponding templates to src/webtype/, that's all! It doesn't really care what architecture you have underneath, so long the generated code works for you.