Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Using Coreservice to run ATL transformatin in java
Using Coreservice to run ATL transformatin in java [message #1053431] Sun, 05 May 2013 14:27 Go to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
hello,
I want to run ATL transformation in java by using Coreservice.The following is my code :
public class UML2PN1 {
	private  IInjector injector;
	private  IExtractor extractor;
	private  IReferenceModel umlMetamodel;
	private  IReferenceModel PetrinetMetamodel;
	private  URL asmURL;
	public static void main(String[] args)
	{
		UML2PN1 runner = new UML2PN1();
		runner.run();
	}
	
     public  void run(){
       try{
                asmURL = UML2PN1.class.getResource("src/UML2PN1.asm"); 
    	        System.out.println(CoreService.getInjectorsNames() );
    	
  		ILauncher launcher = null;
  		
  		launcher = CoreService.getLauncher(
ATLLaunchConstants.EMF_VM_NAME); //$NON-NLS-1$
  		launcher.initialize(Collections.<String, Object> emptyMap());
  		
                ModelFactory factory = CoreService.getModelFactory(launcher.getDefaultModelFactoryName()); //$NON-NLS-1$
  		
  		injector = CoreService.getInjector(factory.getDefaultExtractorName()); //$NON-NLS-1$
                extractor = CoreService.getExtractor(factory.getDefaultExtractorName()); //$NON-NLS-1$
		
		umlMetamodel = factory.newReferenceModel();
		injector.inject(umlMetamodel, "http://www.eclipse.org/uml2/4.0.0/UML"); //$NON-NLS-1$
		PetrinetMetamodel = factory.newReferenceModel(); //$NON-NLS-1$
		injector.inject(PetrinetMetamodel, "src/PetriNets");

		IModel petrinetModel = factory.newModel(PetrinetMetamodel);
		IModel umlModel = factory.newModel(umlMetamodel);
		injector.inject(umlModel, "src/model.uml");

		launcher.addOutModel(petrinetModel, "OUT", "PetriNets"); //$NON-NLS-1$ //$NON-NLS-2$
		launcher.addInOutModel(umlModel, "IN", "UML"); //$NON-NLS-1$ //$NON-NLS-2$
		launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor(), Collections.<String, Object> emptyMap(), asmURL.openStream());
		extractor.extract(umlModel, "src/1.xmi");
       } catch (ATLCoreException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ATLExecutionException e) {
			e.printStackTrace();
		}

     }
	
}

the error is:
org.eclipse.m2m.atl.core.launcher EMF-specific VM not found, check the spelling or register it manually
at org.eclipse.m2m.atl.core.service.CoreService.getLauncher(CoreService.java:214)

How to solve my problem?
Re: Using Coreservice to run ATL transformatin in java [message #1053493 is a reply to message #1053431] Mon, 06 May 2013 09:32 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

This should normally works.
Have you tried to directly instantiate an EMF VM launcher?
launcher = new EMFVMLauncher();

Hugo


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: Using Coreservice to run ATL transformatin in java [message #1057813 is a reply to message #1053493] Thu, 09 May 2013 01:33 Go to previous messageGo to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
hello,
when I use "launcher = new EMFVMLauncher();"to instantiate an EMF VM launcher,it works .I want to use CoreService because CoreService has a function that extensions lookup and storage.
Is the problem of the ATL virtual machines ?
Re: Using Coreservice to run ATL transformatin in java [message #1058280 is a reply to message #1057813] Mon, 13 May 2013 12:54 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Please, could you raise a bug to keep track of your problem?

--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Previous Topic:Running ATL Transformation in java application
Next Topic:Generation of theTransformation in a java application
Goto Forum:
  


Current Time: Sat Apr 20 00:52:37 GMT 2024

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

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

Back to the top