Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » ATL Plug-in dont run
ATL Plug-in dont run [message #1049709] Fri, 26 April 2013 03:17 Go to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
Registered: January 2013
Location: Izmir
Senior Member
Hi all,

I create atl plug-in project for invoke transformation programmaticaly. First i

create command and i invoke this command from file right click and generate button.

But i cant run transformation i always get error.When i debug i see asm variable

always null and error occurs because of this. My code and error is blow

Not i use xtext as a input

Anyone can help me to fix this ?

Code;

public class deneme {

public static void aaa(String filepath, String outPutFilePath) throws ATLCoreException, IOException {
		 // Replace DSL by your Language name
		FilesystemStandaloneSetup dsl = new FilesystemStandaloneSetup();		
		Injector injector = dsl.createInjectorAndDoEMFRegistration();
		XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
		resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
		Resource resource = resourceSet.getResource(URI.createURI(filepath), true);
		
		// Create factory and injector
		EMFModelFactory factory = new EMFModelFactory();
		EMFInjector emfinjector = new EMFInjector();
		// Load the DSL metamodel
		EMFReferenceModel dslMetamodel = (EMFReferenceModel) factory.newReferenceModel();
		emfinjector.inject(dslMetamodel, "File://C:\\Users\\unituser\\XtextAndGmfSynchronization\\org.eclipse.m2m.atl.filesystem\\model\\Filesystem.ecore");
		// Load the XtextResource as an EMFModel
		EMFModel model = (EMFModel) factory.newModel(dslMetamodel);
		emfinjector.inject(model, resource);
 
		EMFReferenceModel outMetamodel = (EMFReferenceModel) factory.newReferenceModel();
		emfinjector.inject(outMetamodel, "File://C:\\Users\\unituser\\XtextAndGmfSynchronization\\org.eclipse.m2m.atl.filesystem\\model\\filesystem2.ecore");
		EMFModel outModel = (EMFModel) factory.newModel(outMetamodel);
		
		EMFVMLauncher launcher = new EMFVMLauncher();
		launcher.initialize(Collections.<String, Object> emptyMap());
		
		launcher.addInModel(model, "IN", "Filesystem");
		launcher.addOutModel(outModel, "OUT", "filesystem2");
		
		InputStream asm = deneme.class.getResourceAsStream("org.eclipse.m2m.atl.filesystem/files/transformation.asm"); 
		
		launcher.launch(
				ILauncher.RUN_MODE, 
				new NullProgressMonitor(), 
				Collections.<String, Object> emptyMap(),
				new Object[] {asm} );
		
		outModel.getResource().setURI(URI.createURI(outPutFilePath));
		outModel.getResource().save(Collections.EMPTY_MAP);
	}
}


Error;
java.lang.NullPointerException
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.launch(EMFVMLauncher.java:139)
	at org.eclipse.m2m.atl.filesystem.files.deneme.aaa(deneme.java:53)
	at org.xtext.example.filesystem.generator.plugin.handler.Translate.createOutput(Translate.java:58)
	at org.xtext.example.filesystem.generator.plugin.handler.Translate.execute(Translate.java:29)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:231)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:212)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:831)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:724)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:708)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:647)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)


Regards

[Updated on: Fri, 26 April 2013 09:55]

Report message to a moderator

Re: ATL Plug-in dont run [message #1049980 is a reply to message #1049709] Fri, 26 April 2013 10:40 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 600
Registered: July 2009
Senior Member
Hello,

Before generating the ATL plugin, have you already tried to run your transformation manually in your development workbench using an ATL launch configuration?
If this works, have you actually generated your ATL plugin from this launch configuration?
This could help to identify whether the problem comes from the generated Java launcher or from the transformation itself.

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Re: ATL Plug-in dont run [message #1049988 is a reply to message #1049980] Fri, 26 April 2013 10:53 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
Registered: January 2013
Location: Izmir
Senior Member
Hi,

yes i tried to run my transformation manually and it have been worked perfect (i use

non xtext resource just use emf resource for manually). But i must use xtext as input

file so i think i cant use raw atl plug-in i tihnk i must change its run method (like

my above method). Because i tried this too and it have not been worked. It gives me

error like your input file not emf resource

Regards

[Updated on: Fri, 26 April 2013 10:54]

Report message to a moderator

Re: ATL Plug-in dont run [message #1050004 is a reply to message #1049988] Fri, 26 April 2013 11:07 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 600
Registered: July 2009
Senior Member
Maybe your problem is not related to ATL itself, but more to how you can load an Xtext Resource as a standard EMF Resource.
You should ask a specific question about this onto the Xtext (and/or EMF) forum.

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Re: ATL Plug-in dont run [message #1161045 is a reply to message #1049709] Tue, 29 October 2013 10:44 Go to previous message
kicha bicha is currently offline kicha bicha
Messages: 11
Registered: October 2013
Junior Member
Hi,
I am using ATl plugin to lunch atl using java class.
Before i was running ATL files by using ATL configuration, after running a transformation is correct.
The problem is that when i use the ATL plugin to run java class, a transformtion is not correct because, for example:
I have this helper

helper context MMuml!Property def: isMuseMLMuseInstanceStereotyped() : Boolean =
self.getAppliedStereotypes()->exists(s | s.qualifiedName = 'MuseML::MuseInstance');

MMuml -- @nsURI MMuml=http://www.eclipse.org/uml2/3.0.0/UML
And
rule part2XML{
from museml: MMuml!Property(
museml.isMuseMLMuseInstanceStereotyped()
)
to OUT: MMXML!MuseInstance (
name <- museml.name

)

}

but after run of java class isMuseMLMuseInstanceStereotyped() is false.

Anyone can help?
Previous Topic:Extract ATL transformation (.atl) from ATL Model (.xmi) with Java
Next Topic:convert XMI file TO Java class
Goto Forum:
  


Current Time: Tue Jul 22 13:37:07 EDT 2014

Powered by FUDForum. Page generated in 0.02788 seconds