[Xtend] Couldn't find extension 'transform(null::Specifications)' [message #546886] |
Wed, 14 July 2010 13:47 |
schm Messages: 17 Registered: June 2010 |
Junior Member |
|
|
Hi,
I'd like to import files in a special XMI Format into an editor generated with GMF. For this, I wrote a new Import Wizard that invokes an xtend transformation in its performFinish() method.
IFile file = mainPage.createNewFile();
if (file == null)
return false;
final String transformation = "model/ascet2kaom";
final String fun = "transform";
URI input = URI.createURI("");
URI output = URI.createURI("");
EPackage p1 = ComponentSpecificationPackage.eINSTANCE;
EPackage p2 = KaomPackage.eINSTANCE;
try {
// get input and output models
input = URI.createFileURI(mainPage.editor.getStringValue());
output = URI.createURI(file.getFullPath().toString());
XtendTransformationUtil
.model2ModelTransform(transformation, fun, input, output, p1, p2);
} catch (Exception e) {
e.printStackTrace();
}
The XtendTransformationUtil is a class in our project that takes two packages, two files, a file with transformations, and the name of one of the transformations, performs the transformation on the first file and saves the result in the second one. It also registers the two packages in the workflow.
It has been used before and it works. However, when I use it, I get this exception:
org.eclipse.emf.mwe.core.WorkflowInterruptedException: Couldn't find extension 'transform(null::Specifications)'!
at org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent.invokeInternal(AbstractExpressionsUsingWorkflowComponent.java:247)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
at org.eclipse.emf.mwe.core.container.CompositeComponent.internalInvoke(CompositeComponent.java:104)
at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke(CompositeComponent.java:89)
at de.cau.cs.kieler.core.model.util.XtendTransformationUtil.model2ModelTransform(XtendTransformationUtil.java:142)
at de.cau.cs.kieler.core.model.util.XtendTransformationUtil$1.execute(XtendTransformationUtil.java:197)
at de.cau.cs.kieler.core.ui.util.MonitoredOperation.runOperation(MonitoredOperation.java:221)
at de.cau.cs.kieler.core.ui.util.MonitoredOperation.access$0(MonitoredOperation.java:209)
at de.cau.cs.kieler.core.ui.util.MonitoredOperation$1.run(MonitoredOperation.java:172)
My transformation looks like this:
import ComponentSpecification;
import kaom;
extension org::eclipse::xtend::util::stdlib::io;
extension org::eclipse::xtend::util::stdlib::crossref;
extension org::eclipse::xtend::util::stdlib::cloning;
extension org::eclipse::xtend::util::stdlib::tracing;
extension org::eclipse::xtend::util::stdlib::issues;
//-----------------------------------------------------------------------------
// ASCET - 2 - KAOM TRANSFORMATION
// @author: schm
//-----------------------------------------------------------------------------
//Start Model Transformation here.
create kaom::Entity this transform(ComponentSpecification::DocumentRoot in):
this.setName("I'm a specification!")
;
From the exception I understand that a transformation with a parameter of the type 'null::Specifications' is needed but not found. I wonder why. I generated the model 'ComponentSpecification' (of which an instance serves as the input model) from an XSD. The resulting model contains a class 'DocumentRoot' that contains a reference 'specifications' of the type 'SpecificationsType'. This means there is no class 'Specifications', only a class 'SpecificationsType'. Why does he not ask for that instead? And why is it 'null::Secifications' and not 'ComponentSpecification::Specifications'?
The fact that ComponentSpecification::DocumentRoot can be resolved proves that the ecore model is found. Another question is why the top level component in the model is a 'Specifications' and not a 'DocumentRoot'.
[Updated on: Wed, 14 July 2010 13:47] Report message to a moderator
|
|
|
Re: [Xtend] Couldn't find extension 'transform(null::Specifications)' [message #547269 is a reply to message #546886] |
Fri, 16 July 2010 07:39 |
MaximeLecourt Messages: 108 Registered: February 2010 Location: France |
Senior Member |
|
|
The error message states that it couldn't find a transform extension that takes a null::Specification argument.
Having already had this type of errors, you should look at how you call the transformation, the error is more probably there hidden somewhere (I guess somewhere in XtendTransformationUtil class).
PS : you should rather use the M2T forum for any question pertaining Xtend, even for a M2M transformation, you will get quicker answers, and from people with more skills than I.
One day I shall master M2T, but that day has yet to come...
|
|
|
Powered by
FUDForum. Page generated in 0.27834 seconds