Java Reference
In-Depth Information
Reader
A Reader must be configured and populated with the input model instance for
use in the Generator component. The default org.eclipse.emf.mwe.utils.
Reader has a number of nested elements, which are covered next. At a mini-
mum, a Reader is configured with a uri and modelSlot element to indicate
where to load the model from and which slot to populate, respectively. Following
is an example:
< component class="org.eclipse.emf.mwe.utils.Reader">
< uri value="${model}" />
< modelSlot value="model" />
</ component >
uri
The uri element contains the path to the model to be loaded. As mentioned in
the previous properties section, this is a path that is typically expressed using a
uri value. It's common to set a property to this value so that it can be substi-
tuted with a runtime parameter during deployment.
modelSlot
The modelSlot element defines the default model slot that is used in the expand
element of our Generator element. Typically, the uri element is used to populate
this slot with a model instance, as in the previous example.
firstElementOnly
Set this element's value attribute to false if the input model has multiple root
elements that require processing. The default for EMF models is to have a single
root element, so the default value for this element is true , meaning that it does
not normally need to be defined. However, sometimes multiple roots are present
and should be passed to the template, as is the case in GMF when diagram and
domain models are persisted in the same file.
Xpand Component
A predefined workflow component provided with Xpand is the org.eclipse.
xpand2.Generator class. The use of this component is complemented by
workflow properties, metamodel references, and model readers. Following is a
basic configuration that was used to invoke our earlier template examples that
produced CSV files from our mindmap model.
Search WWH ::




Custom Search