jump to navigation

openarchitectureware September 29, 2006

Posted by steve in EMF, Eclipse, MDE, OAW.
trackback

I have been using openarchitectureware for several months now and I am becoming a convert to MDA/MDE and code generation. Here are the basic steps I have taken to create a user interface tool using Eclipse:

  1. Created an Ecore (EMF) model that represented the UI meta-model. This model includes classes like “webapp”, “page”, “field”, “checkbox”, etc.
  2. Generated an EMF “GenModel” from the ecore. This is an automated step.
  3. Generated Java classes and an Eclipse editor for the model.  Again, a right-click and “generate all” – no extra effort.
  4. Installed the editor into Eclipse. This default editor lets you edit your domain-specific model in a tree-view / property sheet kind of editor that you frequently see in Eclipse.
  5. Created a domain-specific model (using cool new editor) to represent a sample application. Create some pages, insert some sections, fields, buttons, etc. (All these things are classes in the meta-model).

So far so good? Everything I have described to this point is basic Eclipse with EMF. Now enters openarchitecureware (OAW):

OAW introduces the concept of a “workflow”, which is an XML doc that describes the steps to be taken in the workflow. A basic workflow is:

  1. Parse the model XML using an OAW-supplied XmiReader.
  2. Run a Check that incorporates custom validation of the model.
  3. Run code generation using the OAW-supplied “Xpand2″ template language.
  4. Enjoy fruits of labor.

Before you can complete step 4, however, you must write the code generation macros in the Xpand2 language. Xpand2 is a very powerful template language that can produce pretty much any textual output (e.g. Java source code, XML, HTML, Javascript, etc., etc. ) Xpand2 supports polymorphism in that you may supply macros for a type and then overload the macro for subtypes. Quite powerful and very enjoyable to work with.  OAW also supplies a language called Check that can be used for validation and Xtend that can be used to integrate with Java when you need custom logic that you cannot write in Xpand2.

As a further note, EMF is not the only form of meta-model that OAW can operate on- it also supports a Java Bean model, but I have only used EMF.

Comments»

1. « Achilles’ Tortoise - September 29, 2006

[...] I describe in the openarchitectureware post about how I generate code from a model. This process is better and more completely described in the OAW 4.1 EMF Tutorial. Onward to what I have generated: [...]