Home » Modeling » M2T (model-to-text transformation) » Problem with XPAND2 generator after migration to mwe
| | | | |
Re: Problem with XPAND2 generator after migration to mwe [message #513045 is a reply to message #512909] |
Mon, 08 February 2010 16:28 |
Carmen Messages: 9 Registered: February 2010 |
Junior Member |
|
|
Ok. I started again from scratch, and I think that maybe I know where is the problem, but no idea which is the solution.
In my case, I'm developping plugins, which contains the definition of the metamodel, and the plugins required to get the workflow and run. I run this eclipse application, and in the new eclipse window I define the worflow file (.mwe) and the .xpt file. I think that maybe is a problem with the classpath, since if my plugins and source code are in the first Eclipse application, in this second one, where I have the xpt and mwe file, maybe it cannot find the projects and the path to get to that files. In this sense, If I define a new plugin project inside this second eclipse application, the workflow runs without problems and I get the files.
Could be this an explanation? If this is the case, how can I do this?
I copy and paste again the workflow file, the expand file, the error, and the source code where I call to the workflowrunner. So, for clarifying, I developped
the metamodel, then I run it as a new Eclipse application (let's say window 2), and in window2 I create a new project where I have the workflow file
and the xpand file. And then, I have a button that I press in order to call Workflowrunner internally.
Workflow source code:
<?xml version="1.0"?>
<workflow>
<!-- load model and store it in slot 'model' -->
<component class="org.eclipse.emf.mwe.utils.Reader">
<uri value="${model}" />
<modelSlot value="model" />
<firstElementOnly value="true"/>
</component>
<component id="generator" class="org.eclipse.xpand2.Generator">
<metaModel id="mm" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
<metaModelPackage value="myproject.zz.ZzPackage"/>
</metaModel>
<expand value="MyExample::myfc::main FOR model"/>
<outlet path="${outputFolder}/" />
</component>
</workflow>
Xpand file:
«IMPORT zz»
«DEFINE main FOR ZModel»
«FILE "hello.txt"»
hello
«ENDFILE»
«ENDDEFINE»
Error trace:
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: ------------------------------------------------------------ --------------------------
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: EMF Modeling Workflow Engine 0.7.2, Build v200908120417
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: (c) 2005-2009 openarchitectureware.org and contributors
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: ------------------------------------------------------------ --------------------------
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO: running workflow: file:/E:/Migration-Galileo/Workspaces/runtime-EclipseApplica tion/MyExample/mywkf.mwe
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
INFO:
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: Reader: Loading model from file:/E:/Migration-Galileo/Workspaces/runtime-EclipseApplica tion/MyExample/MyExample.zz
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: Generator(generator): generating 'MyExample::myfc::main FOR model' => E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M yExample/outpu/
08-feb-2010 16:36:55 org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflo wComponent invokeInternal
GRAVE: Error in Component generator of type org.eclipse.xpand2.Generator:
EvaluationException : No Definition 'MyExample::myfc::main for zz::ZModel' found!
[23,38] on line 1 'EXPAND MyExample::myfc::main FOR model'
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner executeWorkflow
GRAVE: Workflow interrupted. Reason: No Definition 'MyExample::myfc::main for zz::ZModel' found!
08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner logIssues
GRAVE: [ERROR]: No Definition 'MyExample::myfc::main for zz::ZModel' found!(Element: EXPAND MyExample::myfc::main FOR model; Reported by: Generator(generator): generating 'MyExample::myfc::main FOR model' => E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M yExample/outpu/)
Activator.java
/**
* The action has been activated. The argument of the
* method represents the 'real' action sitting
* in the workbench UI.
* @see IWorkbenchWindowActionDelegate#run
*/
public void run(IAction action) {
Map<String,String> properties = new HashMap<String,String>();
Map<String,String> slotContents = new HashMap<String,String>();
File modelFile = new File(" E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M yExample/MyExample.zz ");
properties.put("model", modelFile.toURI().toString());
properties.put("outputFolder", " E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M yExample/outpu " );
WorkflowRunner w = new WorkflowRunner();
String wkf = " file:/E:/Migration-Galileo/Workspaces/runtime-EclipseApplica tion/MyExample/mywkf.mwe ";
w.run(wkf, new NullProgressMonitor(), properties, slotContents);
MessageDialog.openInformation(
window.getShell(),
"MyModel Editor",
modelFile.toURI().toString());
}
Thanks for the help"!
|
|
|
Re: Problem with XPAND2 generator after migration to mwe [message #513290 is a reply to message #513045] |
Tue, 09 February 2010 16:17 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
Where is the Xpand template located?
Sven
Carmen schrieb:
> Ok. I started again from scratch, and I think that maybe I know where is
> the problem, but no idea which is the solution.
> In my case, I'm developping plugins, which contains the definition of
> the metamodel, and the plugins required to get the workflow and run. I
> run this eclipse application, and in the new eclipse window I define the
> worflow file (.mwe) and the .xpt file. I think that maybe is a problem
> with the classpath, since if my plugins and source code are in the first
> Eclipse application, in this second one, where I have the xpt and mwe
> file, maybe it cannot find the projects and the path to get to that
> files. In this sense, If I define a new plugin project inside this
> second eclipse application, the workflow runs without problems and I get
> the files.
> Could be this an explanation? If this is the case, how can I do this?
>
> I copy and paste again the workflow file, the expand file, the error,
> and the source code where I call to the workflowrunner. So, for
> clarifying, I developped the metamodel, then I run it as a new Eclipse
> application (let's say window 2), and in window2 I create a new project
> where I have the workflow file
> and the xpand file. And then, I have a button that I press in order to
> call Workflowrunner internally.
> Workflow source code:
> <?xml version="1.0"?>
> <workflow>
>
> <!-- load model and store it in slot 'model' -->
> <component class="org.eclipse.emf.mwe.utils.Reader">
> <uri value="${model}" />
> <modelSlot value="model" />
> <firstElementOnly value="true"/>
> </component>
>
> <component id="generator" class="org.eclipse.xpand2.Generator">
> <metaModel id="mm"
> class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
> <metaModelPackage value="myproject.zz.ZzPackage"/>
> </metaModel>
> <expand value="MyExample::myfc::main FOR model"/>
> <outlet path="${outputFolder}/" />
> </component>
>
> </workflow>
>
>
> Xpand file:
>
> «IMPORT zz»
>
> «DEFINE main FOR ZModel»
> «FILE "hello.txt"»
> hello
> «ENDFILE»
> «ENDDEFINE»
>
> Error trace:
>
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
> INFO: ------------------------------------------------------------
> --------------------------
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
> INFO: EMF Modeling Workflow Engine 0.7.2, Build v200908120417
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
> INFO: (c) 2005-2009 openarchitectureware.org and contributors
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
> INFO: ------------------------------------------------------------
> --------------------------
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
> INFO: running workflow:
> file:/E:/Migration-Galileo/Workspaces/runtime-EclipseApplica
> tion/MyExample/mywkf.mwe
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner prepare
> INFO: 08-feb-2010 16:36:55
> org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
> INFO: Reader: Loading model from
> file:/E:/Migration-Galileo/Workspaces/runtime-EclipseApplica
> tion/MyExample/MyExample.zz
> 08-feb-2010 16:36:55
> org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
> INFO: Generator(generator): generating 'MyExample::myfc::main FOR model'
> => E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M
> yExample/outpu/
> 08-feb-2010 16:36:55
> org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflo wComponent
> invokeInternal
> GRAVE: Error in Component generator of type
> org.eclipse.xpand2.Generator: EvaluationException : No Definition
> 'MyExample::myfc::main for zz::ZModel' found!
> [23,38] on line 1 'EXPAND MyExample::myfc::main FOR model'
>
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner
> executeWorkflow
> GRAVE: Workflow interrupted. Reason: No Definition
> 'MyExample::myfc::main for zz::ZModel' found!
> 08-feb-2010 16:36:55 org.eclipse.emf.mwe.core.WorkflowRunner logIssues
> GRAVE: [ERROR]: No Definition 'MyExample::myfc::main for zz::ZModel'
> found!(Element: EXPAND MyExample::myfc::main FOR model; Reported by:
> Generator(generator): generating 'MyExample::myfc::main FOR model' =>
> E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M
> yExample/outpu/)
>
> Activator.java
>
> /**
> * The action has been activated. The argument of the
> * method represents the 'real' action sitting
> * in the workbench UI.
> * @see IWorkbenchWindowActionDelegate#run
> */
> public void run(IAction action) {
> Map<String,String> properties = new HashMap<String,String>();
> Map<String,String> slotContents = new HashMap<String,String>();
> File modelFile = new File("
> E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M
> yExample/MyExample.zz ");
>
> properties.put("model", modelFile.toURI().toString());
> properties.put("outputFolder", "
> E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M
> yExample/outpu " );
> WorkflowRunner w = new WorkflowRunner();
>
>
>
> String wkf = "
> file:/E:/Migration-Galileo/Workspaces/runtime-EclipseApplica
> tion/MyExample/mywkf.mwe ";
> w.run(wkf, new NullProgressMonitor(), properties, slotContents);
> MessageDialog.openInformation(
> window.getShell(),
> "MyModel Editor",
> modelFile.toURI().toString());
> }
>
>
>
> Thanks for the help"!
>
--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
|
|
|
Re: Problem with XPAND2 generator after migration to mwe [message #513410 is a reply to message #513045] |
Tue, 09 February 2010 05:51 |
Volker Wegert Messages: 182 Registered: July 2009 |
Senior Member |
|
|
Carmen <carmen.alonso@esi.es> writes:
> In my case, I'm developping plugins, which contains the definition of the
> metamodel, and the plugins required to get the workflow and run. I run this
> eclipse application, and in the new eclipse window I define the worflow file
> (.mwe) and the .xpt file. I think that maybe is a problem with the
> classpath, since if my plugins and source code are in the first Eclipse
> application, in this second one, where I have the xpt and mwe file, maybe it
> cannot find the projects and the path to get to that files. In this sense,
> If I define a new plugin project inside this second eclipse application, the
> workflow runs without problems and I get the files. Could be this an
> explanation? If this is the case, how can I do this?
The "providing plug-in" (in your first Eclipse instance) needs to have the
model path in the exported classpath entries. The consuming plug-ins must
declare a dependency on the providing plug-in. The consuming plug-in does not
necessarily have to be a plug-in project in the PDE sense. Example: I'm
working on an editor/generator application that uses EMF files and calls the
generator transparently (without creating a plug-in project at runtime) to
create some output. But in this case, the "model plug-in" has to put the
models into its exported class path and the "generator plug-in" has to depend
on the model plug-in. Have you checked this?
> GRAVE: Error in Component generator of type org.eclipse.xpand2.Generator:
> EvaluationException : No Definition 'MyExample::myfc::main for zz::ZModel' found!
> [23,38] on line 1 'EXPAND MyExample::myfc::main FOR model'
Could you perhaps outline the directory structure (absolute paths to model and
XPand files)?
HTH
Volker
--
* Volker Wegert * http://www.volker-wegert.de/contact *
"INTEL inside" - The world's most widely used warning label.
|
|
| |
Re: Problem with XPAND2 generator after migration to mwe [message #513792 is a reply to message #513597] |
Thu, 11 February 2010 10:44 |
Carmen Messages: 9 Registered: February 2010 |
Junior Member |
|
|
Hi,
I tried to add to the classpath, as you suggested, in the plugin definition of classpath in runtime the model, I copy all the model files into a folder
and then I just add this folder to the classpath in the runtime of the plugin, but I still get the same error.
It fails in this point
File: ExpandStatement.class
private void invokeDefinition(final String defName, final Object targetObj, final Object[] params, final Type[] paramTypes,
XpandExecutionContext ctx) {
final Type t = ctx.getType(targetObj);
final XpandDefinition def = ctx.findDefinition(defName, t, paramTypes);
--------
The return value of def is null. And in t_name is zz::ZModel
The outline of the folder structure is the following:
Absolute path:
E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M yExample/MyExample.zz
E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M yExample/outpu/mywkf.mwe
E:/Migration-Galileo/Workspaces/runtime-EclipseApplication/M yExample/myfc.xpt
Relative path:
Name_of_the_project/Name_of_the_file
MyExample/MyExample.zz
MyExample/mywkf.mwe
MyExample/myfc.xpt
I press a button that must call internally and load the workflowrunner in order to read the
workflow, and execute it.
And the error is again the same:
GRAVE: Error in Component generator of type
org.eclipse.xpand2.Generator: EvaluationException : No Definition
'MyExample::myfc::main for zz::ZModel' found!
[23,38] on line 1 'EXPAND MyExample::myfc::main FOR model'
And I do not why, but now I cannot see the output error in the standard output and neither in the error console
Is there any console that I can use to see the errors, instead of using the debug mode and looking with breakpoints?
Thank you !
[Updated on: Thu, 11 February 2010 10:48] Report message to a moderator
|
|
|
Re: Problem with XPAND2 generator after migration to mwe [message #514100 is a reply to message #513792] |
Fri, 12 February 2010 12:29 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
Hi Carmen,
please tell us where all the resource are located.
There are lot of different possibilities to start a workflow.
It seems that you're starting it from within a running bundle in Eclipse
but expect to have things from your workspace visible.
Sven
Carmen schrieb:
> Hi,
>
> I tried to add to the classpath, as you suggested, in the plugin
> definition of classpath in runtime the model, I copy all the model files
> into a folder
> and then I just add this folder to the classpath in the runtime of the
> plugin, but I still get the same error.
>
>
> It fails in this point
>
> File: ExpandStatement.class
> private void invokeDefinition(final String defName, final Object
> targetObj, final Object[] params, final Type[] paramTypes,
> XpandExecutionContext ctx) {
> Path: build.eclipse.org!not-for-mail
> From: "Syed Imran" <tjaan01@gmail.com>
> Newsgroups: eclipse.modeling.m2t
> Subject: [Xpand] Error in reading diagram files from GMF editor
> Date: Thu, 11 Feb 2010 14:19:18 -0000
> Organization: EclipseCorner
> Lines: 121
> Message-ID: <hl13la$hrh$1@build.eclipse.org>
> NNTP-Posting-Host: 4c139.ucc.ie
> X-Trace: build.eclipse.org 1265897962 18289 143.239.81.139 (11 Feb 2010
> 14:19:22 GMT)
> X-Complaints-To: news@build.eclipse.org
> NNTP-Posting-Date: Thu, 11 Feb 2010 14:19:22 +0000 (UTC)
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
> X-RFC2646: Format=Flowed; Original
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
> Xref: build.eclipse.org eclipse.modeling.m2t:2590
>
> Hi,
>
>
>
> When running workflow on the generated diagram files of EMF-GMF editor
> models I got this error.
>
> Any idea?? What should I do to solve it?
>
> I have already put 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'
> in classpath of my project but still the problem persist.
>
>
>
>
>
> 0 INFO WorkflowRunner -
> ------------------------------------------------------------ --------------------------
>
>
> 0 INFO WorkflowRunner - openArchitectureWare 4.3.1, Build
> 200905111041NGT
>
> 0 INFO WorkflowRunner - (c) 2005-2008 openarchitectureware.org
> and contributors
>
> 0 INFO WorkflowRunner -
> ------------------------------------------------------------ --------------------------
>
>
> 0 INFO WorkflowRunner - running workflow: workflow.oaw
>
> 0 INFO WorkflowRunner -
>
> 594 INFO CompositeComponent - XmiReader(xmiParser): file
> 'example.data_diagram' => slot 'model'
>
> 1266 ERROR WorkflowRunner -
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
> uri 'http://www.eclipse.org/gmf/runtime/1.0.2/notation' not found.
> (file:/E:/Eclipse_workspace/Bismillah_M2T/Data.generator/bin /example.data_diagram,
> 2, 309)
>
> org.openarchitectureware.workflow.ConfigurationException:
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
> uri 'http://www.eclipse.org/gmf/runtime/1.0.2/notation' not found.
> (file:/E:/Eclipse_workspace/Prac_M2T/Data.generator/bin/exam ple.data_diagram,
> 2, 309)
>
> at org.openarchitectureware.emf.XmiReader.invoke(XmiReader.java :139)
>
> at
> org.openarchitectureware.workflow.container.CompositeCompone nt.internalInvoke(CompositeComponent.java:129)
>
>
> at
> org.openarchitectureware.workflow.container.CompositeCompone nt.invoke(CompositeComponent.java:112)
>
>
> at
> org.openarchitectureware.workflow.WorkflowRunner.executeWork flow(WorkflowRunner.java:380)
>
>
> at
> org.openarchitectureware.workflow.WorkflowRunner.run(Workflo wRunner.java:261)
>
>
> at
> org.openarchitectureware.workflow.WorkflowRunner.main(Workfl owRunner.java:213)
>
>
> Caused by: org.eclipse.emf.ecore.resource.Resource$IOWrappedException:
> Package with uri 'http://www.eclipse.org/gmf/runtime/1.0.2/notation' not
> found.
> (file:/E:/Eclipse_workspace/Prac_M2T/Data.generator/bin/exam ple.data_diagram,
> 2, 309)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLL oadImpl.java:83)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:191)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
>
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
>
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1282)
>
>
> at org.openarchitectureware.emf.XmiReader.invoke(XmiReader.java :136)
>
> ... 5 more
>
> Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
> with uri 'http://www.eclipse.org/gmf/runtime/1.0.2/notation' not found.
> (file:/E:/Eclipse_workspace/Prac_M2T/Data.generator/bin/exam ple.data_diagram,
> 2, 309)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2590)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2421)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1299)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1468)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1019)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:83)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
>
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
>
> ... 9 more
>
>
--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
|
|
| |
Re: Problem with XPAND2 generator after migration to mwe [message #514655 is a reply to message #514262] |
Tue, 16 February 2010 09:07 |
Carmen Messages: 9 Registered: February 2010 |
Junior Member |
|
|
Hi,
I tried the thing of the paths in the workfile and it is not the problem. And yes, my plugin is calling the workflow that is in the new project of the "new workspace" (not in the generator plugin) and in that project it is also the xpt file.
I found this entry in the oaw official webpage
http://www.openarchitectureware.org/article.php/howto_cartri dge_as_plugin
And there is a part that is exactly my problem:" Accessing resources from projects in the workspace"
My plugin needs to access/load the project in the workspace project from my plugin??. I guess that I need to define my own class loader in the same way, do I? Is the information there still valid for the new version of oaw, or do I have any other way of doing this?
Thanks a lot!
[Updated on: Tue, 16 February 2010 15:12] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Mon Oct 07 00:06:33 GMT 2024
Powered by FUDForum. Page generated in 0.05909 seconds
|