EMFModelInferrer [message #1748765] |
Mon, 28 November 2016 08:39  |
Eclipse User |
|
|
|
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 #1748790 is a reply to message #1748781] |
Mon, 28 November 2016 10:43   |
Eclipse User |
|
|
|
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... 
regards, Tom
|
|
|
Re: EMFModelInferrer [message #1748818 is a reply to message #1748790] |
Mon, 28 November 2016 23:52  |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.03480 seconds