Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EObject to String for bigger models
EObject to String for bigger models [message #659081] Thu, 10 March 2011 22:08 Go to next message
Otto von Wesendonk is currently offline Otto von WesendonkFriend
Messages: 2
Registered: March 2011
Junior Member
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 22:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
Registered: July 2009
Senior Member
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 #659094 is a reply to message #659083] Thu, 10 March 2011 23:34 Go to previous messageGo to next message
Otto von Wesendonk is currently offline Otto von WesendonkFriend
Messages: 2
Registered: March 2011
Junior Member
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
Re: EObject to String for bigger models [message #659099 is a reply to message #659094] Fri, 11 March 2011 00:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
Registered: July 2009
Senior Member
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
Previous Topic:EContentAdapter
Next Topic:EMF [compare]
Goto Forum:
  


Current Time: Thu Oct 17 15:17:50 GMT 2019

Powered by FUDForum. Page generated in 0.02289 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top