Introduction
Tobago MDA is used within the ADP to generate applications for the Microsoft platform (.NET, Silverlight, WCF). At
Avisi, we are experimenting for year with several kickstart-applications like Seam and AppFuse, however most of those applications have some major disadvantages:
We like to use Ant
- No easy way to change the stack that is used
Although we tend to use the same stack for several projects, changing parts of the stack is no exception. Other web-framework, other OR-mapper, etc.
- Built for developers only
You have to have detailed knowledge about the frameworks that are used to support the architecture to generate or kickstart applications. We were looking for a way to model in a visual way and generate text based files which can be easily modified later.
Java Stack
The following examples use the following stack (however, due to the flexibility of the templates and the generator, other parts can be put in easiliy by adjusting templates or by creating new ones:
- Freemarker (templating, generating markup)
- Sitemesh (decorating)
- Struts2 / Webwork (MVC framework)
- EJB3 stateless session beans (use case controllers, services)
- JPA (object relational mapping)
- JBoss (applicationserver)
Smart Use Cases
We use this simple use case model for now:
 Smart Use Case Model |
Domain Model¶
The following simple domain model is used to test the templates:
 Domain Model |
Example Templates
Freemarker Template for a manage stereotyped use case:
<h2 class="title">$Attribute.Name.Pascal$beheer</h2>
<@display.table name="$Attribute.Name.Lower$List">
<@display.column property="name" title="name" />
<Tobago.Loop(Attribute.Classifier.Attributes, "ManageAttributes")>
<@display.column
paramProperty="id"
title="details"
href="list$Attribute.Name.Pascal$.action"
paramId="id">details
</@display.column>
<@display.column
paramProperty="id"
title="verwijder"
href="remove$Attribute.Name.Pascal$.action"
paramId="id">verwijder
</@display.column>
</@display.table>
<br>
<a href="add$Attribute.Name.Pascal$.action">
Voeg een nieuwe $Attribute.Name.Lower$ toe
</a>
Data Access Object (DAO):
package nl.$Class.Model.Name.Lower$.dao;
import javax.ejb.Local;
import nl.$Class.Model.Name.Lower$.model.$Class.Name$;
import java.util.List;
@Local
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();
}
Spring Application Context for Struts2:
<beans>
<Tobago.Loop(Model.Classes, Classes)>
</beans>
<bean id="$Class.Name.Camel$Action"
class="nl.$Class.Model.Name.Lower$.action.$Class.Name$Action"
scope="prototype">
<constructor-arg ref="beheer$Class.Name$sService" />
</bean>
Work to do
The first results are promising, however there are some hard nutts to crack:
- using use cases as executable parts (have to adjust/create our framework)
- master detail relations
- investigate process-oriented modeling, like statechart- or activitydiagrams
- more focus on role-modelling and inheritance in the domain model