identity - Unique and reproducible identifier for Java Object (Eclipe EMF's resources and model elments) -


i've been googling around solution, , read lot of questions/answers here in sof, didn't find use.

my problem following: need uniquely identify emf elements across different machines. lowest level known superclass org.eclipse.emf.common.notify.notifier, elements may resources and/or model elements.

the id should reproducible @ runtime across different machines (i may have calculate id both in client , server having reference java object). have no access source code, cannot modify models (files), , not model elements have uuids.

as id should reproducible across different machines, cannot use hashcode() (any form). thought on using md5 hashes, cannot figure out use seed of md5 hash make unique (to extent) , reproducible @ same time.

all appreciated!

well, kind of found solution. use different id's eobjects , resources:

  • for eobjects, fragment uri (their path inside containing resource), make string, , use seed md5 hash. turns out result of fragmenturi().tostring() looks amazingly similar emf generates uuid. :-)

  • for resources, file's contents (model files xmi/xml files) , calculate md5 hash on those.

the solution little heavy, specially resource piece, make minimizing calls id's generation algorithm, ok me. is unique , reproducible across machines, needed.

hope helps in future.


Comments