Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Running ATL transformation programmatically
[ATL] Running ATL transformation programmatically [message #502362] Mon, 07 December 2009 20:22 Go to next message
Antonio Dias is currently offline Antonio DiasFriend
Messages: 8
Registered: July 2009
Junior Member
I used the following libraries to execute my ATL transformations programmatically:
- org.eclipse.core.jobs_3.4.0.v20080310.jar
- org.eclipse.core.resources_3.4.0.v20080326.jar
- org.eclipse.core.runtime_3.4.0.v20080324-1725.jar
- org.eclipse.core.runtime.compatibility_3.2.0.v20071008.jar
- org.eclipse.emf.common_2.4.0.v200804012208.jar
- org.eclipse.emf.ecore_2.4.0.v200804012208.jar
- org.eclipse.emf.ecore.xmi_2.4.0.v200804012208.jar
- org.eclipse.equinox.common_3.4.0.v20080320.jar
- org.eclipse.gmt.tcs.extractor_1.0.0.jar
- org.eclipse.gmt.tcs.injector_1.0.0.jar
- org.eclipse.osgi_3.4.0.v20080326.jar
- org.eclipse.m2m.atl.drivers.emf4atl_2.0.0.v200804031124.jar
- org.eclipse.m2m.atl.engine.jar
- org.eclipse.m2m.atl.engine.vm_2.0.0.v200804031124.jar


Now I wanted to use the latest version of ATL, so I replaced the libraries in bold above for the following ones:
- org.eclipse.m2m.atl.drivers.emf4atl_3.0.1.v200909150941.jar
- org.eclipse.m2m.atl.engine.vm_3.0.1.v200909150941.jar
- org.eclipse.m2m.atl.engine_3.0.1.v200909150941.jar

But after the replacement, some parts of my code present errors, such as:
The following imports cannot be resolved...
import org.eclipse.m2m.atl.engine.AtlEMFModelHandler;
import org.eclipse.m2m.atl.engine.AtlLauncher;
import org.eclipse.m2m.atl.engine.AtlModelHandler;

I searched where I could find these classes in the new version of the jars, but when I replace them, they are not the same and there are some missing methods. Has that much changed from version 2.0.0 to 3.0.1?
[ATL] Running ATL transformation programmatically [message #502434 is a reply to message #502362] Tue, 08 December 2009 09:00 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 297
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060107020407050305040500
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

In ATL 3.0.x, it is recommended to use ATL EMF-vm, which is an improved
version of the ATL VM you were using.
There are some explanations about the launching API here:
http://wiki.eclipse.org/ATL/Developer_Guide#ATL_Architecture
The "New-> example-> ATL-> public2private" shows an example of
programmatic launch.

Best regards,

William

Antonio Dias a écrit :
> I used the following libraries to execute my ATL transformations
> programmatically:
> - org.eclipse.core.jobs_3.4.0.v20080310.jar
> - org.eclipse.core.resources_3.4.0.v20080326.jar
> - org.eclipse.core.runtime_3.4.0.v20080324-1725.jar
> - org.eclipse.core.runtime.compatibility_3.2.0.v20071008.jar
> - org.eclipse.emf.common_2.4.0.v200804012208.jar
> - org.eclipse.emf.ecore_2.4.0.v200804012208.jar
> - org.eclipse.emf.ecore.xmi_2.4.0.v200804012208.jar
> - org.eclipse.equinox.common_3.4.0.v20080320.jar
> - org.eclipse.gmt.tcs.extractor_1.0.0.jar
> - org.eclipse.gmt.tcs.injector_1.0.0.jar
> - org.eclipse.osgi_3.4.0.v20080326.jar
> - org.eclipse.m2m.atl.drivers.emf4atl_2.0.0.v200804031124.jar
> - org.eclipse.m2m.atl.engine.jar
> - org.eclipse.m2m.atl.engine.vm_2.0.0.v200804031124.jar
>
> Now I wanted to use the latest version of ATL, so I replaced the
> libraries in bold above for the following ones:
> - org.eclipse.m2m.atl.drivers.emf4atl_3.0.1.v200909150941.jar
> - org.eclipse.m2m.atl.engine.vm_3.0.1.v200909150941.jar
> - org.eclipse.m2m.atl.engine_3.0.1.v200909150941.jar
>
> But after the replacement, some parts of my code present errors, such as:
> The following imports cannot be resolved...
> import org.eclipse.m2m.atl.engine.AtlEMFModelHandler;
> import org.eclipse.m2m.atl.engine.AtlLauncher;
> import org.eclipse.m2m.atl.engine.AtlModelHandler;
>
> I searched where I could find these classes in the new version of the
> jars, but when I replace them, they are not the same and there are some
> missing methods. Has that much changed from version 2.0.0 to 3.0.1?

--
Ne manquez pas notre prochaine formation ATL inter entreprises:
ATL - Paris - du 2 au 3 Décembre 2009
Pour plus de dates et pour le détail de cette formation:
http://www.obeo.fr/pages/formations/fr

Don't forget our next ATL training:
ATL - Paris - 2009 December from 2th to 3th
More dates and training program on:
http://www.obeo.fr/pages/formations/fr

--------------060107020407050305040500
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"

YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------060107020407050305040500--
Re: [ATL] Running ATL transformation programmatically [message #502526 is a reply to message #502434] Tue, 08 December 2009 17:31 Go to previous messageGo to next message
Antonio Dias is currently offline Antonio DiasFriend
Messages: 8
Registered: July 2009
Junior Member
Hi William,

first of all, thank you for the attention.

I tried to adapt the ATL example to my needs and now, at the lines:
injector = CoreService.getInjector("EMF"); (line 63)
...
petriMetamodel = factory.newReferenceModel(); (line 151)


I got the following error:
org.eclipse.m2m.atl.core.ATLCoreException: org.eclipse.m2m.atl.core.injector EMF not found, check the spelling or register it manually
	at org.eclipse.m2m.atl.core.service.CoreService.getExtensionClass(CoreService.java:148)
	at org.eclipse.m2m.atl.core.service.CoreService.getInjector(CoreService.java:198)
	at org.eclipse.m2m.atl.examples.public2private.ui.PrivatizeAction.<clinit>(PrivatizeAction.java:63)
Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.m2m.atl.examples.public2private.ui.PrivatizeAction.delete(PrivatizeAction.java:151)
	at org.eclipse.m2m.atl.examples.public2private.ui.PrivatizeAction.main(PrivatizeAction.java:192)


What might be causing this?
Re: [ATL] Running ATL transformation programmatically [message #502640 is a reply to message #502526] Wed, 09 December 2009 09:18 Go to previous message
William Piers is currently offline William PiersFriend
Messages: 297
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080107010408030005070806
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

The CoreService registers Injectors, Extractors, etc... by extension
point. When you launch the program outside of Eclipse (i.e. directly
launching a java main), extension points are not available anymore.

So, two solutions here:
* if you want to allow switching between various injectors, it could be
better to keep the use of the CoreService. So, before launching any
transformation, you have to register manually the injector into the
service, e.g.:
CoreService.registerInjector("EMF", EMFInjector.class);

* directly instantiate the injector when needed:
new EMFInjector()

Note that in both cases, you need to add a dependency to the
org.eclipse.m2m.atl.core.emf plugin. The first solution allow to move
that dependency when you want.

Best regards,

William

Antonio Dias a écrit :
> Hi William,
>
> first of all, thank you for the attention.
>
> I tried to adapt the ATL example to my needs and now, at the lines:
> injector = CoreService.getInjector("EMF"); (line 63)
> ..
> petriMetamodel = factory.newReferenceModel(); (line 151)
>
> I got the following error:
> org.eclipse.m2m.atl.core.ATLCoreException:
> org.eclipse.m2m.atl.core.injector EMF not found, check the spelling or
> register it manually
> at
> org.eclipse.m2m.atl.core.service.CoreService.getExtensionCla ss(CoreService.java:148)
>
> at
> org.eclipse.m2m.atl.core.service.CoreService.getInjector(Cor eService.java:198)
>
> at
> org.eclipse.m2m.atl.examples.public2private.ui.PrivatizeActi on. <clinit>(PrivatizeAction.java:63)
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.eclipse.m2m.atl.examples.public2private.ui.PrivatizeActi on.delete(PrivatizeAction.java:151)
>
> at
> org.eclipse.m2m.atl.examples.public2private.ui.PrivatizeActi on.main(PrivatizeAction.java:192)
>
>
> What might be causing this?

--
Ne manquez pas notre prochaine formation ATL inter entreprises:
ATL - Paris - du 2 au 3 Décembre 2009
Pour plus de dates et pour le détail de cette formation:
http://www.obeo.fr/pages/formations/fr

Don't forget our next ATL training:
ATL - Paris - 2009 December from 2th to 3th
More dates and training program on:
http://www.obeo.fr/pages/formations/fr

--------------080107010408030005070806
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"

YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------080107010408030005070806--
Previous Topic:[ATL] Release of AML a model matching tool
Next Topic:attribute value cannot be set
Goto Forum:
  


Current Time: Mon Aug 19 14:09:25 GMT 2019

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

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

Back to the top