[EMF] Base Ecore and extending one. [message #889449] |
Tue, 19 June 2012 08:43 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
Hello,
i wrote a framework which is based on an EMF ecore generated model.
to make this framework reuseable i want to put my ecore into the package,
so it can be extended for any later use.
what do i need to do to get this working?
is it enough to get the ecore and add stuff anyone wants to use? i doubt so, because if anyone edits the package names my framework will no longer accept the classes as their input (as they are hardcoded as parameters)
so my thought was creating a second .ecore which 'simply' imports/extends the ecore defined by me.
i created:
framework.ecore
framework.ecorediag
framework.genmodel
(i also generated an framework.xsd and an frameworkXMI.xsd)
i did not find a way to import an xsd or ecore in the ecore editor.
so i am not able to reference to the EClasses defined in my framework.ecore
myModel.ecore extends framework.ecore
(which generates the defined framework and its packages/factory etc and the myModel packages/factory (or one factory for both)
iff this problem is described in the book it seems i'm searching for the wrong words/places so simply point me to the page and name.
thanks in advance
lumo
[Updated on: Tue, 19 June 2012 08:44] Report message to a moderator
|
|
|
|
Re: [EMF] Base Ecore and extending one. [message #889504 is a reply to message #889487] |
Tue, 19 June 2012 09:53 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
>Nothing special, export all your packages from framework-bundle
thats the point, how do i 'export' the package (from the framework.ecore)?
>Someone can't edit your package names, all one can is to derive from
>your base class so this sentence is not making sense to me but maybe I
>got something wrong.
someone can edit my package name iff i provide the framework.ecore, then open it and edit the content to extend it; its not editable if i extend it
>make sure the myModel.genmodel references the framework.genmodel so that
>the base classes are not regenerated.
thanks for the hint, thats what i guessed.
probably i am searching on the wrong place.
i open up my framework.ecore in the 'Sample Ecore Model Editor'
in the editor: rightclick on framework.ecore nor package name brings up an export menuepoint.
in the package explorer rightclick on the framework.ecore brings up an export menue point but this one seems the wrong one.
so next try was creating an .genmodel file
in the 'EMF Generator' View clicking on the Framework, the option export shows up, and i can export an XML or xmi.XML, which i both created.
but how do i import the stuff now to the new extending.ecore?
EDIT: - or did you mean this:
do you mean exporting the package (generated classes) from the bundle?
actually thats not what i want to do. i would like to extend the ecore, not the generated files, if possible.
so if possible have one framework.ecore, and another one wich extends this file (then generate the whole model)
other option is to generate the framework.ecore;
use the generated files and generate a new ecore from it (import)
then add the Eclasses i want/need
/EDIT
|
|
|
Re: [EMF] Base Ecore and extending one. [message #889528 is a reply to message #889504] |
Tue, 19 June 2012 10:15 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Am 19.06.12 11:53, schrieb Ludwig Moser:
>> Nothing special, export all your packages from framework-bundle
> thats the point, how do i 'export' the package (from the framework.ecore)?
>
You are exporting them in your MANIFEST.MF then others can reference
your java classes.
>> Someone can't edit your package names, all one can is to derive from
>> your base class so this sentence is not making sense to me but maybe I
>> got something wrong.
> someone can edit my package name iff i provide the framework.ecore, then
> open it and edit the content to extend it; its not editable if i extend
> it ;)
That's not a good idea, you provided a fixed API and allow people
subclass (extend, derive other) - that's no different than it is in Java.
>
>> make sure the myModel.genmodel references the framework.genmodel so that
>> the base classes are not regenerated.
> thanks for the hint, thats what i guessed.
>
> probably i am searching on the wrong place.
>
> i open up my framework.ecore in the 'Sample Ecore Model Editor'
> in the editor: rightclick on framework.ecore nor package name brings up
> an export menuepoint.
>
Exporting is done on the bundle / java level. ecore-packages are public
because they are registered in the registry using the plugin.xml
> in the package explorer rightclick on the framework.ecore brings up an
> export menue point but this one seems the wrong one.
>
> so next try was creating an .genmodel file
> in the 'EMF Generator' View clicking on the Framework, the option export
> shows up, and i can export an XML or xmi.XML, which i both created.
>
> but how do i import the stuff now to the new extending.ecore?
>
bring up the context menu on the root-node of extending.ecore and select
load resource.
>
> EDIT: - or did you mean this:
> do you mean exporting the package (generated classes) from the bundle?
> actually thats not what i want to do. i would like to extend the ecore,
> not the generated files, if possible.
>
Why? This means people having nothing to programm against beside but yes
you are not required to generate java classes anyone then has to use the
reflective API
> so if possible have one framework.ecore, and another one wich extends
> this file (then generate the whole model)
>
So you want anyone to use the reflective EMF-API?
> other option is to generate the framework.ecore;
> use the generated files and generate a new ecore from it (import)
> then add the Eclasses i want/need
> /EDIT
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04882 seconds