Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » EMFModelInferrer(similar to JvmModelInferrer)
EMFModelInferrer [message #1748765] Mon, 28 November 2016 13:39 Go to next message
Thomas Kohler is currently offline Thomas KohlerFriend
Messages: 7
Registered: November 2016
Junior Member
I'm thinking about generating EMF based Java code out of an own XBase based DSL using the/an inferrer to have the full Java and IDE integration possibilities of Xtext.

The EMF Generator itself generates a lot of additional information (Packages with Literals, Factories, Switches, edit providers, etc.) and has a lot of different generator settings which I won't loose. Therefore inferring all the EMF Artifacts would not be a consideration, but the inferrer has to have knowledge at least about getters and setters of the EMF generated code.

On the other side the handling of a mixture of two generators (EMF Generator generates the EMF based parts, DSL Generator enhances the EMF based classes with additional methods) looks difficult. Especially the instant code generation when saving a resource should not last much longer as using the JvmModelInferrer itself.

An other Idea would be to generate the EMF based parts in the first step, then use the Jvm Parser to build up the knowledge about the EMF generated classes and then enhance them using the JvmInferrer. This would need a kind of merge during JvmGenerator generation.

Has someone tried a simlilar approach before? And could xcore help?

regards, Tom
Re: EMFModelInferrer [message #1748781 is a reply to message #1748765] Mon, 28 November 2016 15:08 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 529
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Tom,

sorry, I don't get the reason of your use case. But if you would like to have EMF generated code with custom Xbase operations, then Xcore is exactly doing this and you should go with that instead of creating your own DSL.

~Karsten
Re: EMFModelInferrer [message #1748790 is a reply to message #1748781] Mon, 28 November 2016 15:43 Go to previous messageGo to next message
Thomas Kohler is currently offline Thomas KohlerFriend
Messages: 7
Registered: November 2016
Junior Member
Hello Karsten,

The use case is a technical simple DSL to describe Business Logic in form of part-trees (heavy weight pojo's for which I want to use EMF based classes to get Persistence, correct containment/reference behaviour). The DSL Users don't have technical background, so xcore would be to much for them.

To fulfill the technical background we already wrote a complex Framework for the runtime side - inspired by EMF, but not EMF. All Business logic is currently defined in a kind of Configuration Tool (SWT and EMF based) which generates all Business Classes (using old oAW xpand and partially xtend) and also all needed resources like XHTMLs (JSF), Persistence, Mappings, ... . So you can model a new BusinessObject together with it's gui layout, press generate and use it immediatly via tomcat and your browser.

My intention for a future major release is to replace the Configuration Tool with a DSL (which can be used like any language in the Eclipse IDE), build an additional Configuration Tool which looks like the old one but onto the new EMF Model of the DSL instead of our old configuration model (for the business logic modelling people) use xbase instead of our own antlr based 4gl grammar for operations and store the configurations resources using the DSL parser/serializer instead of XMI-XML as before. So changes in the "code" wil be reflected in the Config Tool and vice versa. At the moment our technical Team don't want to use the Config Tool (to less possibilities to express themself) and the modelling people are not skilled technical enough to use Java together with our framework. The new approach would fulfill the needs of both fractions.

On the runtime side (which contains and runs the generated parts) I want to switch to EMF instead of using our own model framework and enrich the EMF generated classes with the parts of business logic out of the DSL. If we could manage this, we would have a solid Configuration language (xbase) and a solid model framework background (EMF).

To bring it together: A simple to use DSL should generate a technical mature model which fits into out base framework... Smile

regards, Tom
Re: EMFModelInferrer [message #1748818 is a reply to message #1748790] Tue, 29 November 2016 04:52 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 529
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Thanks Thomas for the explanation. The reason I was asking is because Xcore does quite some effort to create such enhanced EMF classes and you should leverage this if possible. Xcore's org.eclipse.emf.ecore.xcore.generator package contains the stuff that adapts Xcore's models to EMF generator models. If you would have to build this for your own DSL, this is a starting point.

If possible, I would avoid to replicate the code and maintain it for a custom DSL. Instead I would reuse Xcore. Xcore would produce the enriched EMF classes as you require, with custom Xbase operations. I understand that you don't want to have the Xcore syntax for your DSL, but how about implementing a small IGenerator that creates .xcore files from your DSL files and let Xcore do the EMF codegen?

Is this a way to go for you?
Previous Topic:Set XEpression local scope
Next Topic:method generateFile undefined for the type MyDslGenerator
Goto Forum:
  


Current Time: Sun Aug 20 00:25:43 GMT 2017

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

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