Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354729

Summary: Model conversion should retain containment proxies
Product: [Technology] CBI Reporter: Kenn Hussey <Kenn.Hussey>
Component: CBI p2 Repository AggregatorAssignee: Project Inbox <b3.aggregator-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: david_williams, thomas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Kenn Hussey CLA 2011-08-15 09:11:46 EDT
Currently, when a model from an older schema is converted to the latest schema, proxies are resolved and the resulting model does not retain containment proxies (i.e., all content gets serialized to a single resource).

I'm not sure exactly how the conversion is being done (haven't looked at the code), but one way to avoid loading proxies is to use the (non-resolving flavours of) the iterators provided in EcoreUtil when traversing the model. The getAllProperContents(Resource, boolean) method, for example, will return an iterator over just the objects serialize in the given resource.

If proxy resolution during model conversion can't be avoided, another way to preserve detached resources would be to detect and remember them will traversing the model, e.g., by calling eDirectResource() on each object and comparing it to the root resource, and then re-create the containment proxies (by setting the resource on the same objects) when done converting.
Comment 1 Thomas Hallgren CLA 2011-08-15 17:52:16 EDT
The model transformation will now retain all proxies unless it's absolutely necessary to resolve them. The only time that happens is when a new name is entered for the transformed master file. This is because many references are bidirectional in nature and the reference itself contains the filename.

The current behavior is thus:
- Retain the file name during conversion also means retain all proxies
- Change the file name also means resolve all proxies (all contributions must be detached again)

Fixed in rev. 1548
Comment 2 Thomas Hallgren CLA 2011-08-16 03:10:20 EDT
I added a section explaining the legacy model conversion to the b3 aggregator documentation:

http://wiki.eclipse.org/Eclipse_b3/aggregator/manual#Legacy_format_support
Comment 3 David Williams CLA 2016-09-16 15:59:47 EDT
[Bookkeeping change only. Moving bugs to the new "home" of aggregator, CBI.
No change to assignee for resolved and verified bugs.]