Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Programmaticaly launch transformation involving UML models
[ATL] Programmaticaly launch transformation involving UML models [message #84331] Wed, 11 June 2008 13:43 Go to next message
Eclipse UserFriend
Originally posted by: karp.no-mail.com

Hi,
I'm trying to write a small transformation involving UML2 models.
I have no problem to launch it through the atl perspective. I use
"uri:http://www.eclipse.org/uml2/2.1.0/UML" as the uri of the UML metamodel.
But I haven't managed to lauch it programmaticaly (I have no problem for
standard non-UML models).

My atl transformation is like that, very simple :
----------------------8<------------------------
module SimpleUMLNoProfile; -- Module Template
create B : UML from A : UML;
rule Model {
from
s : UML!"uml::Model"
to
t : UML!"uml::Model"
}
---------------------8<-------------------------

My model in input is like that : (basically a model, a package, a class)
---------------------8<-------------------------
<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
xmi:id="_eGIhADeTEd2OqNGrMp5Krw" name="ModelA">
<packageImport xmi:id="_eGIhATeTEd2OqNGrMp5Krw">
<importedPackage xmi:type="uml:Model"
href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
</packageImport>
<packagedElement xmi:type="uml:Package"
xmi:id="_qbq6UDeTEd2OqNGrMp5Krw" name="PackageA">
<packagedElement xmi:type="uml:Class"
xmi:id="_snfRoDeTEd2OqNGrMp5Krw" name="ClassA">
<ownedAttribute xmi:id="_usVeQDeTEd2OqNGrMp5Krw" name="PropertyA"
isUnique="false">
<type xmi:type="uml:PrimitiveType"
href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
</ownedAttribute>
</packagedElement>
</packagedElement>
<profileApplication xmi:id="_eGIhAjeTEd2OqNGrMp5Krw">
<eAnnotations xmi:id="_eGIhAzeTEd2OqNGrMp5Krw"
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage"
href=" pathmap://UML_PROFILES/Standard.profile.uml#_yzU58YinEdqtvbn fB2L_5w"/>
</eAnnotations>
<appliedProfile href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
</profileApplication>
</uml:Model>
--------------------8<-----------------------------

My code...
--------------------8<-----------------------------
AtlModelHandler amh = null;
amh = new AtlUML2ModelHandler();

URL urlTransfo = null;
try { urlTransfo = asmFile.toURI().toURL();
} catch (MalformedURLException e) {}
Map<String, ASMModel> mapASMModels = new HashMap<String, ASMModel>();

ResourceSet resourceSet = AtlEMFModelHandler.getResourceSet();

resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.1.0/UML",
UMLPackage.eINSTANCE);
URI uri =
URI.createURI(" jar:file:/D:/eclipse/eclipse-modeling-ganymede-RC1-win32/ATL _LIBS_RC3/org.eclipse.uml2.uml.resources_2.2.0.v200805131030 .jar!/ ");

resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.LIBRARIES_PATHMAP),
uri.appendSegment("libraries").appendSegment(""));

resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));

resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);

ASMModel asmUML = ((AtlEMFModelHandler)amh).loadModel("UML",
amh.getMof(), "uri:http://www.eclipse.org/uml2/2.1.0/UML");

File fileA = new File(PATH + "ModelA.uml");
InputStream inA = null;
try { inA = fileA.toURI().toURL().openStream();
} catch (MalformedURLException e) {} catch (IOException e) {}
ASMModel asmA;
asmA = amh.loadModel("A", asmUML, inA);


File fileB = new File(PATH + "ModelB.uml");
InputStream inB = null;
try {inB = fileB.toURI().toURL().openStream();
} catch (MalformedURLException e) {} catch (IOException e) {}
ASMModel asmB = amh.loadModel("B", asmUML, inB);

mapASMModels.put("A", asmA);
mapASMModels.put("B", asmB);
mapASMModels.put("UML", asmUML);

Map params = Collections.EMPTY_MAP; // Parameters
Map<String, URL> mapLibs = new HashMap<String, URL>();

// Launch ATL transformation
AtlLauncher.getDefault().launch(urlTransfo, mapLibs, mapASMModels,
params,
Collections.EMPTY_LIST, Collections.EMPTY_MAP);
--------------------8<-----------------------------

