Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend] model transformations with interfaces
[Xtend] model transformations with interfaces [message #657078] Tue, 01 March 2011 14:40 Go to next message
Stephan Krusche is currently offline Stephan Krusche
Messages: 18
Registered: August 2010
Location: Munich
Junior Member
I have the following constellation:

I want to implement a model transformation and I have two versions of my target metamodel: MM1 with classes A1 and B1 and MM2 with classes A2 and B2. As there are only small differences between A1 and A2 as well as between B1 and B2 I also have a generic metamodel GMM with interfaces I_A (which is implemented by A1 and A2) and I_B (which is implemented by B1 and B2).

I want to use GMM for the model transformation to avoid writing the same transformations for MM1 and MM2. Unfortunately this seems not to be possible with Xtend. When I try it, I got the error message: Cannot instantiate an interface.

My question: Is it possible with Xtend to implement the model transformation with GMM as target metamodel and to specify something like a configuration (e.g. with dependency injection) for each concrete metamodel that maps the interfaces to their concrete classes? Then I could implement the model transformation against the interfaces of GMM and specify at runtime (of course before the transformation) which configuration (i.e. which concrete metamodel) is used for the transformation.

Is that possible with Xtend?

Thank you and best regards
Stephan Krusche
Re: [Xtend] model transformations with interfaces [message #657270 is a reply to message #657078] Wed, 02 March 2011 09:52 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten Thoms
Messages: 354
Registered: July 2009
Location: Dortmund
Senior Member

Are you using the JavaBeansMetaModel or EmfRegistryMetaModel? I think with the latter this will be possible.

Regards,
~Karsten
Re: [Xtend] model transformations with interfaces [message #657297 is a reply to message #657078] Wed, 02 March 2011 11:09 Go to previous message
Stephan Krusche is currently offline Stephan Krusche
Messages: 18
Registered: August 2010
Location: Munich
Junior Member
I use the following code to register my metamodel packages and to invoke the XtendFacade to start the transformation:


public Object transform(InputModel inputModel) {
	ExecutionContextImpl context = new ExecutionContextImpl(new TypeSystemImpl());;
	EmfMetaModel metamodel = new EmfMetaModel();
	metamodel.setMetaModelPackage(MyMetaModelPackage.class.getName());
	context.registerMetaModel(metamodel);

	String extensionFile = "myExtension.ext";
	XtendFacade xtendFacade = XtendFacade.create(context, extensionFile);

	Object targetModel = xtendFacade.call("transform", inputModel);
	return targetModel;
}	


As EmfMetaModel is a subclass of EmfRegistryMetaModel, I assume that I use the latter one.

Can you explain how it is possible with that to make transformations with interfaces in the target metamodel?
Previous Topic:GMF integartion wid xpand
Next Topic:[Acceleo] multiples imports of classes associates
Goto Forum:
  


Current Time: Sat Oct 25 19:01:06 GMT 2014

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

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