[ATL] transform model to model [message #12045] |
Tue, 23 January 2007 14:52 |
Eclipse User |
|
|
|
Originally posted by: beaufreton.gmail.com
Hello,
I try to transform a model to another model : a SCRIPT model to a VMCODE
model.
I have SCRIPT.ecore and VMCODE.ecore files wich describe both metamodel
and I have also the SCRIPT2VMCODE.asm file wich describe the
transformation from SCRIPT to VMCODE.
Here is my code.
emfmmSCRIPT and emfmmVMCODE are well loaded (I checked this in a debug
mode).
I call this function with a valid SCRIPT model and the function always
returns an empty model.
Does any one have an idea ?
Thanks !
public ASMModel getVMCODEFromSCRIPT(ASMModel model) throws CoreException,
IOException {
ASMModel ret = null;
AtlModelHandler emfamhSCRIPT = null;
ASMModel emfmmSCRIPT = null;
AtlModelHandler emfamhVMCODE = null;
ASMModel emfmmVMCODE = null;
URL SCRIPT2VMCODE= KM3Projector.class.getResource
("resources/SCRIPT2VMCODE.asm");
Map<String, ASMModel> models = new HashMap<String, ASMModel>();
// Load of SCRIPT model
emfamhSCRIPT = AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
URL emfmmurlSCRIPT =
KM3Projector.class.getResource("resources/SCRIPT.ecore");
try {
emfmmSCRIPT = emfamhSCRIPT.loadModel("SCRIPT", emfamhSCRIPT.getMof(),
emfmmurlSCRIPT.openStream());
} catch (IOException e) {
e.printStackTrace();
}
models.put("SCRIPT", emfmmSCRIPT);
// Load of VMCODE model
emfamhVMCODE = AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
URL emfmmurlVMCODE =
KM3Projector.class.getResource("resources/VMCODE.ecore");
try {
emfmmVMCODE = emfamhVMCODE.loadModel("VMCODE", emfamhVMCODE.getMof(),
emfmmurlVMCODE.openStream());
} catch (IOException e) {
e.printStackTrace();
}
models.put("VMCODE", emfmmVMCODE);
models.put("IN", model);
pbmm = emfamhSCRIPT.getBuiltInMetaModel("Problem");
models.put("Problem", pbmm);
ret = emfamhSCRIPT.newModel("OUT", emfmmVMCODE);
models.put("OUT", ret);
Map params = Collections.EMPTY_MAP;
Map libs = Collections.EMPTY_MAP;
AtlLauncher.getDefault().launch(SCRIPT2VMCODEurl, libs, models, params);
return ret;
}
---
Jean-Baptiste Beaufreton
|
|
|
Powered by
FUDForum. Page generated in 0.03387 seconds