|
|
|
Re: xpand [message #671426 is a reply to message #671389] |
Tue, 17 May 2011 20:46   |
|
Hi,
i do not really know how to help you. there are the docs with a tutorial, the wizard creates an example.
here is the workflow (Eclipse Xpand 1.0.x - in oAW 4.3.1 the classnames are a bit different)
<?xml version="1.0"?>
<workflow>
<property name="model" value="my.generator.project/src/Model.xmi" />
<property name="src-gen" value="src-gen" />
<!-- set up EMF for standalone execution -->
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
<platformUri value=".."/>
</bean>
<!-- instantiate metamodel -->
<bean id="mm_emf" class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
<!-- load model and store it in slot 'model' -->
<component class="org.eclipse.emf.mwe.utils.Reader">
<uri value="platform:/resource/${model}" />
<modelSlot value="model" />
</component>
<!-- check model -->
<component class="org.eclipse.xtend.check.CheckComponent">
<metaModel idRef="mm_emf"/>
<checkFile value="metamodel::Checks" />
<emfAllChildrenSlot value="model" />
</component>
<!-- generate code -->
<component class="org.eclipse.xpand2.Generator">
<metaModel idRef="mm_emf"/>
<expand
value="template::Template::main FOR model" />
<outlet path="${src-gen}" >
<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
</outlet>
</component>
</workflow>
it should not be a problem to adapt this to other ecore based metamodels.
the workflow expects the metamodel to be already registered to the registry.
if this is not the case with your metamodel you can simply do this by changing to
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
<platformUri value=".."/>
<registerEcoreFile value="src/metamodel/metamodel.ecore" />
</bean>
if you have any specific questions feel free to ask.
Regards,
Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: xpand [message #671560 is a reply to message #671559] |
Wed, 18 May 2011 10:16   |
|
Hi,
the reader loads the model in to a map (slot) under the key model
the generator does call with the template::Template::main FOR model" statement
the definition main in the file template/Template.xpt for the type of the model roots type e.g.
<<DEFINE main FOR ModelRootsType>>
<<ENDDEFINE>>
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: xpand [message #671709 is a reply to message #671634] |
Wed, 18 May 2011 18:27   |
|
Hi,
i have no clue why you are using XMLReader which is for reading XSD Based XML files and not for ecore based xmis
what about simply using a workflow as i posted before?
<?xml version="1.0"?>
<workflow>
<property name="model" value="my.generator.project/src/vhalams.xmi" />
<property name="src-gen" value="src-gen" />
<!-- set up EMF for standalone execution -->
<bean class="org.eclipse.mwe.emf.StandaloneSetup" >
<platformUri value=".."/>
<registerEcoreFile value="src/metamodel/vhdl.ecore" />
</bean>
<!-- load model and store it in slot 'model' -->
<component class="org.eclipse.mwe.emf.Reader">
<uri value="platform:/resource/${model}" />
<modelSlot value="model" />
</component>
<!-- generate code -->
<component class="org.openarchitectureware.xpand2.Generator">
<metaModel class="org.eclipse.m2t.type.emf.EmfRegistryMetaModel"/>
<expand
value="template::Template::main FOR model" />
<outlet path="${src-gen}" >
<postprocessor class="org.openarchitectureware.xpand2.output.JavaBeautifier" />
</outlet>
</component>
</workflow>
and then i have no idea how you git that xmi,
if i create one with ecore means it would look like
<?xml version="1.0" encoding="ASCII"?>
<Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="vhdl" xsi:schemaLocation="vhdl metamodel/vhdl.ecore" name="exemple">
<entite name="cell">
<archi name="cell">
<function name="operation"/>
<contraints name="x=x+1"/>
<composants name="microActuator">
<portInterne name="port1"/>
</composants>
<composants name="microSensor">
<portInterne name="port2"/>
</composants>
<composants name="microController">
<portInterne name="port3"/>
<portInterne name="port3"/>
</composants>
<connector role="port1" port="port3"/>
<connector role="port2" port="port4"/>
</archi>
</entite>
</Model>
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: xpand [message #671840 is a reply to message #671837] |
Thu, 19 May 2011 07:11   |
|
Hi,
i tried to explain this problem to you before:
guess you have this template in a file src/bla/Blubb.xpt
«IMPORT vhdl»
«DEFINE Root FOR vhdl::Model»
«FILE "vhdl.txt"»
Name: «name»
«ENDFILE»
«ENDDEFINE»
then of course you have to call
<expand
value="bla::Bliubb::Root FOR model" />
I thought a least the error message from the workflow runner should have given you that hint
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02003 seconds