Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Java ATL transformation Obligations(MMT)
Java ATL transformation Obligations [message #988358] Thu, 29 November 2012 15:10 Go to next message
Hassan BAZOUN is currently offline Hassan BAZOUNFriend
Messages: 54
Registered: April 2012
Member
Hey guys,

i asked a question before concerning ATL and java code but i didn't get an answer so i would try asking it in another way.

lets take a look at this:

case1:

bsmModel = modelFactory.newModel(bsmMetamodel);
((EMFInjector)injector).inject(bsmModel, "transformation/inputFile.xmi");


case2:

bsmModel = modelFactory.newModel(bsmMetamodel);
((CDOInjector)injector).inject(bsmModel, bsmServiceSystemModel);



in case 1 am using the EMFInjector to inject an xmi resource into the bsmModel.
in this case the ATL transformation is applied well on the input model and the result model conforms with my purpose.

in case 2 am using a personalized class called CDOInjector which extends EMFInjector but instead of injecting an xmi resource am trying to inject an object of type myType___Impl which extends CDOObject the result of the transformation is null with no exceptions fired during the transformation.

The only difference between the two casses is that after the injection:

in case 1 (EMFModel)bsmModel).getResource().getContents().get(0) is a DynamicEObjectImpl

in case 2 (EMFModel)bsmModel).getResource().getContents().get(0) is not of the same type.


The question which might clarify the situation is: Does the EMFVLauncher has constraints on contents type? are we obliged to use DynamicEObjectImpl objects?

Thanks in advance.
HB
Re: Java ATL transformation Obligations [message #988370 is a reply to message #988358] Thu, 29 November 2012 16:02 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 301
Registered: July 2009
Senior Member
Quote:
am trying to inject an object of type myType___Impl which extends CDOObject the result

I don't know the implementation of the CDOInjector but the underlying code under EMFInjector, EMFModel and so on is not intended to manage single objects.
Maybe you can try to directly inject the CDO resource using org.eclipse.m2m.atl.core.emf.EMFInjector.inject(IModel, Resource).

Quote:
Does the EMFVLauncher has constraints on contents type?

No. For the injection the injector behaviour is the same as EMF. For the extraction you can specify which content-type to use which make ATL recreate a resource using the correct ResourceFactory. But I don't think your issue has to deal with EMF content-types here.

Quote:
are we obliged to use DynamicEObjectImpl objects?

The fact that you have DynamicEObjectImpl objects comes from the way you load the metamodel. If the metamodel is deployed you should load it from its registry URI. If you load it using a workspace file path to the .ecore file, ATL will load the metamodel dynamically and thus the model will be loaded using DynamicEObjectImpl.

Re: Java ATL transformation Obligations [message #988375 is a reply to message #988370] Thu, 29 November 2012 16:21 Go to previous message
Hassan BAZOUN is currently offline Hassan BAZOUNFriend
Messages: 54
Registered: April 2012
Member
hi William,

thanks for your reply.

1- I tried to inject the CDOResource using inject(IModel targetModel, Resource resource) but it didn't work, i got an empty result.

2- i asked about obligations to use DynamicEObjectImpl object because i tried to load an xmi resource while registring the Package.eInstance in the package registry,thus the contents where of the correct type myTypr___Impl and not DynamicEObjectImpl in this way that transformation didn't work

i'am blocked here since i don't want to create xmi file in order to apply my ATL transformation.

Thanks
HB
Previous Topic:does lazy rules from clause works?
Next Topic:Trasfrom many source elements to one target element
Goto Forum:
  


Current Time: Fri Apr 26 02:25:33 GMT 2024

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

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

Back to the top