Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Use Java method in ATL
icon5.gif  [ATL] Use Java method in ATL [message #631093] Wed, 06 October 2010 07:50 Go to next message
Marc Gil is currently offline Marc GilFriend
Messages: 190
Registered: July 2009
Location: Valencia, Spain
Senior Member
Hello,

I'm a begginer in ATL, and I want to know if there exists any way to execute Java code in order to do some things to the generated Object.

I want to do that, because I have already implemented a complex initialization in Java of that kind of objects, and I don't want to duplicate this initialization...

If it's possible, please let me know how to do it Smile

Thanks!
Marc Gil
Re: [ATL] Use Java method in ATL [message #631094 is a reply to message #631093] Wed, 06 October 2010 07:58 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
EObject operations are available in ATL transformations. Just use
objet.operation()
in your ATL code
Re: [ATL] Use Java method in ATL [message #631097 is a reply to message #631094] Wed, 06 October 2010 08:03 Go to previous messageGo to next message
Marc Gil is currently offline Marc GilFriend
Messages: 190
Registered: July 2009
Location: Valencia, Spain
Senior Member
Thanks Sylvain,

But this is an operation of the Metamodel. It's possible to execute a method placed into a static Class? Indicating the whole Namespace, name of the Class and name of the Method?

And other question: if finally I choose to call a Metamodel Operation, have I access to the atributes values that I have initialized in ATL before calling this operation?

Thanks a lot!
Marc
Re: [ATL] Use Java method in ATL [message #631107 is a reply to message #631097] Wed, 06 October 2010 08:38 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Quote:
But this is an operation of the Metamodel. It's possible to execute a method placed into a static Class? Indicating the whole Namespace, name of the Class and name of the Method?

I don't think so. You could still code your own EMFModelAdapter to be able to do that.
Quote:
And other question: if finally I choose to call a Metamodel Operation, have I access to the atributes values that I have initialized in ATL before calling this operation?

This should work.
Re: [ATL] Use Java method in ATL [message #631113 is a reply to message #631107] Wed, 06 October 2010 08:59 Go to previous messageGo to next message
Marc Gil is currently offline Marc GilFriend
Messages: 190
Registered: July 2009
Location: Valencia, Spain
Senior Member
I don't really know how to do what you're saying... You mean to modify the XXXAdapterFactory generated in the model code? In order to do what? Or how can I code my own EMFModelAdapter and tell ATL that uses it?
Re: [ATL] Use Java method in ATL [message #631127 is a reply to message #631093] Wed, 06 October 2010 09:45 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
ATL uses an EMFModelAdapter.
It is used to register the operations available in the ATL transformations such as refImmediateComposite(), oclIsTypeOf() and so on.
You can extend that EMFModelAdapter to add your own operations.

You can then code your own launcher to use your EMFModelAdapter.

Finally you can register the launcher by using the extension point : org.eclipse.m2m.atl.core.launcher
Re: [ATL] Use Java method in ATL [message #631147 is a reply to message #631127] Wed, 06 October 2010 11:00 Go to previous messageGo to next message
Marc Gil is currently offline Marc GilFriend
Messages: 190
Registered: July 2009
Location: Valencia, Spain
Senior Member
Thanks a lot Sylvain!!

Finally I used the operations in the Metamodel. I found this solution better than the other one.

Nevertheless, the other solution is great for other things in the future...

One last question: in this way, I plan use this second solution (modify the EMFModelAdapter) in order to, for example, update a progress monitor, to show user that "something" is being done, cause we have some transformations that can take a lot of minutes. There exists any other way to 'update a progress monitor' in ATL code? Or this one is good?
Re: [ATL] Use Java method in ATL [message #634026 is a reply to message #631093] Wed, 20 October 2010 10:14 Go to previous messageGo to next message
markberg is currently offline markbergFriend
Messages: 1
Registered: October 2010
Junior Member
http://www.slideshare.net/wpiers/modelt-to-model-transformat ion-withatl
The above link is usefull i think
Re: [ATL] Use Java method in ATL [message #634027 is a reply to message #634026] Wed, 20 October 2010 10:24 Go to previous messageGo to next message
Marc Gil is currently offline Marc GilFriend
Messages: 190
Registered: July 2009
Location: Valencia, Spain
Senior Member
Hi markberg,

At this moment, in fact I'm modifying my Metamodel in order to include operations to do what I want. This solution is useful for me, because the Metamodel is mine, but if not (like uml, for instance) I must to use my own EMFModelAdapter.

Thanks Smile
Marc
Re: [ATL] Use Java method in ATL [message #634722 is a reply to message #634027] Fri, 22 October 2010 20:30 Go to previous message
Marcos Didonet Del Fabro is currently offline Marcos Didonet Del FabroFriend
Messages: 84
Registered: July 2009
Member
Hi,

you may also use a more "lightweight" solution, without the need to implement a new model adapter.

You can use the "org.eclipse.m2m.atl.engine.emfvm.libextension" extension point and register your operations.

Check the ASMString class (in the engine) and the corresponding packages for an example (there is no doc for this, or at least I didn't find).

Regards,

Marcos Didonet.
Previous Topic:[ATL] injection problem in a programmatic launch
Next Topic:[ATL] transformation generated automatically
Goto Forum:
  


Current Time: Mon Jun 24 14:15:32 GMT 2019

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

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

Back to the top