Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Object references
[CDO] Object references [message #649679] Thu, 20 January 2011 09:53 Go to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
If I export a resource as XMI file, then, object references contain a href like this:
cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/itemtree#L83

I assume the UUID is the id of the repository. Can I import the xmi file into another repository, e.g., located on another server?
Re: [CDO] Object references [message #649696 is a reply to message #649679] Thu, 20 January 2011 11:04 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Erdal,

if you export a resource to XMI and that kind of URIs appear, it means
that is a reference to a CDOObject contained in a different CDOResource.
That means your XMI Resource is referencing objects from another
CDOResource in the repository.


Erdal Karaca escribió:
> If I export a resource as XMI file, then, object references contain a
> href like this:
> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/itemtree#L83
>
> I assume the UUID is the id of the repository. Can I import the xmi file
> into another repository, e.g., located on another server?
>
Re: [CDO] Object references [message #649708 is a reply to message #649696] Thu, 20 January 2011 12:06 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
I see.
The resource (itemtree) is located at the root of the repository.
So, I would expect the href containing something similar to "/itemtree#L83". As that would be sufficient, wouldn't it?
Re: [CDO] Object references [message #649722 is a reply to message #649708] Thu, 20 January 2011 12:35 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Erdal,

when you export a resource from CDO to XMI, you are basically copying
all the EObject into a XMIResource (using
org.eclipse.emf.ecore.util.EcoreUtil.copyAll(Collection<? extends T>)).

This process implies copying the contents of one Resource, but does not
trascend beyond the Resource scope. So, if there are inter-resource
references, the copy will mantain that reference as a proxy to an
EObject in another resource.

So no, the export is not expected to copy contents beyond Resource
scope. I recall there is an old enhacement request for that, but can't
find it on bugzilla.

I'm not sure how to solve that. I guess you'll have to identify all
external references and export those resources too. Once you have the
smallest subset of interdependant resources, you have to update those
copied EObjects that used to have external refernces.

Erdal Karaca escribió:
> I see.
> The resource (itemtree) is located at the root of the repository.
> So, I would expect the href containing something similar to
> "/itemtree#L83". As that would be sufficient, wouldn't it?
Re: [CDO] Object references [message #649978 is a reply to message #649722] Fri, 21 January 2011 09:33 Go to previous message
Alex Lagarde is currently offline Alex LagardeFriend
Messages: 193
Registered: May 2010
Senior Member

Hi Erdal,

I used the ECoreUtil's Copier to upload XMI files on a CDORepository, maybe it can help you :

// Step 1 : get all the CDOObjects you want to download
// Match each CDO root with a local resource in which you want to copy it

// Step 2 : copy all the roots
EcoreUtil.Copier copier = new Copier(true, false);
copier.copyAll(allRootsToCopy);
copier.copyReferences();

// Step 3 : 
for (Resource localResource : createdLocalResources) {
            for (CDOObject remoteRoot : localResourceToRemoteRootToCopy.get(remoteRoot )) {
                EObject localCopy = copier.get(remoteRoot);
                cdoResource.getContents().add(localCopy);
            }
}


Let me know if it helps you,

Alex
Previous Topic:Generated feature values
Next Topic:xsd:any support of ##local
Goto Forum:
  


Current Time: Fri Apr 26 21:58:00 GMT 2024

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

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

Back to the top