Hello guys,
someone know if there is a "standardize" method to know name and referenceModelName in ATL transformations?
For instance if I want create a generalize method to run a transformation I need to do this code:
...
transformationLauncher.initialize(new HashMap<String,Object>());
transformationLauncher.addInModel(inputModel, "<NAME>", "<REFERENCE_MODEL_NAME>");
transformationLauncher.addOutModel(outModel ,"<NAME>", "<REFERENCE_MODEL_NAME>") ;
transformationLauncher.launch(ILauncher.RUN_MODE, null, new HashMap<String,Object>(), (Object[])getModulesList(basePath + "ATLMetric.asm"));
...
I want know programmatically the static information in addInModel and addOutModel methods (""<NAME>", "<REFERENCE_MODEL_NAME>").
Actually I have 2 ways to do this.
1 - parse the ATL text file and extract this information (very rough method)
2 - inject the atl text file in a xmi model conform to ATL metamodel with the following code:
...
String outputFilePath = "Transformation.xmi";
AtlResourceImpl ri = new AtlResourceImpl();
ResourceSet rs = new ResourceSetImpl();
rs.getResources().add(ri);
try{
ri.load(atlTransformationInputStream, null);
Resource xmiRes = rs.createResource(URI.createURI(outputFilePath));
xmiRes.getContents().addAll(ri.getContents());
xmiRes.save(null);
return outputFilePath;
} catch(FileNotFoundException e) {
throw new BusinessException();
} catch (IOException e) {
throw new BusinessException();
}
...
In this case, How to manipulate Resources to have the required information?
Is there a simple way to do this?
Thanks in advance.