Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]Instances of EMF-generated models as ATL outputs?
[ATL]Instances of EMF-generated models as ATL outputs? [message #65839] Thu, 08 November 2007 18:06
Eclipse UserFriend
Originally posted by: matt.mcgill.gmail.com

Hello all,

I have an EMF model MM (conforming to Ecore) that is the metamodel for
the output of an ATL transformation T. In other words, T produces
instances of MM as output. I have used EMF to generate Java code for A.
So, for class Foo in MM there is now a generated Java class called
FooImpl, along with generated Java classes MMPackageImpl and
MMFactoryImpl and others. In this scenario I am executing ATL
programmatically and standalone, not from the Eclipse menu or within the
Eclipse runtime via Ant tasks.

When I execute T, I expect to receive as output an ASMEMFModel wrapping
an EMF Resource containing instances of my generated classes such as
FooImpl. However, the resource contained by the ASMEMFModel representing
the output of T instead contains DynamicEObjectImpl instances, even
though I have registered MM prior to executing T by referencing
MMPackage.eINSTANCE. Presumably ASMEMFModel is not finding the generated
MMFactoryImpl to create model elements with. What do I need to do to
cause ATL to use the generated factory when creating target model elements?

Note that, after executing the transformation, I can serialize the
resulting output model to XMI and then reload it with the following code:

ByteArrayOutputStream out = new ByteArrayOutputStream();
/* serialize model as XMI to out */
Resource r = new XMIResourceImpl();
try {
r.load(new ByteArrayInputStream(out.toByteArray()),
new HashMap<String, String>());
} catch (IOException ex) {
throw new RuntimeException(ex);
}
FooImpl foo = (FooImpl)r.getContents().get(0);

and in this manner convert the DynamicEObjectImpls to FooImpls - but it
is very undesirable to have to do this.

Thanks,
-Matt McGill
Previous Topic:DSL projects: eclipse hangs when validating TGE
Next Topic:[ATL] Interesting paper on model synchronization presented at the ASE conference in Atlanta this wee
Goto Forum:
  


Current Time: Sun Apr 11 01:45:53 GMT 2021

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

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

Back to the top