Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDOURIHandler
[CDO] CDOURIHandler [message #430950] Fri, 19 June 2009 11:21 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm looking for a way to refer to EMF models in a uniform manner and
came across the discussion of a cdo URI format. I also see there is a
CDOURIHandler, that doesn't implement the stream-oriented methods.

What is the intended usage of CDO URIs outside of CDO, i.e. in the
application/client and not internally in CDO? E.g. can I use
ResourceSet.getResource("cdo://.../...", true);

Hallvard
Re: [CDO] CDOURIHandler [message #430951 is a reply to message #430950] Fri, 19 June 2009 13:03 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hallvard,

comments bellow:

> I'm looking for a way to refer to EMF models in a uniform manner and
> came across the discussion of a cdo URI format. I also see there is a
> CDOURIHandler, that doesn't implement the stream-oriented methods.

CDOURI format is a bit special, it has the following scheme:

cdo://<repository-UUID>/<resource-path>#<CDOID>

so you could get the root resource:
cdo://<repository-UUID>/

or certain CDOResource:
cdo://<repository-UUID>/<resource-path>

or refer to certain CDOObject:
cdo://<repository-UUID>/<resource-path>#<CDOID>

We discussed stream-orientation some time ago, and I think Simon
proposed some interesting ideas in this regard. Please take a look at:

247873: Getting information of a CDO URI (URIHandler/Converter)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=247873

If you're still interested on this, feel free to open a enhancement
request :D

> What is the intended usage of CDO URIs outside of CDO, i.e. in the
> application/client and not internally in CDO? E.g. can I use
> ResourceSet.getResource("cdo://.../...", true);

Basically, you can define some kind of mechanism to determine how to
obtain these resources. EMF provides several mechanisms for that,
through extension points and a convenient API.

The main issue on CDOResource retrieval is having a CDOView as start
point. For this sake, we've implemented the so-called CDOViewProvider:
throught extension points, you can define your own classes aimed to
provide CDOView instances under your own criteria.

You can find this extension point defined in org.eclipse.emf.cdo.

Also, and for the sake of an uniform usage of URIs for different
protocols, you could use the Eclipse File System project (EFS).

We have this:

246703: Develop EFS provider
https://bugs.eclipse.org/bugs/show_bug.cgi?id=246703

We will gladly assist in case you want to contribute on it.

HTH,
Víctor.
Re: [CDO] CDOURIHandler [message #430975 is a reply to message #430950] Mon, 22 June 2009 11:45 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090405010404050904060006
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

Hallvard,

As Vik said, in order for a CDO URI to be meaningful the EMF resource
set must be able to handle these URIs. There generally exist two ways to
achieve that:

1) Use *_CDO API_* to open a CDOView or CDOTransaction on the resource set:

| ResourceSet resourceSet = *new *ResourceSetImpl();
IConnector connector = (IConnector)IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.connectors ", "tcp", "repos.foo.org:2036");

CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName("MyRepo");

CDOSession session = configuration.openSession();
CDOTransaction transaction = session.openTransaction(resourceSet);

// Work with the resource set....
transaction.commit();
session.close();|


Optionally you can open additional views or transaction on the same
session and associate them with different resource sets. Or you can
associate additional views or transaction of different sessions to the
same resource set (XA).

2) You can use _*EMF API*_ to achieve the same thing (with a bit less
control over it). Internally CDO attaches a CDOViewSet adapter to a
resource set and there's the extension point
org.eclipse.emf.cdo.viewProviders which you can extend to contribute
your custom CDOViewProviders that will be used by the CDOViewSet to
control the association of views with a resource set. There is a
concrete PluginContainerViewProvider that looks up the needed CDOSession
in IPluginContainer.INSTANCE. So you just need to create and register
the appropriate CDOSession there:

| CDOSession session = (CDOSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions ", "cdo", "tcp://repos.foo.org:2036/MyRepo");
// ...
|



I know that there are many different ways to setup all the needed
infrastructure and I should really provide more documentation on them.
Please let me know if you have further questions.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper





Hallvard Tr


Re: [CDO] CDOURIHandler [message #430978 is a reply to message #430975] Mon, 22 June 2009 16:45 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Eike Stepper wrote:

> As Vik said, in order for a CDO URI to be meaningful the EMF resource
> set must be able to handle these URIs. There generally exist two ways to
> achieve that:
>
> 1) Use *_CDO API_* to open a CDOView or CDOTransaction on the resource set:
>
> | ResourceSet resourceSet = *new *ResourceSetImpl();
> IConnector connector = (IConnector)IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.connectors ", "tcp", "repos.foo.org:2036");
>
> CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration();
> configuration.setConnector(connector);
> configuration.setRepositoryName("MyRepo");
>
> CDOSession session = configuration.openSession();
> CDOTransaction transaction = session.openTransaction(resourceSet);

So at this point I can use
resourceSet.getResource("platform:/resource/project/mydata", true);
to get an ordinary resource, and
resourceSet.getResource("cdo://rep-id/res-path/", true);
to get a cdo resource?

> 2) You can use _*EMF API*_ to achieve the same thing
> There is a
> concrete PluginContainerViewProvider that looks up the needed CDOSession
> in IPluginContainer.INSTANCE. So you just need to create and register
> the appropriate CDOSession there:
>
> | CDOSession session = (CDOSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions ", "cdo", "tcp://repos.foo.org:2036/MyRepo");
> // ...

So in this case, I make the CDOSession in advance and associate it with
a cdo URI by means of IPluginContainer.INSTANCE.getElement(...)?

Can I at this point use
resourceSet.getResource("platform:/resource/project/mydata", true);
to get an ordinary resource, and
resourceSet.getResource("cdo://rep-id/res-path/", true);
to get a cdo resource?

Is it in general OK to mix cdo and non-cdo resources in the same
resourceSet? (The non-cdo resource will refer to the cdo-resource.)

Hallvard
Re: [CDO] CDOURIHandler [message #430981 is a reply to message #430978] Mon, 22 June 2009 18:35 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hallvard Trætteberg schrieb:
> Eike Stepper wrote:
>
>> As Vik said, in order for a CDO URI to be meaningful the EMF resource
>> set must be able to handle these URIs. There generally exist two ways
>> to achieve that:
>>
>> 1) Use *_CDO API_* to open a CDOView or CDOTransaction on the
>> resource set:
>>
>> | ResourceSet resourceSet = *new *ResourceSetImpl();
>> IConnector connector =
>> (IConnector)IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.connectors ",
>> "tcp", "repos.foo.org:2036");
>>
>> CDOSessionConfiguration configuration =
>> CDONet4jUtil.createSessionConfiguration();
>> configuration.setConnector(connector);
>> configuration.setRepositoryName("MyRepo");
>>
>> CDOSession session = configuration.openSession();
>> CDOTransaction transaction = session.openTransaction(resourceSet);
>
> So at this point I can use
> resourceSet.getResource("platform:/resource/project/mydata", true);
> to get an ordinary resource,
Yes.

> and
> resourceSet.getResource("cdo://rep-id/res-path/", true);
> to get a cdo resource?
Yes.

>
>> 2) You can use _*EMF API*_ to achieve the same thing
> > There is a
>> concrete PluginContainerViewProvider that looks up the needed
>> CDOSession in IPluginContainer.INSTANCE. So you just need to create
>> and register the appropriate CDOSession there:
>>
>> | CDOSession session =
>> (CDOSession)IPluginContainer.INSTANCE.getElement("org.eclipse.emf.cdo.sessions ",
>> "cdo", "tcp://repos.foo.org:2036/MyRepo");
>> // ...
>
> So in this case, I make the CDOSession in advance and associate it
> with a cdo URI by means of IPluginContainer.INSTANCE.getElement(...)?
Yes.

>
> Can I at this point use
> resourceSet.getResource("platform:/resource/project/mydata", true);
> to get an ordinary resource,
Yes.

> and
> resourceSet.getResource("cdo://rep-id/res-path/", true);
> to get a cdo resource?
Yes.

>
> Is it in general OK to mix cdo and non-cdo resources in the same
> resourceSet? (The non-cdo resource will refer to the cdo-resource.)
Did I say "yes" already? :P
Yes.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:What setting/option is used to save emf models as XML without the nsPrefix?
Next Topic:Setting ModelElement values from a non-UI thread
Goto Forum:
  


Current Time: Thu Apr 25 06:18:40 GMT 2024

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

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

Back to the top