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

Bug 326651

Summary: Unable to update a metamodel in the MetamodelRegistry
Product: [Modeling] QVTo Reporter: Alexis Muller <Alexis.Muller>
Component: EngineAssignee: Project Inbox <mmt-qvt.operational-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: christopher.gerking, serg.boyko2011
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Alexis Muller CLA 2010-09-30 05:14:22 EDT
Build Identifier: 20100917-0705

It is able to add new metamodels to a MetamodelRegistry using its "merge" operation.
But it is impossible to update an existing one (same nsURI).

Delete (in the merge operation) the test "if(!this.myMetamodelDescs.containsKey(id))" solve this issue.

Reproducible: Always

Steps to Reproduce:
1. Update an already registered metamodel (dynamic instance)

2. Re-register this metamodel in EMf registry :
EPackage.Registry.INSTANCE.put(rootPa.getNsURI(), rootPa); 

3. Merge the Emf registry with the QVT MetamodelRegistry :
MetamodelRegistry current = new MetamodelRegistry
   (new EmfStandaloneMetamodelProvider());
MetamodelRegistry.getInstance().merge(current);

4. The updated metamodel version do not replace the old one
Comment 1 Christopher Gerking CLA 2014-08-04 11:22:09 EDT
(In reply to Alexis Muller from comment #0)
> Delete (in the merge operation) the test
> "if(!this.myMetamodelDescs.containsKey(id))" solve this issue.

Since existing keys stem from a metamodel provider with a higher priority, deleting the above code is certainly not an option.
 
> 3. Merge the Emf registry with the QVT MetamodelRegistry :
> MetamodelRegistry current = new MetamodelRegistry
>    (new EmfStandaloneMetamodelProvider());
> MetamodelRegistry.getInstance().merge(current);

You are dealing with MetamodelRegistry as an internal class here. In contrast, my approach for bug 441094 aims at preserving the EPackage.Registry passed to the TransformationExcecutor. Thus, you could just put your new package into the package registry you are using, and it automatically becomes visible to the internal MetamodelRegistry.
Comment 2 Christopher Gerking CLA 2014-10-22 12:46:48 EDT
Succeeding test case pushed to cgerking.

Commit ID: 95268f0f9ef8d52c00bcc89bf244e7cfe9ecfd1c
Comment 3 Sergey Boyko CLA 2014-11-20 05:14:09 EST
(In reply to Christopher Gerking from comment #2)
> Succeeding test case pushed to cgerking.
> 
> Commit ID: 95268f0f9ef8d52c00bcc89bf244e7cfe9ecfd1c

Cherry-picked to master for M4.
Commit id: de499dbfbd960a63f62c4938d9dc71172e075120