How to use EMF with an own meta-model

914 views Asked by At

my goal is to create a meta-model for a model but one level higher than by default with EMF. The meta-model(2) should define the possibilities and restrictions for the possible modles(1). Then I want to generate Java-code of this model.

2 meta-model 1 model 0 Java-code

So the model(1) is a kind of DSL and the meta-model is the definition of that DSL.

How can I do this. Is it possible with EMF or is there any other plugin from the Eclipse Modeling Project?

Im searching for some functionality like in this tool: http://www.actifsource.com/ but without specifying an extra generator template.

2

There are 2 answers

1
Jordi Cabot On

You can use Xtext (EMF-based) to define your (textual) DSL. XText will generate the metamodel and the model editor so you can define your own models rather quickly. From there, you could use Acceleo (a template-based model-to-text generator) to generate java code from them.

0
Vladimir Vaschenko On

Not sure you need meta-model, but you may check EMF Facet which allows you to extend existing Ecore metamodels without having to modify them.