Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Connection Aware URI, how to use it in a ResourceSet
[CDO] Connection Aware URI, how to use it in a ResourceSet [message #1221776] Wed, 18 December 2013 12:09 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi,

I am trying to use connection aware URI in the form:

cdo.net4j.tcp://localhost:2036/repo_source/resource
cdo.net4j.tcp://localhost:2037/repo_target/resource

I would like to use these, in combination with a CDOViewProvider which
would process the URI and create the appropriate TCPConnector.

When I try to get a resource with a ResourceSet, however I get a
Malformed URL exception. the protocol 'cdo.net4j.tcp' is not accepted.

Is there anything special I need to do?

BTW, when I use a canonical URI in the form cdo://repo_source/resource
it works, but then I miss info like the port and Connector type..

Thanks!
Christophe
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1221781 is a reply to message #1221776] Wed, 18 December 2013 12:20 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
mmmh... The ViewProviderTest in CDO tests does exactly this, wonder how
it works? Is the protocol registered somehow?

On 18-12-13 13:09, Christophe Bouhier wrote:
> Hi,
>
> I am trying to use connection aware URI in the form:
>
> cdo.net4j.tcp://localhost:2036/repo_source/resource
> cdo.net4j.tcp://localhost:2037/repo_target/resource
>
> I would like to use these, in combination with a CDOViewProvider which
> would process the URI and create the appropriate TCPConnector.
>
> When I try to get a resource with a ResourceSet, however I get a
> Malformed URL exception. the protocol 'cdo.net4j.tcp' is not accepted.
>
> Is there anything special I need to do?
>
> BTW, when I use a canonical URI in the form cdo://repo_source/resource
> it works, but then I miss info like the port and Connector type..
>
> Thanks!
> Christophe
>
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1221790 is a reply to message #1221781] Wed, 18 December 2013 12:44 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 18-12-13 13:20, Christophe Bouhier wrote:
> mmmh... The ViewProviderTest in CDO tests does exactly this, wonder how

For URL to support protocols, there is this below, but it also requires
a handler etc.... I am really puzzled how connection aware URI in CDO is
supposed to work?

/**
* The property which specifies the package prefix list to be scanned
* for protocol handlers. The value of this property (if any) should
* be a vertical bar delimited list of package names to search through
* for a protocol handler to load. The policy of this class is that
* all protocol handlers will be in a class called
<protocolname>.Handler,
* and each package in the list is examined in turn for a matching
* handler. If none are found (or the property is not specified), the
* default package prefix, sun.net.www.protocol, is used. The search
* proceeds from the first package in the list to the last and stops
* when a match is found.
*/
private static final String protocolPathProp =
"java.protocol.handler.pkgs";







> it works? Is the protocol registered somehow?
>
> On 18-12-13 13:09, Christophe Bouhier wrote:
>> Hi,
>>
>> I am trying to use connection aware URI in the form:
>>
>> cdo.net4j.tcp://localhost:2036/repo_source/resource
>> cdo.net4j.tcp://localhost:2037/repo_target/resource
>>
>> I would like to use these, in combination with a CDOViewProvider which
>> would process the URI and create the appropriate TCPConnector.
>>
>> When I try to get a resource with a ResourceSet, however I get a
>> Malformed URL exception. the protocol 'cdo.net4j.tcp' is not accepted.
>>
>> Is there anything special I need to do?
>>
>> BTW, when I use a canonical URI in the form cdo://repo_source/resource
>> it works, but then I miss info like the port and Connector type..
>>
>> Thanks!
>> Christophe
>>
>
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1221804 is a reply to message #1221776] Wed, 18 December 2013 13:12 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 18.12.2013 13:09, schrieb Christophe Bouhier:
> Hi,
>
> I am trying to use connection aware URI in the form:
>
> cdo.net4j.tcp://localhost:2036/repo_source/resource
> cdo.net4j.tcp://localhost:2037/repo_target/resource
>
> I would like to use these, in combination with a CDOViewProvider which would process the URI and create the
> appropriate TCPConnector.
>
> When I try to get a resource with a ResourceSet, however I get a Malformed URL exception. the protocol 'cdo.net4j.tcp'
> is not accepted.
>
> Is there anything special I need to do?
Not if running with the extension registry. Have a look at /org.eclipse.emf.cdo.net4j/plugin.xml

Does that help?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [SOLVED][CDO] Connection Aware URI, how to use it in a ResourceSet [message #1221805 is a reply to message #1221790] Wed, 18 December 2013 13:14 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Ok, solved. the CDONet4jUtil will register the factory with protocol:
cdo.net4.tcp etc... when in OSGI, when in a Unit test registration is
needed explicity.... bummer.

Map<String, Object> map =
Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap();
if (!map.containsKey(CDONet4jUtil.PROTOCOL_TCP))
{
map.put(CDONet4jUtil.PROTOCOL_TCP, CDOResourceFactory.INSTANCE);
}



On 18-12-13 13:44, Christophe Bouhier wrote:
> On 18-12-13 13:20, Christophe Bouhier wrote:
>> mmmh... The ViewProviderTest in CDO tests does exactly this, wonder how
>
> For URL to support protocols, there is this below, but it also requires
> a handler etc.... I am really puzzled how connection aware URI in CDO is
> supposed to work?
>
> /**
> * The property which specifies the package prefix list to be scanned
> * for protocol handlers. The value of this property (if any) should
> * be a vertical bar delimited list of package names to search through
> * for a protocol handler to load. The policy of this class is that
> * all protocol handlers will be in a class called
> <protocolname>.Handler,
> * and each package in the list is examined in turn for a matching
> * handler. If none are found (or the property is not specified), the
> * default package prefix, sun.net.www.protocol, is used. The search
> * proceeds from the first package in the list to the last and stops
> * when a match is found.
> */
> private static final String protocolPathProp =
> "java.protocol.handler.pkgs";
>
>
>
>
>
>
>
>> it works? Is the protocol registered somehow?
>>
>> On 18-12-13 13:09, Christophe Bouhier wrote:
>>> Hi,
>>>
>>> I am trying to use connection aware URI in the form:
>>>
>>> cdo.net4j.tcp://localhost:2036/repo_source/resource
>>> cdo.net4j.tcp://localhost:2037/repo_target/resource
>>>
>>> I would like to use these, in combination with a CDOViewProvider which
>>> would process the URI and create the appropriate TCPConnector.
>>>
>>> When I try to get a resource with a ResourceSet, however I get a
>>> Malformed URL exception. the protocol 'cdo.net4j.tcp' is not accepted.
>>>
>>> Is there anything special I need to do?
>>>
>>> BTW, when I use a canonical URI in the form cdo://repo_source/resource
>>> it works, but then I miss info like the port and Connector type..
>>>
>>> Thanks!
>>> Christophe
>>>
>>
>
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1221807 is a reply to message #1221804] Wed, 18 December 2013 13:15 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 18-12-13 14:12, Eike Stepper wrote:
> Am 18.12.2013 13:09, schrieb Christophe Bouhier:
>> Hi,
>>
>> I am trying to use connection aware URI in the form:
>>
>> cdo.net4j.tcp://localhost:2036/repo_source/resource
>> cdo.net4j.tcp://localhost:2037/repo_target/resource
>>
>> I would like to use these, in combination with a CDOViewProvider which
>> would process the URI and create the appropriate TCPConnector.
>>
>> When I try to get a resource with a ResourceSet, however I get a
>> Malformed URL exception. the protocol 'cdo.net4j.tcp' is not accepted.
>>
>> Is there anything special I need to do?
> Not if running with the extension registry. Have a look at
> /org.eclipse.emf.cdo.net4j/plugin.xml
>
> Does that help?
Thanks Ed, I figured out the magic was done in CDONet4jUtil, but I am
running from a JUnit test (without OSGI).

>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1221808 is a reply to message #1221807] Wed, 18 December 2013 13:16 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 18-12-13 14:15, Christophe Bouhier wrote:
> On 18-12-13 14:12, Eike Stepper wrote:
>> Am 18.12.2013 13:09, schrieb Christophe Bouhier:
>>> Hi,
>>>
>>> I am trying to use connection aware URI in the form:
>>>
>>> cdo.net4j.tcp://localhost:2036/repo_source/resource
>>> cdo.net4j.tcp://localhost:2037/repo_target/resource
>>>
>>> I would like to use these, in combination with a CDOViewProvider which
>>> would process the URI and create the appropriate TCPConnector.
>>>
>>> When I try to get a resource with a ResourceSet, however I get a
>>> Malformed URL exception. the protocol 'cdo.net4j.tcp' is not accepted.
>>>
>>> Is there anything special I need to do?
>> Not if running with the extension registry. Have a look at
>> /org.eclipse.emf.cdo.net4j/plugin.xml
>>
>> Does that help?
> Thanks Ed, I figured out the magic was done in CDONet4jUtil, but I am
> running from a JUnit test (without OSGI).
Oops thanks Eike!
>
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1223483 is a reply to message #1221804] Mon, 23 December 2013 14:25 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
One more question on this, is it possible to load the root resource
with a connection aware URI?

the following URI, doesn't return the root resource.

"cdo.net4j.tcp/localhost:2036/repo_source/"

Thanks!




On 18-12-13 14:12, Eike Stepper wrote:
> Am 18.12.2013 13:09, schrieb Christophe Bouhier:
>> Hi,
>>
>> I am trying to use connection aware URI in the form:
>>
>> cdo.net4j.tcp://localhost:2036/repo_source/resource
>> cdo.net4j.tcp://localhost:2037/repo_target/resource
>>
>> I would like to use these, in combination with a CDOViewProvider which
>> would process the URI and create the appropriate TCPConnector.
>>
>> When I try to get a resource with a ResourceSet, however I get a
>> Malformed URL exception. the protocol 'cdo.net4j.tcp' is not accepted.
>>
>> Is there anything special I need to do?
> Not if running with the extension registry. Have a look at
> /org.eclipse.emf.cdo.net4j/plugin.xml
>
> Does that help?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1226984 is a reply to message #1223483] Fri, 03 January 2014 08:09 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 23.12.2013 15:25, schrieb Christophe Bouhier:
> One more question on this, is it possible to load the root resource
> with a connection aware URI?
I have never tried it. The root resource is in some ways not a normal resource because it doesn't contain business
objects. The folders and resources it contains are EObjects in a technical sense, though.

>
> the following URI, doesn't return the root resource.
>
> "cdo.net4j.tcp/localhost:2036/repo_source/"
What does it return then?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1227045 is a reply to message #1226984] Fri, 03 January 2014 11:30 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 03-01-14 09:09, Eike Stepper wrote:
> Am 23.12.2013 15:25, schrieb Christophe Bouhier:
>> One more question on this, is it possible to load the root resource
>> with a connection aware URI?
> I have never tried it. The root resource is in some ways not a normal
> resource because it doesn't contain business objects. The folders and
> resources it contains are EObjects in a technical sense, though.
>
>>
>> the following URI, doesn't return the root resource.
>>
>> "cdo.net4j.tcp/localhost:2036/repo_source/"
> What does it return then?

It throws an exception.

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
org.eclipse.emf.cdo.util.InvalidURIException: Invalid URI
"cdo.net4j.tcp://127.0.0.1:2036/repo_source/":
java.lang.IllegalArgumentException: path is empty
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at
org.eclipse.emf.edapt.cdo.tests.CDOMigrationTestBase.clearCDORepositories(CDOMigrationTestBase.java:84)
at
org.eclipse.emf.edapt.cdo.tests.CDOMigrationTestBase.setUp(CDOMigrationTestBase.java:75)
at junit.framework.TestCase.runBare(TestCase.java:139)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at
org.eclipse.emf.edapt.cdo.tests.CDOMigrationTestSuite.run(CDOMigrationTestSuite.java:80)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.eclipse.emf.cdo.util.InvalidURIException: Invalid URI
"cdo.net4j.tcp://127.0.0.1:2036/repo_source/":
java.lang.IllegalArgumentException: path is empty
at
org.eclipse.emf.internal.cdo.view.AbstractCDOView.registerProxyResource(AbstractCDOView.java:1380)
at
org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.registerProxy(CDOResourceImpl.java:1165)
at
org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.load(CDOResourceImpl.java:1074)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 20 more
Caused by: java.lang.IllegalArgumentException: path is empty
at
org.eclipse.emf.internal.cdo.view.AbstractCDOView.getResourceNodeID(AbstractCDOView.java:546)
at
org.eclipse.emf.internal.cdo.view.AbstractCDOView.registerProxyResource(AbstractCDOView.java:1365)
... 24 more


>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
Re: [CDO] Connection Aware URI, how to use it in a ResourceSet [message #1227132 is a reply to message #1227045] Fri, 03 January 2014 16:29 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 03.01.2014 12:30, schrieb Christophe Bouhier:
> On 03-01-14 09:09, Eike Stepper wrote:
>> Am 23.12.2013 15:25, schrieb Christophe Bouhier:
>>> One more question on this, is it possible to load the root resource
>>> with a connection aware URI?
>> I have never tried it. The root resource is in some ways not a normal
>> resource because it doesn't contain business objects. The folders and
>> resources it contains are EObjects in a technical sense, though.
>>
>>>
>>> the following URI, doesn't return the root resource.
>>>
>>> "cdo.net4j.tcp/localhost:2036/repo_source/"
>> What does it return then?
>
> It throws an exception.
I suspect that we can fix that in AbstractCDOView. Please submit a bugzilla.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
> org.eclipse.emf.cdo.util.InvalidURIException: Invalid URI "cdo.net4j.tcp://127.0.0.1:2036/repo_source/":
> java.lang.IllegalArgumentException: path is empty
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
> at org.eclipse.emf.edapt.cdo.tests.CDOMigrationTestBase.clearCDORepositories(CDOMigrationTestBase.java:84)
> at org.eclipse.emf.edapt.cdo.tests.CDOMigrationTestBase.setUp(CDOMigrationTestBase.java:75)
> at junit.framework.TestCase.runBare(TestCase.java:139)
> at junit.framework.TestResult$1.protect(TestResult.java:122)
> at junit.framework.TestResult.runProtected(TestResult.java:142)
> at junit.framework.TestResult.run(TestResult.java:125)
> at junit.framework.TestCase.run(TestCase.java:129)
> at junit.framework.TestSuite.runTest(TestSuite.java:255)
> at junit.framework.TestSuite.run(TestSuite.java:250)
> at org.eclipse.emf.edapt.cdo.tests.CDOMigrationTestSuite.run(CDOMigrationTestSuite.java:80)
> at junit.framework.TestSuite.runTest(TestSuite.java:255)
> at junit.framework.TestSuite.run(TestSuite.java:250)
> at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: org.eclipse.emf.cdo.util.InvalidURIException: Invalid URI "cdo.net4j.tcp://127.0.0.1:2036/repo_source/":
> java.lang.IllegalArgumentException: path is empty
> at org.eclipse.emf.internal.cdo.view.AbstractCDOView.registerProxyResource(AbstractCDOView.java:1380)
> at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.registerProxy(CDOResourceImpl.java:1165)
> at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.load(CDOResourceImpl.java:1074)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
> ... 20 more
> Caused by: java.lang.IllegalArgumentException: path is empty
> at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getResourceNodeID(AbstractCDOView.java:546)
> at org.eclipse.emf.internal.cdo.view.AbstractCDOView.registerProxyResource(AbstractCDOView.java:1365)
> ... 24 more
>
>
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>


Previous Topic:[EMF] [CDO] ResourceSet, EPackage registry question
Next Topic:[CDO] ClassCastException persisting EJavaObject to DB
Goto Forum:
  


Current Time: Thu Mar 28 17:26:45 GMT 2024

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

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

Back to the top