EObject to String for bigger models [message #659081] |
Thu, 10 March 2011 17:08  |
Eclipse User |
|
|
|
Hi,
in order to serialize eobjects to strings, I copy the eobject, add it to a new, "virtual" resource and then save it using a StringWriter as outputstream. Since the models are getting bigger now, this approach is becoming a bottleneck.
I was wondering how hard it would be to short-circuit the XMLSaveImpl class in order to serialize the original eobject without having to copying it or it loosing its resource and so on. Which steps would be necessary and is this a good idea anyway?
The eobjects which are serialized are in a self-contained tree. (They are saved in multiple resources using cross-resource containment links, but I don't think this matters, since they are fully loaded to RAM at time of serialization anyway).
Any hints or ideas?
Thanks in advance,
Otto
|
|
|
Re: EObject to String for bigger models [message #659083 is a reply to message #659081] |
Thu, 10 March 2011 17:14   |
Eclipse User |
|
|
|
Otto,
Comments below.
Otto von Wesendonk wrote:
> Hi,
>
> in order to serialize eobjects to strings, I copy the eobject, add it
> to a new, "virtual" resource and then save it using a StringWriter as
> outputstream. Since the models are getting bigger now, this approach
> is becoming a bottleneck.
>
> I was wondering how hard it would be to short-circuit the XMLSaveImpl
> class in order to serialize the original eobject without having to
> copying it or it loosing its resource and so on. Which steps would be
> necessary and is this a good idea anyway?
Using this option with the resource that really contains some ancestor.
/**
* Write only the subtree starting at the specified list of EObjects,
* which must be objects contained by the resource.
*/
String OPTION_ROOT_OBJECTS = "ROOT_OBJECTS";
>
> The eobjects which are serialized are in a self-contained tree. (They
> are saved in multiple resources using cross-resource containment
> links, but I don't think this matters, since they are fully loaded to
> RAM at time of serialization anyway).
>
> Any hints or ideas?
> Thanks in advance,
> Otto
|
|
|
|
Re: EObject to String for bigger models [message #659099 is a reply to message #659094] |
Thu, 10 March 2011 19:23  |
Eclipse User |
|
|
|
Otto,
So you need something that doesn't reflect the real (complete) state of
the objects. That's not so easy. You'd need to specialize XMLSaveImpl
for stuff like that.
Otto von Wesendonk wrote:
> Hi Ed,
>
> thanks for your super fast reply. I saw you mentioning this option
> before but didn't recognize that it would help me.
>
> My model is spread over several resources. I used this option on the
> resource containing the root object of the subtree i wanted to
> serialize to string, but the final string then contained cross
> references to the children in other resources. I need the serialized
> string to be self-contained. How can I solve this issue?
>
> Thanks again,
> Otto
|
|
|
Powered by
FUDForum. Page generated in 0.03708 seconds