Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Save option OPTION_ROOT_OBJECTS ignored with OPTION_BINARY(Cannot save multiple roots in binary format)
Save option OPTION_ROOT_OBJECTS ignored with OPTION_BINARY [message #1707326] Thu, 03 September 2015 17:49 Go to next message
Steve Pearson is currently offline Steve PearsonFriend
Messages: 10
Registered: May 2014
Junior Member
Hello,
XMI save options OPTION_BINARY and OPTION_ROOT_OBJECTS work as expected when used on their own. However, when both are used the complete resource is saved (in binary) and not just the specified root objects.
This combination would be really useful for us. Is there any way to get it to work?
Re: Save option OPTION_ROOT_OBJECTS ignored with OPTION_BINARY [message #1707364 is a reply to message #1707326] Fri, 04 September 2015 07:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29390
Registered: July 2009
Senior Member
Steve,

You can look at how the former option is used in
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(OutputStream,
Map<?, ?>). You could do the same thing, but specialize
org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl.EObjectOutputStream.saveResource(Resource)
to start with not just the contents of the resource, but some subset.

On 03/09/2015 7:49 PM, Steve Pearson wrote:
> Hello,
> XMI save options OPTION_BINARY and OPTION_ROOT_OBJECTS work as
> expected when used on their own. However, when both are used the
> complete resource is saved (in binary) and not just the specified root
> objects. This combination would be really useful for us. Is there any
> way to get it to work?
>
Re: Save option OPTION_ROOT_OBJECTS ignored with OPTION_BINARY [message #1707551 is a reply to message #1707364] Mon, 07 September 2015 09:36 Go to previous messageGo to next message
Steve Pearson is currently offline Steve PearsonFriend
Messages: 10
Registered: May 2014
Junior Member
Ed,

Many thanks. I managed to specialize this exactly as you described. It was only a couple of lines in BinaryResourceImpl.EObjectOutputStream.saveResource(Resource) to use the passed in root objects if they exist instead of the full resource contents. I also had to make a change to the save of the 'extrinsic ID map' in the binary part of XMLResourceImpl.doSave(OutputStream,
Map<?, ?>) since with OPTION_ROOT_OBJECTS not all the IDs have to exist. When it could not match an ID BinaryResourceImpl.EObjectOutputStream.saveEObject incorrectly wrote out the missing EObject in full rendering the output unparsable.
As this is an omission is there any chance the code base could be updated so that this useful combination is supported without the need for specialized classes?
Re: Save option OPTION_ROOT_OBJECTS ignored with OPTION_BINARY [message #1707564 is a reply to message #1707551] Mon, 07 September 2015 12:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29390
Registered: July 2009
Senior Member
Steve,

Of course anything is possible, but be aware that such a feature is not
so high on my bloated priority list. Gerrit contributions help push
things up on that list...

On 07/09/2015 11:36 AM, Steve Pearson wrote:
> Ed,
>
> Many thanks. I managed to specialize this exactly as you described. It
> was only a couple of lines in
> BinaryResourceImpl.EObjectOutputStream.saveResource(Resource) to use
> the passed in root objects if they exist instead of the full resource
> contents. I also had to make a change to the save of the 'extrinsic ID
> map' in the binary part of XMLResourceImpl.doSave(OutputStream, Map<?,
> ?>) since with OPTION_ROOT_OBJECTS not all the IDs have to exist. When
> it could not match an ID
> BinaryResourceImpl.EObjectOutputStream.saveEObject incorrectly wrote
> out the missing EObject in full rendering the output unparsable.
> As this is an omission is there any chance the code base could be
> updated so that this useful combination is supported without the need
> for specialized classes?
Re: Save option OPTION_ROOT_OBJECTS ignored with OPTION_BINARY [message #1713946 is a reply to message #1707326] Sun, 08 November 2015 23:49 Go to previous message
Angels Investors is currently offline Angels InvestorsFriend
Messages: 1
Registered: November 2015
Junior Member
This combination will work well.
Previous Topic:[CDO] IAppExtension to configure default CDOResourceNodes
Next Topic:Customizing content provider with metamodel information
Goto Forum:
  


Current Time: Thu Jun 21 18:30:02 GMT 2018

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

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

Back to the top