Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Sharing a resource set amongst views
[CDO] Sharing a resource set amongst views [message #917875] Thu, 20 September 2012 10:20 Go to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 773
Registered: July 2009
Senior Member
Hi,

Does CDO permit, or is it safe, to have views (or transactions) from
more than one session, where each session is connected to a different
repository, share a resource set? I assume not, because proxies
reference objects by URIs that are based on the OID, and OIDs are
unique only within a repository. In general, URIs in CDO are unique
only within one repository, correct? I can have any number of
repositories named "repo1" on different servers, and they can contain
resources at the same paths, etc.

Or, is there a configuration of the repository (or something else) that
can be employed to ensure that object and resource URIs are globally
unique, perhaps incorporating the URL of the repository, itself?

Thanks,

Christian
Re: [CDO] Sharing a resource set amongst views [message #917888 is a reply to message #917875] Thu, 20 September 2012 10:31 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban Dugueperoux
Messages: 309
Registered: July 2009
Senior Member
Hi Christian,

You can have in a single ResourceSet, CDOObject from different
repository using the XA Transaction with connection aware URI. With
connection aware URI, you have a unique URI for each CDOObject, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329786 . There is the
CDOViewSet which is associated to one ResourceSet and to several CDOView.

Best Regards.

On 20/09/2012 16:20, Christian W. Damus wrote:
> Hi,
>
> Does CDO permit, or is it safe, to have views (or transactions) from
> more than one session, where each session is connected to a different
> repository, share a resource set? I assume not, because proxies
> reference objects by URIs that are based on the OID, and OIDs are unique
> only within a repository. In general, URIs in CDO are unique only
> within one repository, correct? I can have any number of repositories
> named "repo1" on different servers, and they can contain resources at
> the same paths, etc.
>
> Or, is there a configuration of the repository (or something else) that
> can be employed to ensure that object and resource URIs are globally
> unique, perhaps incorporating the URL of the repository, itself?
>
> Thanks,
>
> Christian
>
Re: [CDO] Sharing a resource set amongst views [message #917923 is a reply to message #917888] Thu, 20 September 2012 11:10 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 773
Registered: July 2009
Senior Member
Thanks, Esteban,

That's exactly what I was looking for! I particularly like the
injection of a credentials provider, so that resources in the
workspace, which might still be shared with others in a version control
system, don't encode user names (and certainly not passwords!).

cW

On 2012-09-20 14:31:11 +0000, Esteban Dugueperoux said:

> Hi Christian,
>
> You can have in a single ResourceSet, CDOObject from different
> repository using the XA Transaction with connection aware URI. With
> connection aware URI, you have a unique URI for each CDOObject, see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329786 . There is the
> CDOViewSet which is associated to one ResourceSet and to several
> CDOView.
>
> Best Regards.
>
> On 20/09/2012 16:20, Christian W. Damus wrote:
> > Hi,
> >
> > Does CDO permit, or is it safe, to have views (or transactions) from
> > more than one session, where each session is connected to a different
> > repository, share a resource set? I assume not, because proxies
> > reference objects by URIs that are based on the OID, and OIDs are unique
> > only within a repository. In general, URIs in CDO are unique only
> > within one repository, correct? I can have any number of repositories
> > named "repo1" on different servers, and they can contain resources at
> > the same paths, etc.
> >
> > Or, is there a configuration of the repository (or something else) that
> > can be employed to ensure that object and resource URIs are globally
> > unique, perhaps incorporating the URL of the repository, itself?
> >
> > Thanks,
> >
> > Christian
> >
Re: [CDO] Sharing a resource set amongst views [message #917963 is a reply to message #917888] Thu, 20 September 2012 11:46 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 773
Registered: July 2009
Senior Member
Hi, Esteban,

A point of clarification: a CDOXATransaction, as documented in the
API, implements atomic commits distributed over multiple CDOViewSets.
CDOViewSets, again per the documentation, are a one-to-one-and-onto
mapping to resource sets. This suggests that if I am working with
multiple repository connections, then I must use a distinct resource
set for each repository.

Is that correct? Or is the documentation of of date somewhere?

See, I want to be able to integrate resources in the Eclipse workspace
with resources from multiple repositories in a single resource set.
Moreover, this resource set is managed by a Dawn transactional editing
domain for GMF-based diagram editors. A tall order!

Thanks,

Christian


On 2012-09-20 14:31:11 +0000, Esteban Dugueperoux said:

> Hi Christian,
>
> You can have in a single ResourceSet, CDOObject from different
> repository using the XA Transaction with connection aware URI. With
> connection aware URI, you have a unique URI for each CDOObject, see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329786 . There is the
> CDOViewSet which is associated to one ResourceSet and to several
> CDOView.
>
> Best Regards.
>
> On 20/09/2012 16:20, Christian W. Damus wrote:
> > Hi,
> >
> > Does CDO permit, or is it safe, to have views (or transactions) from
> > more than one session, where each session is connected to a different
> > repository, share a resource set? I assume not, because proxies
> > reference objects by URIs that are based on the OID, and OIDs are unique
> > only within a repository. In general, URIs in CDO are unique only
> > within one repository, correct? I can have any number of repositories
> > named "repo1" on different servers, and they can contain resources at
> > the same paths, etc.
> >
> > Or, is there a configuration of the repository (or something else) that
> > can be employed to ensure that object and resource URIs are globally
> > unique, perhaps incorporating the URL of the repository, itself?
> >
> > Thanks,
> >
> > Christian
> >
Re: [CDO] Sharing a resource set amongst views [message #918091 is a reply to message #917875] Thu, 20 September 2012 14:30 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5501
Registered: July 2009
Senior Member
Am 20.09.2012 16:20, schrieb Christian W. Damus:
> Hi,
>
> Does CDO permit, or is it safe, to have views (or transactions) from more than one session, where each session is
> connected to a different repository, share a resource set?
Yes, a ResourceSet is associated with a CDOViewSet, which maintains a set of CDOViews. The CDOViewSet ensures that the
repositories of the views are pair-wise different. CDOViewSets are not very well-known because the standard use-case of
one view/repository per ResourceSet does not require the application to care about this aspect. A multi-view scenario
could start like this:

CDOView view1 = session1.openView();
CDOView view2 = session2.openView(view1.getResourceSet());

Or:

ResourceSet resourceSet = new ResourceSetImpl();
CDOView view1 = session1.openView(resourceSet);
CDOView view2 = session2.openView(resourceSet);

> I assume not, because proxies reference objects by URIs that are based on the OID, and OIDs are unique only within a
> repository.
CDO has its own proxy concept, but yes, all references are essentially CDOIDs of their target objects.

> In general, URIs in CDO are unique only within one repository, correct?
CDOIDs are unique within their repository. If by "URI" you mean the result of EcoreUtil.getURI(eObject) then no, CDO
URIs of EObjects always contain the identity of the repository in one of several ways, e.g., the repository UUID for
canonical URIs.

> I can have any number of repositories named "repo1" on different servers, and they can contain resources at the same
> paths, etc.
Still their objects' URIs would be "globally" unique because of the repo UUID.

> Or, is there a configuration of the repository (or something else) that can be employed to ensure that object and
> resource URIs are globally unique, perhaps incorporating the URL of the repository, itself?
The repository UUID (see above) is automatically generated when the repository is started the first time. At this time
the UUID value can be overriden by the configuration property IRepository.Props.OVERRIDE_UUID. Passing the empty string
sets the UUID to the *name* of the repository (often nicer to read in single repository setups).

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Sharing a resource set amongst views [message #918102 is a reply to message #917888] Thu, 20 September 2012 14:42 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5501
Registered: July 2009
Senior Member
Am 20.09.2012 16:31, schrieb Esteban Dugueperoux:
>
> Hi Christian,
>
> You can have in a single ResourceSet, CDOObject from different repository using the XA Transaction
I don't think an XA transaction is needed for read-only access to the (distributed) object graph. But yes, most use
cases involve modifications of the graph that need to be committed atomically to the different repositories later. A
CDOXATransaction supports this with the help of a two-phase commit protocol. It does not require the CDOTransactions it
controls to be associated with the same ResourceSet/CDOViewSet. A single CDOXATransaction can be associated with
multiple CDOViewsets with, in turn, can be associated with multiple CDOViews/CDOTransactions. An example:

CDOXATransaction xaTransaction = CDOUtil.createXATransaction();
xaTransaction.add(CDOUtil.getViewSet(resourceSet1));
xaTransaction.add(CDOUtil.getViewSet(resourceSet2));
xaTransaction.add(CDOUtil.getViewSet(resourceSet3));

// Modify the graph

xaTransaction.commit();

> with connection aware URI. With connection aware URI, you have a unique URI for each CDOObject, see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329786 .
I don't think that connection-aware URIs are needed just for the sake of multi-repository graphs.

> There is the CDOViewSet which is associated to one ResourceSet and to several CDOView.
Yes ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Sharing a resource set amongst views [message #918103 is a reply to message #917963] Thu, 20 September 2012 14:45 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5501
Registered: July 2009
Senior Member
Am 20.09.2012 17:46, schrieb Christian W. Damus:
> Hi, Esteban,
>
> A point of clarification: a CDOXATransaction, as documented in the API, implements atomic commits distributed over
> multiple CDOViewSets. CDOViewSets, again per the documentation, are a one-to-one-and-onto mapping to resource sets.
> This suggests that if I am working with multiple repository connections, then I must use a distinct resource set for
> each repository.
No. I know it's hard to get :P

I hope my other reply makes it clearer. If not I can draw a diagram...

>
> Is that correct? Or is the documentation of of date somewhere?
>
> See, I want to be able to integrate resources in the Eclipse workspace with resources from multiple repositories in a
> single resource set.
Note that you need an XA transaction even for multiple transaction that are associated with just one resource set!

> Moreover, this resource set is managed by a Dawn transactional editing domain for GMF-based diagram editors. A tall
> order!
Sounds like real fun ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Sharing a resource set amongst views [message #918163 is a reply to message #918091] Thu, 20 September 2012 16:03 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 773
Registered: July 2009
Senior Member
Thanks, Eike,

It wasn't clear to me that the URIs I'm seeing have a repository UUID
that just happens to look like the repository name, because it's a test
instance using an example configuration file that forces these friendly
URIs. :-) I'm glad to know that the URIs, in whatever form, are still
globally unique.

I hadn't encountered the CDOViewSet before now, or if I had, I glossed
over it because I didn't need to understand it. Clearly I do need to
understand it! I'm glad to know that, indeed, my
one-resource-set-to-rule-them-all should work. I'll do some trials to
see how it actually comes together.

So, I see that your snippet below opens views from different
repositories on the same resource set. That's exactly what I need, and
my confusion stemmed from my confusing CDOView with CDOViewSet. I'm
corrected, now.

cW


On 2012-09-20 18:30:08 +0000, Eike Stepper said:

> Am 20.09.2012 16:20, schrieb Christian W. Damus:
>> Hi,
>>
>> Does CDO permit, or is it safe, to have views (or transactions) from
>> more than one session, where each session is connected to a different
>> repository, share a resource set?
> Yes, a ResourceSet is associated with a CDOViewSet, which maintains a
> set of CDOViews. The CDOViewSet ensures that the repositories of the
> views are pair-wise different. CDOViewSets are not very well-known
> because the standard use-case of one view/repository per ResourceSet
> does not require the application to care about this aspect. A
> multi-view scenario could start like this:
>
> CDOView view1 = session1.openView();
> CDOView view2 = session2.openView(view1.getResourceSet());
>
> Or:
>
> ResourceSet resourceSet = new ResourceSetImpl();
> CDOView view1 = session1.openView(resourceSet);
> CDOView view2 = session2.openView(resourceSet);
>
>> I assume not, because proxies reference objects by URIs that are based
>> on the OID, and OIDs are unique only within a repository.
> CDO has its own proxy concept, but yes, all references are essentially
> CDOIDs of their target objects.
>
>> In general, URIs in CDO are unique only within one repository, correct?
> CDOIDs are unique within their repository. If by "URI" you mean the
> result of EcoreUtil.getURI(eObject) then no, CDO URIs of EObjects
> always contain the identity of the repository in one of several ways,
> e.g., the repository UUID for canonical URIs.
>
>> I can have any number of repositories named "repo1" on different
>> servers, and they can contain resources at the same paths, etc.
> Still their objects' URIs would be "globally" unique because of the repo UUID.
>
>> Or, is there a configuration of the repository (or something else) that
>> can be employed to ensure that object and resource URIs are globally
>> unique, perhaps incorporating the URL of the repository, itself?
> The repository UUID (see above) is automatically generated when the
> repository is started the first time. At this time the UUID value can
> be overriden by the configuration property
> IRepository.Props.OVERRIDE_UUID. Passing the empty string sets the UUID
> to the *name* of the repository (often nicer to read in single
> repository setups).
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
Re: [CDO] Sharing a resource set amongst views [message #918164 is a reply to message #918102] Thu, 20 September 2012 16:03 Go to previous message
Christian W. Damus is currently offline Christian W. Damus
Messages: 773
Registered: July 2009
Senior Member
Very cool. That API makes this look so easy!

The reason why I'm looking for connection-aware URIs is because I
anticipate having objects in resources in the Eclipse workspace that
reference objects in the repository. If the user opens such a resource
and starts working with it, proxies need to resolve to load content
from the repository.

It's not an ideal workflow, and I would certainly want to encourage
users not to mix and match like this, but I need to account for use
cases that I can anticipate in an application that I still don't know
very well. The next questions are about how to deal with the
infrastructural bits that this entails (CDO sessions, transactions,
etc.) but I know that I can listen for these objects' comings and
goings and would plan for the application to carefully manage them on
the user's behalf anyways.

Thanks for all of your help, so far!

cW


On 2012-09-20 18:42:35 +0000, Eike Stepper said:

> Am 20.09.2012 16:31, schrieb Esteban Dugueperoux:
>>
>> Hi Christian,
>>
>> You can have in a single ResourceSet, CDOObject from different
>> repository using the XA Transaction
> I don't think an XA transaction is needed for read-only access to the
> (distributed) object graph. But yes, most use cases involve
> modifications of the graph that need to be committed atomically to the
> different repositories later. A CDOXATransaction supports this with the
> help of a two-phase commit protocol. It does not require the
> CDOTransactions it controls to be associated with the same
> ResourceSet/CDOViewSet. A single CDOXATransaction can be associated
> with multiple CDOViewsets with, in turn, can be associated with
> multiple CDOViews/CDOTransactions. An example:
>
> CDOXATransaction xaTransaction = CDOUtil.createXATransaction();
> xaTransaction.add(CDOUtil.getViewSet(resourceSet1));
> xaTransaction.add(CDOUtil.getViewSet(resourceSet2));
> xaTransaction.add(CDOUtil.getViewSet(resourceSet3));
>
> // Modify the graph
>
> xaTransaction.commit();
>
>> with connection aware URI. With connection aware URI, you have a unique
>> URI for each CDOObject, see
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329786 .
> I don't think that connection-aware URIs are needed just for the sake
> of multi-repository graphs.
>
>> There is the CDOViewSet which is associated to one ResourceSet and to
>> several CDOView.
> Yes ;-)
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
Previous Topic:[databinding] Data binding and read-only resources
Next Topic:[CDO/Teneo] EMF Specific Extra Columns in DDL
Goto Forum:
  


Current Time: Wed Aug 27 09:18:55 EDT 2014

Powered by FUDForum. Page generated in 0.13810 seconds