Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » [ATL] How programmatically know name and referenceModelName in ATL transformations(ATL programmatically)
[ATL] How programmatically know name and referenceModelName in ATL transformations [message #1696165] Fri, 22 May 2015 13:38 Go to next message
_md2_ on Forum is currently offline _md2_ on ForumFriend
Messages: 9
Registered: February 2012
Location: L'Aquila
Junior Member
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.
Re: [ATL] How programmatically know name and referenceModelName in ATL transformations [message #1698842 is a reply to message #1696165] Thu, 18 June 2015 11:00 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
But surely you know these names ahead of time. The MetaModel(s) is/are fixed as your transformation cannot be dynamically picking a MetaModel. The IN and OUT names for the models are also generic so just use "IN" and "OUT".
Regards,
Ronan
Previous Topic:transformation involving UML profiles
Next Topic:ATL Transformation Rule
Goto Forum:
  


Current Time: Fri Apr 26 19:33:18 GMT 2024

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

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

Back to the top