VIATRA2/Model based development of AJAX user interfaces
Description of the example
The model-driven development is a new direction in information technology. The Object Management Group (OMG) has a proposal for this idea, called the Model-Driven Architecture (MDA). It suggests that the development of softwares should be done by platform independent models (PIM) which have to be transformed to platform specific models (PSM) and finally, we should generate the code of the application by these platform dependent models.
In the VIATRA2 framework, we implemented a development technique which provides the automatic code generation of AJAX applications' user interfaces by the use of a platform independent model, which is able to describe native and web-based user interfaces, too. After preparing the platform dependent metamodel of the AJAX environment, we implemented the transformations creating the platform specific models from the platform independent ones. Finally, we also worked out the code generating transformations which iterate through these platform specific models.
The user interfaces' platform independent models (UiPIM) are the input models of the development technique. These models can be created by the domain specific editor of the framework (ViatraDSM). In the present case, the platform specific models (PSM) are the instances of the web metamodels, located under the web entity in the model space.
On the server side, an application stub is generated, which provides a communication layer between the user interfaces and the business logic of the application. This stub runs on the Java platform, which means that the server-side of the PSM is a Java application model, described by the Java metamodel. This metamodel consists of the elements and the syntactical rules of the language. The Fig. 2 shows its elements representing the structure of a Java application.
Following the idea of the model-driven development, the first transformations, called ajaxPSMPages and ajaxPSMApp, iterate through the PIM and create the platform specific ones (i.e. the PSM of the web page and the application stub). The Fig. 3 shows the rule transforming the platform independent selectionList into the select model element, which represents the SELECT tag of the HTML specification.
The code of the HTML pages and the Java application is generated from these platform specific models. A rule of the ajaxCODEPages transformation, which prints the SELECT tag, can be seen on the Fig. 4.
The attached source code