Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326651 - Unable to update a metamodel in the MetamodelRegistry
Summary: Unable to update a metamodel in the MetamodelRegistry
Status: RESOLVED FIXED
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 05:14 EDT by Alexis Muller CLA
Modified: 2014-11-20 05:14 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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