|
|
Re: [AM3] Is there any doc on AM3? [message #374308 is a reply to message #374307] |
Fri, 13 March 2009 08:25 |
Skander TURKI Messages: 130 Registered: July 2009 |
Senior Member |
|
|
thanks a lot ronan but i needed to do that at runtime, i have a
transformation from a uml model to an AADL model, and i want to add as
much output models in the ATL transformation as instanceSpecifications in
the UML model, this is because each instance specification in AADL must be
in a separate model (file), so i wanted to make a first transformation
(High-Order) that will add these rules to my core transformation before i
launch it. I tried this code to inject an atl file into an atl model:
AtlModelHandler amh = AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
ModelFactory factory = CoreService.createModelFactory("EMF");
IReferenceModel atlMM = factory.newReferenceModel();
System.out.println(CoreService.getInjectorsNames());
IInjector injector = CoreService.getInjector("EMF"); //new ASMInjector();
injector.inject(atlMM, atlMMpath);
InputStream input = new FileInputStream(uri);
//Now Parsing from atl file to atl model
//Create a new parser
AtlParser atlParser = AtlParser.getDefault();
//Create a new ASMModel
ASMModel atlASMModel = null;
amh.createModelLoader().newModel("Marte2ATL", "file:/" + uri,
atlASMModel);
//Launch Parsing
atlASMModel = atlParser.parseToModel(input);
//Save to .ecore
atlASMModel.getModelLoader().save(atlASMModel, destination);
THIS CODE GAVE ME AN ATL MODEL IN AN ECORE FILE BUT I DON'T KNOW YET IF
AFTER THE HIGH ORDER TRANSFORMATION IT WILL BE RECOGNIZED AS A VALID ATL
TRANSFORMATION, I'M NOT THERE YET.
|
|
|
|
Re: [AM3] Is there any doc on AM3? [message #563852 is a reply to message #374307] |
Fri, 13 March 2009 08:25 |
Skander TURKI Messages: 130 Registered: July 2009 |
Senior Member |
|
|
thanks a lot ronan but i needed to do that at runtime, i have a
transformation from a uml model to an AADL model, and i want to add as
much output models in the ATL transformation as instanceSpecifications in
the UML model, this is because each instance specification in AADL must be
in a separate model (file), so i wanted to make a first transformation
(High-Order) that will add these rules to my core transformation before i
launch it. I tried this code to inject an atl file into an atl model:
AtlModelHandler amh = AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
ModelFactory factory = CoreService.createModelFactory("EMF");
IReferenceModel atlMM = factory.newReferenceModel();
System.out.println(CoreService.getInjectorsNames());
IInjector injector = CoreService.getInjector("EMF"); //new ASMInjector();
injector.inject(atlMM, atlMMpath);
InputStream input = new FileInputStream(uri);
//Now Parsing from atl file to atl model
//Create a new parser
AtlParser atlParser = AtlParser.getDefault();
//Create a new ASMModel
ASMModel atlASMModel = null;
amh.createModelLoader().newModel("Marte2ATL", "file:/" + uri,
atlASMModel);
//Launch Parsing
atlASMModel = atlParser.parseToModel(input);
//Save to .ecore
atlASMModel.getModelLoader().save(atlASMModel, destination);
THIS CODE GAVE ME AN ATL MODEL IN AN ECORE FILE BUT I DON'T KNOW YET IF
AFTER THE HIGH ORDER TRANSFORMATION IT WILL BE RECOGNIZED AS A VALID ATL
TRANSFORMATION, I'M NOT THERE YET.
|
|
|
Powered by
FUDForum. Page generated in 0.03332 seconds