Skip to main content



      Home
Home » Modeling » EMF » Changing EObject identification mechanism(Wondering how to change the EObject identification mechanism)
Changing EObject identification mechanism [message #1069532] Tue, 16 July 2013 00:11 Go to next message
Eclipse UserFriend
I'm looking to have multiple models reference classes from a single model.

I've read

http://nirmalsasidharan.wordpress.com/2011/05/25/10-common-emf-mistakes/

and understand that the default identification mechanism relies on naming / indexing that could easily change, no doubt causing problems.

The blog suggests replacing the default identification mechanism with a unique/intrinsic ID, which I'm keen to do to avoid problems occurring for simple changes in the referenced model.

I'm not really sure how to change that default identification mechanism, I assume it's not a small job?

How do I go about using IDs to identify cross-model-referenced EObjects so that re-ordering / renaming in the referenced file doesn't cause issues?

Thanks
Re: Changing EObject identification mechanism [message #1069536 is a reply to message #1069532] Tue, 16 July 2013 00:24 Go to previous messageGo to next message
Eclipse UserFriend
Phillip,

Either define an EAttribute of with isID true on each base class for
intrinsic IDs or use XMIResourceImpl with useUUIDs specialized to return
true for extrinsic IDs. With the former type of ID, you need to manage
assigning a value that's unique across all objects of all types in the
same resource and with the later, you need to accept the significant
per-object overhead (on the order of 170 bytes per object because of the
large string itself and the maps required in the resource implementation).


On 16/07/2013 6:11 AM, Phillip Drew wrote:
> I'm looking to have multiple models reference classes from a single
> model.
>
> I've read
> http://nirmalsasidharan.wordpress.com/2011/05/25/10-common-emf-mistakes/
>
> and understand that the default identification mechanism relies on
> naming / indexing that could easily change, no doubt causing problems.
>
> The blog suggests replacing the default identification mechanism with
> a unique/intrinsic ID, which I'm keen to do to avoid problems
> occurring for simple changes in the referenced model.
>
> I'm not really sure how to change that default identification
> mechanism, I assume it's not a small job?
> How do I go about using IDs to identify cross-model-referenced
> EObjects so that re-ordering / renaming in the referenced file doesn't
> cause issues?
>
> Thanks
Re: Changing EObject identification mechanism [message #1069551 is a reply to message #1069536] Tue, 16 July 2013 01:30 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the prompt reply

The XMIResourceImpl solution sounds perfect as the models in question are <100 objects so the overhead shouldn't be an issue.

Any pointers on how to make the change to a generated EMF editor? I'm not sure where they actually do all of their file/resource handling.
Re: Changing EObject identification mechanism [message #1069607 is a reply to message #1069551] Tue, 16 July 2013 04:28 Go to previous message
Eclipse UserFriend
Philipp,

On the GenPackage (the first object nested under the root GenModel in
the Generator editor), set Resource Type to XMI and regenerated (if
you're using something older than EMF 2.9, delegate the plugin.xml to
regenerate it; 2.9 supports merging). Then you can specialized the
generated resource impl derived from XMIResourceImpl to override
useUUIDs to true. Then you're done.

On 16/07/2013 7:30 AM, Phillip Drew wrote:
> Thanks for the prompt reply
>
> The XMIResourceImpl solution sounds perfect as the models in question
> are <100 objects so the overhead shouldn't be an issue.
>
> Any pointers on how to make the change to a generated EMF editor? I'm
> not sure where they actually do all of their file/resource handling.
Previous Topic:[EMF & CDO] Re-implementing EObject classes in Scala as traits/mixins
Next Topic:[EMF Compare] How to provide a ModelComparison for custom refactorings?
Goto Forum:
  


Current Time: Fri Jul 18 01:23:27 EDT 2025

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

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

Back to the top