And now the error : (sorry for the length)
--------------------8<-----------------------------
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
GRAVE: ****** BEGIN Stack Trace
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
GRAVE: exception:
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
GRAVE: argument type mismatch
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:69)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
at UmlAtlLaunch.transfoRegularVM(UmlAtlLaunch.java:86)
at UmlAtlTest.main(UmlAtlTest.java:9)
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: A.main() : ??#22 null
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: local variables = {self=SimpleUMLNoProfile : ASMModule}
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: local stack = []
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: A.__matcher__() : ??#1 null
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: local variables = {self=SimpleUMLNoProfile : ASMModule}
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: local stack = []
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: A.__matchModel() : ??#35 null
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: local variables = {s=A!ModelA, self=SimpleUMLNoProfile : ASMModule}
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: local stack = [TransientLinkSet {}]
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: NativeOperation public static void
org.eclipse.m2m.atl.engine.vm.nativelib.ASMTransientLink.add TargetElement(org.eclipse.m2m.atl.engine.vm.StackFrame,org.e clipse.m2m.atl.engine.vm.nativelib.ASMTransientLink,org.ecli pse.m2m.atl.engine.vm.nativelib.ASMString,org.eclipse.m2m.at l.engine.vm.nativelib.ASMOclAny)
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
GRAVE: args = [TransientLink {rule = 'Model', sourceElements = {s =
A!ModelA}, targetElements = {}, variables = {}}, TransientLink {rule =
'Model', sourceElements = {s = A!ModelA}, targetElements = {}, variables
= {}}, 't']
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
GRAVE: ****** END Stack Trace
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
INFO: Execution terminated due to error (see launch configuration to
allow continuation after errors).
11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.AtlLauncher launch
GRAVE: null
java.lang.RuntimeException
at
org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:195)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:95)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:87)
at
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:74)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
at UmlAtlLaunch.transfoRegularVM(UmlAtlLaunch.java:86)
at UmlAtlTest.main(UmlAtlTest.java:9)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:69)
... 19 more

--------------------8<-----------------------------
Re: [ATL] Programmaticaly launch transformation involving UML models [message #84346 is a reply to message #84331] Wed, 11 June 2008 16:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: karp.no-mail.com

By the way if someone could upload a sample project where he manages to
launch programmaticaly an ATL transformation using UML models that'd be
awesome.
Re: [ATL] Programmaticaly launch transformation involving UML models [message #84359 is a reply to message #84331] Wed, 11 June 2008 16:50 Go to previous messageGo to next message
neto Mising name is currently offline neto Mising nameFriend
Messages: 33
Registered: July 2009
Member
your transfomation is create B : UML from A : UML;

so, the model A must be a InputStream but the B must be a OutputStream,
and the ASMModel need be a newModel, dont a loadModel.

Netuh

karp wrote:

> Hi,
> I'm trying to write a small transformation involving UML2 models.
> I have no problem to launch it through the atl perspective. I use
> "uri:http://www.eclipse.org/uml2/2.1.0/UML" as the uri of the UML metamodel.
> But I haven't managed to lauch it programmaticaly (I have no problem for
> standard non-UML models).

> My atl transformation is like that, very simple :
> ----------------------8<------------------------
> module SimpleUMLNoProfile; -- Module Template
> create B : UML from A : UML;
> rule Model {
> from
> s : UML!"uml::Model"
> to
> t : UML!"uml::Model"
> }
> ---------------------8<-------------------------

> My model in input is like that : (basically a model, a package, a class)
> ---------------------8<-------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Model xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
> xmi:id="_eGIhADeTEd2OqNGrMp5Krw" name="ModelA">
> <packageImport xmi:id="_eGIhATeTEd2OqNGrMp5Krw">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packagedElement xmi:type="uml:Package"
> xmi:id="_qbq6UDeTEd2OqNGrMp5Krw" name="PackageA">
> <packagedElement xmi:type="uml:Class"
> xmi:id="_snfRoDeTEd2OqNGrMp5Krw" name="ClassA">
> <ownedAttribute xmi:id="_usVeQDeTEd2OqNGrMp5Krw" name="PropertyA"
> isUnique="false">
> <type xmi:type="uml:PrimitiveType"
> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
> </ownedAttribute>
> </packagedElement>
> </packagedElement>
> <profileApplication xmi:id="_eGIhAjeTEd2OqNGrMp5Krw">
> <eAnnotations xmi:id="_eGIhAzeTEd2OqNGrMp5Krw"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <references xmi:type="ecore:EPackage"
> href=" pathmap://UML_PROFILES/Standard.profile.uml#_yzU58YinEdqtvbn fB2L_5w"/>
> </eAnnotations>
> <appliedProfile href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
> </profileApplication>
> </uml:Model>
> --------------------8<-----------------------------

> My code...
> --------------------8<-----------------------------
> AtlModelHandler amh = null;
> amh = new AtlUML2ModelHandler();

> URL urlTransfo = null;
> try { urlTransfo = asmFile.toURI().toURL();
> } catch (MalformedURLException e) {}
> Map<String, ASMModel> mapASMModels = new HashMap<String, ASMModel>();

> ResourceSet resourceSet = AtlEMFModelHandler.getResourceSet();

>
resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.1.0/UML",
> UMLPackage.eINSTANCE);
> URI uri =
>
URI.createURI(" jar:file:/D:/eclipse/eclipse-modeling-ganymede-RC1-win32/ATL _LIBS_RC3/org.eclipse.uml2.uml.resources_2.2.0.v200805131030 .jar!/ ");

