2

According to the ATL/EMFTVM wiki, ATL/EMFTVM can be run standalone by using

ResourceSet moduleRS = new ResourceSetImpl();
moduleRS.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());

DefaultModuleResolver mr = new DefaultModuleResolver("pathToModuleDirectory", moduleRS);
TimingData td = new TimingData();
env.loadModule(mr, "ModuleName");
td.finishLoading();
env.run(td);
td.finish();

However, this always yields an exception saying Module not found. I debugged the code into great detail. Internally, a SaxParseException is thrown, which is weird since my .emftvm file is not a XML file. Any ideas how I can load the file properly? Thanks in advance!

Roman R.
  • 68,205
  • 6
  • 94
  • 158
WeSt
  • 2,628
  • 5
  • 22
  • 37

2 Answers2

1

I got the old version of EMFTVM, and have the same problem as you. I pull the latest version from github, and it is fine now.

Updates: @dwagelaar, aha, yes, I used EMFTVMResourceFactoryImpl; Here is the code I used btw:

    ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
    ResourceSet rs = new ResourceSetImpl();
    rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
    rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
    rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emftvm", new EMFTVMResourceFactoryImpl());

Also, instead of passing a new ResourceSetImpl(as indicated in Wiki),

// Don't do this! 
ModuleResolver mr = new DefaultModuleResolver("platform:/plugin/my.plugin.id/transformations/", new ResourceSetImpl());

I passed in the rs object initialized above.

Zheng Cheng
  • 389
  • 2
  • 11
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – user35443 Jan 15 '15 at 19:55
  • @user35443 Letian's provides a solution - pull the latest version, where the issue is fixed. – Alex K Jan 16 '15 at 00:18
1

This (still) does not work, because you would have to tell EMF that *.emftvm files are not XMI, and require the EMFTVMResourceFactoryImpl. The ATL/EMFTVM wiki page has been updated with improved code; see: https://wiki.eclipse.org/ATL/EMFTVM#Standalone_use

dwagelaar
  • 174
  • 1
  • 6
  • Can I have some help with http://stackoverflow.com/questions/37196593/atl-transformation-rules-not-matching-nested-bpmn2-elements please? Many thanks – DrB May 13 '16 at 08:46