Java Reference
In-Depth Information
OCL/QVTO an attractive alternative because you would need to know only one
set of languages for all your transformation needs. Sharing a single set of QVT
libraries for both M2M and M2T would be most welcome.
When we start generating method body content, the template approach with-
out the intermediate Java model likely will be the preferred approach. Even bet-
ter would be the capability for QVT to invoke an Xpand template using one of
its “black box” extension mechanisms. Of course, an enhanced Java model
would be required if the former approach were used because the JEM model
lacks the proper fidelity to create complex statements. In the HTML example, if
the domain model's serialization syntax is no different from how its instances are
normally consumed, the choice of transformation options becomes more clear. In
the case of HTML, an M2M from a DSL to an XHTML model requires no M2T
to obtain the desired result. In fact, any XSD-based model imported into EMF
provides the same characteristic. Many popular or standard XML Schemas have
already been used to produce Ecore models, enhanced with additional capabili-
ties exposed as derived features and methods.
TIP
Consult the QVTO Metamodel Explorer to see what models are regis-
tered in your environment. A full Eclipse installation contains many regis-
tered models, ranging from Web Service Definition Language (WSDL), to
Enterprise Java Beans (EJB), to data models, to the Unified Modeling
Language (UML). This explorer becomes handy when authoring transfor-
mations when you need to see the model structure and available features.
7.4 Generating HTML
For both our mindmap and requirements DSLs, we want to generate documen-
tation. This can be done at least two ways using the Modeling project. First, sim-
ply use a model instance within templates to output whatever text you
want—plain ASCII, HTML, or whatever. Another approach is to do a M2M to
the model of another document, such as XHTML or another schema-backed for-
mat. The native serialization provided by EMF produces the output document,
so all we need to do is provide the M2M. To assess the pros and cons of each
approach, we use both here.
If you will generate HTML from templates, it makes sense to use JET—that
is, if you've done JSP development in the past. However, we use Xpand here to
 
 
Search WWH ::




Custom Search