Custom persistence in EMF [message #492960] |
Thu, 22 October 2009 14:03 |
Emilio Salazar Messages: 9 Registered: October 2009 |
Junior Member |
|
|
Hello all,
I'm trying to implement a custom text format persistency for ECore in order to feed an external tool.
This tool will analyze the text file and, probably, change it. Finally, the text file will be reloaded as ECore model (with the applied changes).
The problem is that the text format is not XML nor XMI format, so default implementations provided by EMF are not useful in this case.
I've been playing with Resource, ResourceSet and Resource.Factory, EStore but I haven't been successful.
I would really apreciatte any guidance on the right strategy to use here. Should I specialize Resource, EStore, both, or none of them?.
Any suggestions?
Thanks in advance.
|
|
|
Re: Custom persistence in EMF [message #492971 is a reply to message #492960] |
Thu, 22 October 2009 14:29 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Emilio,
Mostly it's a matter of extending ResourceImpl and specializing the
doLoad and doSave methods. For example, BinaryResourceImpl does that to
serialize arbitrary instances in a very fast compact binary format.
Emilio Salazar wrote:
> Hello all,
>
> I'm trying to implement a custom text format persistency for ECore in
> order to feed an external tool.
> This tool will analyze the text file and, probably, change it.
> Finally, the text file will be reloaded as ECore model (with the
> applied changes).
>
> The problem is that the text format is not XML nor XMI format, so
> default implementations provided by EMF are not useful in this case.
>
> I've been playing with Resource, ResourceSet and Resource.Factory,
> EStore but I haven't been successful.
> I would really apreciatte any guidance on the right strategy to use
> here. Should I specialize Resource, EStore, both, or none of them?.
> Any suggestions?
>
> Thanks in advance.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Custom persistence in EMF [message #492990 is a reply to message #492960] |
Thu, 22 October 2009 15:29 |
|
Hi Emilio,
You'll have to specialize ResourceImpl. In addition you need to create
your own Resource.Factory and register an instance of that with the
ResourceSet that your application uses.
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Emilio Salazar schrieb:
> Hello all,
>
> I'm trying to implement a custom text format persistency for ECore in
> order to feed an external tool.
> This tool will analyze the text file and, probably, change it.
> Finally, the text file will be reloaded as ECore model (with the
> applied changes).
>
> The problem is that the text format is not XML nor XMI format, so
> default implementations provided by EMF are not useful in this case.
>
> I've been playing with Resource, ResourceSet and Resource.Factory,
> EStore but I haven't been successful.
> I would really apreciatte any guidance on the right strategy to use
> here. Should I specialize Resource, EStore, both, or none of them?.
> Any suggestions?
>
> Thanks in advance.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04505 seconds