>
resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));

>
resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));

>
resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));

>
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);

> ASMModel asmUML = ((AtlEMFModelHandler)amh).loadModel("UML",
> amh.getMof(), "uri:http://www.eclipse.org/uml2/2.1.0/UML");

> File fileA = new File(PATH + "ModelA.uml");
> InputStream inA = null;
> try { inA = fileA.toURI().toURL().openStream();
> } catch (MalformedURLException e) {} catch (IOException e) {}
> ASMModel asmA;
> asmA = amh.loadModel("A", asmUML, inA);


> File fileB = new File(PATH + "ModelB.uml");
> InputStream inB = null;
> try {inB = fileB.toURI().toURL().openStream();
> } catch (MalformedURLException e) {} catch (IOException e) {}
> ASMModel asmB = amh.loadModel("B", asmUML, inB);

> mapASMModels.put("A", asmA);
> mapASMModels.put("B", asmB);
> mapASMModels.put("UML", asmUML);

> Map params = Collections.EMPTY_MAP; // Parameters
> Map<String, URL> mapLibs = new HashMap<String, URL>();

> // Launch ATL transformation
> AtlLauncher.getDefault().launch(urlTransfo, mapLibs, mapASMModels,
> params,
> Collections.EMPTY_LIST, Collections.EMPTY_MAP);
> --------------------8<-----------------------------

> And now the error : (sorry for the length)
> --------------------8<-----------------------------
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
> GRAVE: ****** BEGIN Stack Trace
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
> GRAVE: exception:
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
> GRAVE: argument type mismatch
> java.lang.IllegalArgumentException: argument type mismatch
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
>
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:69)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
> at UmlAtlLaunch.transfoRegularVM(UmlAtlLaunch.java:86)
> at UmlAtlTest.main(UmlAtlTest.java:9)
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: A.main() : ??#22 null
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: local variables = {self=SimpleUMLNoProfile : ASMModule}
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: local stack = []
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: A.__matcher__() : ??#1 null
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: local variables = {self=SimpleUMLNoProfile : ASMModule}
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: local stack = []
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: A.__matchModel() : ??#35 null
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: local variables = {s=A!ModelA, self=SimpleUMLNoProfile : ASMModule}
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: local stack = [TransientLinkSet {}]
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: NativeOperation public static void
>
org.eclipse.m2m.atl.engine.vm.nativelib.ASMTransientLink.add TargetElement(org.eclipse.m2m.atl.engine.vm.StackFrame,org.e clipse.m2m.atl.engine.vm.nativelib.ASMTransientLink,org.ecli pse.m2m.atl.engine.vm.nativelib.ASMString,org.eclipse.m2m.at l.engine.vm.nativelib.ASMOclAny)
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv printStackTrace
> GRAVE: args = [TransientLink {rule = 'Model', sourceElements = {s =
> A!ModelA}, targetElements = {}, variables = {}}, TransientLink {rule =
> 'Model', sourceElements = {s = A!ModelA}, targetElements = {}, variables
> = {}}, 't']
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
> GRAVE: ****** END Stack Trace
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
> INFO: Execution terminated due to error (see launch configuration to
> allow continuation after errors).
> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.AtlLauncher launch
> GRAVE: null
> java.lang.RuntimeException
> at
> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:195)
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:95)
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:87)
> at
>
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:74)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
> at
> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
> at UmlAtlLaunch.transfoRegularVM(UmlAtlLaunch.java:86)
> at UmlAtlTest.main(UmlAtlTest.java:9)
> Caused by: java.lang.IllegalArgumentException: argument type mismatch
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
>
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:69)
> ... 19 more

