[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.m2m] [ATL]Loading UML models
|
Hi,
i created some Atl Transformations, and they are working right on atl
plugin. However, i need run this transformation automatically by a java
applications.
I read some material about it.
http://wiki.eclipse.org/ATL_Howtos#How_do_I_launch_transformations_programmatically.3F
http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/msg00042.html
http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/msg02574.html
http://wiki.eclipse.org/JWT_Transformations#About_ATL
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gmt/AM3/org.eclipse.gmt.am3.dsls.km3/src/org/eclipse/gmt/am3/dsls/km3/KM3Projector.java?root=Technology_Project&view=log
http://ssel.vub.ac.be/viewvc/UML1CaseStudies/uml1cs-atlcommandline/src/org/atl/commandline/Main.java
http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/msg02663.html
The head of my transformatios is:
create OUT : JavaAbstractSyntax from IN : uml2;
a excerpt of my transformation is following.
modelHandler = (AtlEMFModelHandler)
AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
..
ASMEMFModel jasMetamodel = (ASMEMFModel)
modelHandler.loadModel("JavaAbstractSyntax", modelHandler.getMof(),
new FileInputStream
("Z:/<<path>>/MetaModels/JavaAbstractSyntax.ecore"));
ASMEMFModel UmlMetamodel = (ASMEMFModel) modelHandler.loadModel(
"UML", modelHandler.getMof(),
"uri:http://www.eclipse.org/uml2/2.1.0/UML");
//i try it too
//ASMEMFModelUmlMetamodel = (ASMEMFModel) modelHandler.loadModel("uml2",
modelHandler.getMof(),
// new FileInputStream ("Z:/<<Path>>/MetaModels/UML2.ecore"));
models.put("JavaAbstractSyntax", jasMetamodel);
models.put("uml2", UmlMetamodel);
..
ASMEMFModel umlInputModel = (ASMEMFModel) modelHandler.loadModel("IN",
UmlMetamodel,
new FileInputStream ("Z:/<<path>>/Models/input Models/UMLTesters.uml"));
ASMEMFModel jasOutputModel = (ASMEMFModel) modelHandler.newModel("OUT",
"arquivo", jasMetamodel);
models.put("IN", umlInputModel);
models.put("OUT", jasOutputModel);
AtlLauncher.getDefault().launch(this.UML2DesignWizard_Pool_TransfoResource,
Collections.EMPTY_MAP, models, Collections.EMPTY_MAP,
Collections.EMPTY_LIST, Collections.EMPTY_MAP);
modelHandler.saveModel(jasOutputModel, "arquivo", false);
Well, but the line of creation of umlInputModel throws the exception:
09/06/2008 18:14:43 org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel
loadASMEMFModel
SEVERE: Package with uri 'http://www.eclipse.org/uml2/2.0.0/UML' not
found. (file:///Z:/Mestrado/MoDELS/workspace/GeneratorTool/IN, 3, 75)
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
uri 'http://www.eclipse.org/uml2/2.0.0/UML' not found.
(file:///Z:/Mestrado/MoDELS/workspace/GeneratorTool/IN, 3, 75)
at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:191)
at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:180)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1414)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel.loadASMEMFModel(ASMEMFModel.java:365)
at
org.eclipse.m2m.atl.engine.AtlEMFModelHandler.loadModel(AtlEMFModelHandler.java:222)
at UML2ModelDesignTest.uml2DesignTest(UML2ModelDesignTest.java:79)
at UML2ModelDesignTest.main(UML2ModelDesignTest.java:105)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
with uri 'http://www.eclipse.org/uml2/2.0.0/UML' not found.
(file:///Z:/Mestrado/MoDELS/workspace/GeneratorTool/IN, 3, 75)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2566)
the input files are generated by the MagicDraw, and works right in ATL
Plugin. Someone can help me?
Thanks in advance.