Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Conditional loading of cross refs
Conditional loading of cross refs [message #1007035] Mon, 04 February 2013 07:56 Go to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
I have a xmi file that contains changes that have to be synchronized with the objects contained in a CDO repository.
The objects in the xmi file contains cross references to objects in the CDO repository. If the CDO repository is empty, those objects cannot be resolved. So, additionally, the xmi file contains the referenced objects as a copy that must be used instead (i.e. when they are not contained the CDO repository).

When loading the xmi file using an XMIResource: what is the best way to conditionally resolve cross refs? I.e. while the resource is loading, I would like to decide whether to resolve the objects to the CDO repository if they exist there, or resolve to the objects in the XMIResource if not found in the CDO repository.
Re: Conditional loading of cross refs [message #1007043 is a reply to message #1007035] Mon, 04 February 2013 08:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Erdal,

Comments below.

On 04/02/2013 8:56 AM, Erdal Karaca wrote:
> I have a xmi file that contains changes that have to be synchronized
> with the objects contained in a CDO repository.
> The objects in the xmi file contains cross references to objects in
> the CDO repository. If the CDO repository is empty, those objects
> cannot be resolved. So, additionally, the xmi file contains the
> referenced objects as a copy that must be used instead (i.e. when they
> are not contained the CDO repository).
>
> When loading the xmi file using an XMIResource: what is the best way
> to conditionally resolve cross refs?
No cross references are resolved during loading...
> I.e. while the resource is loading, I would like to decide whether to
> resolve the objects to the CDO repository if they exist there, or
> resolve to the objects in the XMIResource if not found in the CDO
> repository.
Perhaps instrumenting your resource set's getEObject would be best.
Proxies are resolved lazily on first access and all such access will
call ResourceSet.getEObject. It delegates to ResourceSet.getResource
which, ultimately calls ResourceSetImpl.demanLoad the first time that
resource is needed. So perhaps that's the best place to intercept the
fact that a URI referring to a CDO resource needs to be redirected in
some way...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Conditional loading of cross refs [message #1007253 is a reply to message #1007043] Tue, 05 February 2013 09:33 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Thanks, Ed!
That solution works.

Ed Merks wrote on Mon, 04 February 2013 09:32
Erdal,

Comments below.

On 04/02/2013 8:56 AM, Erdal Karaca wrote:
> I have a xmi file that contains changes that have to be synchronized
> with the objects contained in a CDO repository.
> The objects in the xmi file contains cross references to objects in
> the CDO repository. If the CDO repository is empty, those objects
> cannot be resolved. So, additionally, the xmi file contains the
> referenced objects as a copy that must be used instead (i.e. when they
> are not contained the CDO repository).
>
> When loading the xmi file using an XMIResource: what is the best way
> to conditionally resolve cross refs?
No cross references are resolved during loading...
> I.e. while the resource is loading, I would like to decide whether to
> resolve the objects to the CDO repository if they exist there, or
> resolve to the objects in the XMIResource if not found in the CDO
> repository.
Perhaps instrumenting your resource set's getEObject would be best.
Proxies are resolved lazily on first access and all such access will
call ResourceSet.getEObject. It delegates to ResourceSet.getResource
which, ultimately calls ResourceSetImpl.demanLoad the first time that
resource is needed. So perhaps that's the best place to intercept the
fact that a URI referring to a CDO resource needs to be redirected in
some way...

Previous Topic: CDO lock/unlock model event
Next Topic:[Maven] Adding resource -> encoding problem
Goto Forum:
  


Current Time: Fri Mar 29 13:32:26 GMT 2024

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

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

Back to the top