> --------------------8<-----------------------------
Re: [ATL] Programmaticaly launch transformation involving UML models [message #84374 is a reply to message #84359] Thu, 12 June 2008 07:05 Go to previous message
Eclipse UserFriend
Originally posted by: karp.no-mail.com

Thanks,

It was a stupid mistake of mine.
Thanks for letting me see it.

Netuh has written :
>
> your transfomation is create B : UML from A : UML;
>
> so, the model A must be a InputStream but the B must be a OutputStream,
> and the ASMModel need be a newModel, dont a loadModel.
>
> Netuh
>
> karp wrote:
>
>> Hi,
>> I'm trying to write a small transformation involving UML2 models.
>> I have no problem to launch it through the atl perspective. I use
>> "uri:http://www.eclipse.org/uml2/2.1.0/UML" as the uri of the UML
>> metamodel.
>> But I haven't managed to lauch it programmaticaly (I have no problem
>> for standard non-UML models).
>
>> My atl transformation is like that, very simple :
>> ----------------------8<------------------------
>> module SimpleUMLNoProfile; -- Module Template
>> create B : UML from A : UML;
>> rule Model {
>> from
>> s : UML!"uml::Model"
>> to
>> t : UML!"uml::Model"
>> }
>> ---------------------8<-------------------------
>
>> My model in input is like that : (basically a model, a package, a class)
>> ---------------------8<-------------------------
>> <?xml version="1.0" encoding="UTF-8"?>
>> <uml:Model xmi:version="2.1"
>> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
>> xmi:id="_eGIhADeTEd2OqNGrMp5Krw" name="ModelA">
>> <packageImport xmi:id="_eGIhATeTEd2OqNGrMp5Krw">
>> <importedPackage xmi:type="uml:Model"
>> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
>> </packageImport>
>> <packagedElement xmi:type="uml:Package"
>> xmi:id="_qbq6UDeTEd2OqNGrMp5Krw" name="PackageA">
>> <packagedElement xmi:type="uml:Class"
>> xmi:id="_snfRoDeTEd2OqNGrMp5Krw" name="ClassA">
>> <ownedAttribute xmi:id="_usVeQDeTEd2OqNGrMp5Krw"
>> name="PropertyA" isUnique="false">
>> <type xmi:type="uml:PrimitiveType"
>> href=" pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
>> </ownedAttribute>
>> </packagedElement>
>> </packagedElement>
>> <profileApplication xmi:id="_eGIhAjeTEd2OqNGrMp5Krw">
>> <eAnnotations xmi:id="_eGIhAzeTEd2OqNGrMp5Krw"
>> source="http://www.eclipse.org/uml2/2.0.0/UML">
>> <references xmi:type="ecore:EPackage"
>> href=" pathmap://UML_PROFILES/Standard.profile.uml#_yzU58YinEdqtvbn fB2L_5w"/>
>>
>> </eAnnotations>
>> <appliedProfile
>> href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
>> </profileApplication>
>> </uml:Model>
>> --------------------8<-----------------------------
>
>> My code...
>> --------------------8<-----------------------------
>> AtlModelHandler amh = null;
>> amh = new AtlUML2ModelHandler();
>
>> URL urlTransfo = null;
>> try { urlTransfo = asmFile.toURI().toURL();
>> } catch (MalformedURLException e) {}
>> Map<String, ASMModel> mapASMModels = new HashMap<String,
>> ASMModel>();
>
>> ResourceSet resourceSet = AtlEMFModelHandler.getResourceSet();
>
>>
> resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.1.0/UML",
>
>> UMLPackage.eINSTANCE);
>> URI uri =
> URI.createURI(" jar:file:/D:/eclipse/eclipse-modeling-ganymede-RC1-win32/ATL _LIBS_RC3/org.eclipse.uml2.uml.resources_2.2.0.v200805131030 .jar!/ ");
>
>
>>
> resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.LIBRARIES_PATHMAP),
>
>> uri.appendSegment("libraries").appendSegment(""));
>
>>
> resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.METAMODELS_PATHMAP),
>
>> uri.appendSegment("metamodels").appendSegment(""));
>
>>
> resourceSet.getURIConverter().URI_MAP.put(URI.createURI(UMLR esource.PROFILES_PATHMAP),
>
>> uri.appendSegment("profiles").appendSegment(""));
>
>>
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>
>> UMLResource.Factory.INSTANCE);
>
>> ASMModel asmUML = ((AtlEMFModelHandler)amh).loadModel("UML",
>> amh.getMof(), "uri:http://www.eclipse.org/uml2/2.1.0/UML");
>
>> File fileA = new File(PATH + "ModelA.uml");
>> InputStream inA = null;
>> try { inA = fileA.toURI().toURL().openStream();
>> } catch (MalformedURLException e) {} catch (IOException e) {}
>> ASMModel asmA;
>> asmA = amh.loadModel("A", asmUML, inA);
>
>
>> File fileB = new File(PATH + "ModelB.uml");
>> InputStream inB = null;
>> try {inB = fileB.toURI().toURL().openStream();
>> } catch (MalformedURLException e) {} catch (IOException e) {}
>> ASMModel asmB = amh.loadModel("B", asmUML, inB);
>
>> mapASMModels.put("A", asmA);
>> mapASMModels.put("B", asmB);
>> mapASMModels.put("UML", asmUML);
>
>> Map params = Collections.EMPTY_MAP; // Parameters
>> Map<String, URL> mapLibs = new HashMap<String, URL>();
>
>> // Launch ATL transformation
>> AtlLauncher.getDefault().launch(urlTransfo, mapLibs,
>> mapASMModels, params,
>> Collections.EMPTY_LIST, Collections.EMPTY_MAP);
>> --------------------8<-----------------------------
>
>> And now the error : (sorry for the length)
>> --------------------8<-----------------------------
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
>> GRAVE: ****** BEGIN Stack Trace
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
>> GRAVE: exception:
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
>> GRAVE: argument type mismatch
>> java.lang.IllegalArgumentException: argument type mismatch
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at
> org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:69)
>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
>>
>> at
>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
>> at
>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
>> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
>> at UmlAtlLaunch.transfoRegularVM(UmlAtlLaunch.java:86)
>> at UmlAtlTest.main(UmlAtlTest.java:9)
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: A.main() : ??#22 null
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: local variables = {self=SimpleUMLNoProfile : ASMModule}
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: local stack = []
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: A.__matcher__() : ??#1 null
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: local variables = {self=SimpleUMLNoProfile : ASMModule}
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: local stack = []
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: A.__matchModel() : ??#35 null
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: local variables = {s=A!ModelA, self=SimpleUMLNoProfile :
>> ASMModule}
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: local stack = [TransientLinkSet {}]
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: NativeOperation public static void
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMTransientLink.add TargetElement(org.eclipse.m2m.atl.engine.vm.StackFrame,org.e clipse.m2m.atl.engine.vm.nativelib.ASMTransientLink,org.ecli pse.m2m.atl.engine.vm.nativelib.ASMString,org.eclipse.m2m.at l.engine.vm.nativelib.ASMOclAny)
>
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.ExecEnv
>> printStackTrace
>> GRAVE: args = [TransientLink {rule = 'Model', sourceElements = {s
>> = A!ModelA}, targetElements = {}, variables = {}}, TransientLink {rule
>> = 'Model', sourceElements = {s = A!ModelA}, targetElements = {},
>> variables = {}}, 't']
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
>> GRAVE: ****** END Stack Trace
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.vm.SimpleDebugger error
>> INFO: Execution terminated due to error (see launch configuration to
>> allow continuation after errors).
>> 11 juin 2008 15:10:11 org.eclipse.m2m.atl.engine.AtlLauncher launch
>> GRAVE: null
>> java.lang.RuntimeException
>> at
>> org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDeb ugger.java:195)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:95)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:87)
>>
>> at
> org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:74)
>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:338)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:143)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:101)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:240)
>>
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:171)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:299)
>>
>> at
>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:169)
>> at
>> org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:111)
>> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:87)
>> at UmlAtlLaunch.transfoRegularVM(UmlAtlLaunch.java:86)
>> at UmlAtlTest.main(UmlAtlTest.java:9)
>> Caused by: java.lang.IllegalArgumentException: argument type mismatch
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at
> org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(Clas sNativeOperation.java:69)
>
>> ... 19 more
>
>> --------------------8<-----------------------------
>
>
Previous Topic:Re: [ATL][UML] set stereotyped tagged value
Next Topic:[ATL] random crashes?
Goto Forum:
  


Current Time: Thu Mar 28 23:55:53 GMT 2024

Powered by FUDForum. Page generated in 0.02953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top