Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] How to construct connection aware URIs
[CDO] How to construct connection aware URIs [message #952790] Sun, 21 October 2012 19:52 Go to next message
Tim Schaefer is currently offline Tim Schaefer
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi,

I learned from
https://bugs.eclipse.org/bugs/show_bug.cgi?id=326186 and
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329786
that CDO supports connection aware URIs.
Looking at the test case of the 2nd bugzilla, it seems to me that such a connection aware URI must be constructed manually, e.g.
URI.createURI(CDONet4jUtil.PROTOCOL_TCP + "://localhost:port/repo1/path");
This means that I must know the hostname, port and which protocol to use.
Is there a way to obtain this information by looking at the session of a particular CDOObject?
In my application I have a CDOObject that exists within a user-created session, i.e. from the CDO Sessions view, and I want the app to obtain/create a connection aware URI for this object.
Is this possible?

Regards,
Tim
Re: [CDO] How to construct connection aware URIs [message #952848 is a reply to message #952790] Sun, 21 October 2012 20:54 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5528
Registered: July 2009
Senior Member
Am 21.10.2012 21:52, schrieb Tim Schaefer:
> Hi,
>
> I learned from
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=326186 and
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329786
> that CDO supports connection aware URIs.
> Looking at the test case of the 2nd bugzilla, it seems to me that such a connection aware URI must be constructed
> manually, e.g.
> URI.createURI(CDONet4jUtil.PROTOCOL_TCP + "://localhost:port/repo1/path");
> This means that I must know the hostname, port and which protocol to use.
That's the definition of "connection-aware" :P

> Is there a way to obtain this information by looking at the session of a particular CDOObject?
Only with nasty casts. Something like:

((IConnector)((CDONet4jSession)object.cdoView().getSession()).options().getNet4jProtocol().getChannel().getMultiplexer()).getURL()

I wonder about why you want to do that. I guess there's some misunderstanding about connection-aware URIs.

> In my application I have a CDOObject that exists within a user-created session, i.e. from the CDO Sessions view, and I
> want the app to obtain/create a connection aware URI for this object.
> Is this possible?
Yes, with the above code. Why do you want the URIs to be connection-aware?

I'm off for the EclipseCon now. I'll keep a flag on this thread and follow-up next week.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] How to construct connection aware URIs [message #952886 is a reply to message #952848] Sun, 21 October 2012 21:43 Go to previous message
Tim Schaefer is currently offline Tim Schaefer
Messages: 49
Registered: June 2011
Location: Marburg, Germany
Member
Hi Eike,

thanks for your fast reply, that does the trick.

The reason I want to do this is because I have a registry for instances of my model, similar to EMFs package registry. The resource URIs containing the registered objects are stored in a properties file that is read when the plugin starts, but at this point in time, the sessions are not opened yet. They are manually created by the user via the CDO Sessions view. Putting connection-aware URIs in the properties file should solve that problem.

The objects are registered from an editor that is opened through the sessions view, i.e. the code that does the registration did not create the session and thus doesn't know the connection details. But with the line of code you provided, it can determine it.

Thank you very much!

Regards,
Tim
Previous Topic:How models are stored in CDO?
Next Topic:[CDO] Clone example strange behavior
Goto Forum:
  


Current Time: Thu Oct 02 04:36:35 GMT 2014

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

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