[Solved][XPand+MWE] Execute MWE(v1.2.1) programmatically [message #1707549] |
Mon, 07 September 2015 09:17 |
Zheng Cheng Messages: 15 Registered: February 2012 |
Junior Member |
|
|
Hello,
My question is how to properly register a metamodel that contains multiple EPackage in MWE?
Everything is fine when I work with XPand+MWE inside Eclipse. But not after I have this simple Java code to execute my XPand+MWE file outside Eclipse.
File f = new File(file);
URI fileURI = URI.createFileURI(f.getAbsolutePath());
Map<String, String> properties = new HashMap<String, String>();
properties.put("model", fileURI.toString());
properties.put("src-gen",srcGenPath);
WorkflowRunner wr = new WorkflowRunner();
wr.run(workflowName, null, properties, null);
Here is the MWE file I execute:
<?xml version="1.0"?>
<workflow>
<!-- set up EMF for standalone execution -->
<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" >
<platformUri value=".."/>
<RegisterEcoreFile value="ATL.ecore"/>
</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="${model}" />
<modelSlot value="model" />
</component>
<!-- generate code -->
<component class="org.eclipse.xpand2.Generator">
<metaModel id="mm" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel" />
<expand
value="template::atlApply2boogie::main FOR model" />
<outlet path="${src-gen}" >
<postprocessor class="org.eclipse.xpand2.output.JavaBeautifier" />
</outlet>
</component>
</workflow>
The error trace I got at runtime like this:
90 INFO WorkflowEngine - running workflow: apply.mwe
91 INFO WorkflowEngine -
297 INFO StandaloneSetup - Registering platform uri 'E:\NEW'
328 WARN StandaloneSetup - No projects found in platform location '..'
because there are no '.project' files.
Please use explicit project mappings:
projectMapping = { projectName = 'com.acme' path = '../path/com.acme' }.
510 INFO StandaloneSetup - Adding dynamic EPackage 'http://www.eclipse.org/gmt/2005/ATL' from 'ATL.ecore'
510 INFO StandaloneSetup - Adding dynamic EPackage 'http://www.eclipse.org/gmt/2005/OCL' from 'ATL.ecore'
510 INFO StandaloneSetup - Adding dynamic EPackage 'http://www.eclipse.org/gmt/2005/ATL-PrimitiveTypes' from 'ATL.ecore'
600 INFO CompositeComponent - Reader: Loading model from ER2REL.xmi
627 INFO CompositeComponent - Generator: generating 'template::atlApply2boogie::main FOR model' => /gen/
658 ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component of type org.eclipse.xpand2.Generator:
EvaluationException : No Definition 'template::atlApply2boogie::main for ATL::Module' found!
[23,48] on line 1 'EXPAND template::atlApply2boogie::main FOR model'
658 ERROR WorkflowEngine - Workflow interrupted. Reason: No Definition 'template::atlApply2boogie::main for ATL::Module' found!
658 ERROR WorkflowEngine - [ERROR]: No Definition 'template::atlApply2boogie::main for ATL::Module' found!(Element: EXPAND template::atlApply2boogie::main FOR model; Reported by: Generator: generating 'template::atlApply2boogie::main FOR model' => /gen/)
[510] indicates the EPackages of my ATL metamodel are registered. However, it seems not match with my XPand template. Here is my template::atlApply2boogie::main:
«IMPORT ATL»
«IMPORT OCL»
«REM» «DEFINE main FOR ATL::Module-» NOT WORK EITHER «ENDREM»
«DEFINE main FOR Module-»
«FILE "ATL_apply_single.bpl"-»
«EXPAND printApplyerForMatchRule FOREACH elements-»
«ENDFILE-»
«ENDDEFINE»
...
I wonder what is the problem here. Any suggestions are welcome. Thanks a lot.
Zheng
-
Attachment: ATL.ecore
(Size: 32.48KB, Downloaded 234 times)
[Updated on: Fri, 25 September 2015 15:39] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05993 seconds