Model driven development of Java Web Application

At Avisi, I have been experimenting with the development of Java webapplications based on UML. UML in, deployable Java app out. With thanks to the Advanced Develivery Platform (ADP) of CapGemini, we are allowed to use Tobago MDA, a tool which enabled model driven developement. Tobago takes an XMI 1.1 compliant UML model (smart use cases and a domain model) and builds an internal object-tree on which you can run several templates to generate all kinds of files.

For the last two weeks I have been developing templates for Tobago which enables the generation of a Java webapplication based on the stack we use at Avisi: Freemarker, Sitemesh, Struts2, Spring, JPA Entities en JBoss appserver. We use a standard Ant build.xml, standard Eclipse-project (which by the way can be generated too) and some standard markup templates for Freemarker/Sitemesh.
    1. Create a UML-project in Enterprise Architect and model smart use cases and a domain model. No platformspecific types are used, these are mapped within the templates.hrvisi-ucdiagram-medewerkerhrvisi-clsdiagram
    2. Export the UML project as XMI
    3. Create/Generate an Eclipse project with empty folders/packages and predefined build.xml and markup-templates for Freemarker/Sitemesh decoration.
    4. Import the XMI-file into Tobago MDA.
    5. Generate sources using Tobago templates for Freemarker pages, Struts2 Action classes, Spring applicationContext.xml, EJB3 Stateless Session Beans for Services/DAO and JPA Entities.package nl.$Class.Model.Name.Lower$.dao;

      import javax.ejb.Local;
      import nl.$Class.Model.Name.Lower$.model.$Class.Name$;
      import java.util.List;

      public interface $Class.Name$Dao {
      void create($Class.Name$ $Class.Name.Lower$);
      void save($Class.Name$ $Class.Name.Lower$);
      void remove($Class.Name$ $Class.Name.Lower$);
      void remove(Long id);
      $Class.Name$ find(Long id);
      List<$Class.Name$> findByName(String name);
      List<$Class.Name$> findAll();

    6. Run build.xml
    7. Deploy war on JBoss 4.


In the first phase (which I’ve just completed) we are able to generate CRUD-functionality, in the next phases we are implementing security, validation (using Value Types and Smart References) and master-detail relations. The last thing we want to investigate is the possibility to support process-oriented design (like flowcharts) using activity- or state-chart diagrams. For now we are happy with the results, which in the future will possibly presented in some other blogs, seminars or conferences.

Geef een reactie