Home » Modeling » EMF » [CDO] Support for external proxies
| |
Re: [CDO] Support for external proxies [message #498978 is a reply to message #498957] |
Thu, 19 November 2009 12:17 |
Mario Winterer Messages: 136 Registered: July 2009 |
Senior Member |
|
|
Victor,
thanks for your response.
I've tried two possible scenarios:
(1) Manual proxy without resource
a) Create new shallow instance that represents the external object
b) Set the proxy URI
c) Add the object to a CDOObject (so the CDOObject references the
external object after this step)
d) Commit the transaction.
Result: DanglingHrefException, saying the external object is not
contained in any resource (which seems wrong as a proxy should never be
contained in any resource).
(2) Manual proxy contained in a resource
a) Create a new resource and add it to the CDOTransaction's ResourcSet
b) Create new shallow instance that represents the external object
c) Set the proxy URI
d) Add the object to the contents of the newly created resource
e) Add the object to a CDOObject (so the CDOObject references the
external object after this step)
f) Commit the transaction.
Result: Changes are saved. If the proxy is navigated afterwards, proxy
resolution is performed but does not change anything, because the proxy
resolution mechanism simply loads the external resource using the proxy
URI. But because this resource is already loaded (it is the resource
that was created in step a), no additional loading takes place and the
proxy itself is returned from that resource instead.
I think, maybe the last lines of CDOViewImpl.provideCDOID(Object) should
be modified:
Now:
(...)
if (eObject.eResource() != null)
{
return CDOIDUtil.createExternal(uri);
}
throw new DanglingReferenceException(eObject);
Suggestion:
if ((eObject.eResource() != null) || eObject.isProxy())
{
return CDOIDUtil.createExternal(uri);
}
throw new DanglingReferenceException(eObject);
Mario
Víctor Roldán Betancort schrieb:
> Hi Mario,
>
> I believe external proxies were actually supported in CDO. I would say
> it is a bug... maybe the others can clarify.
>
> Could you reference that object instead of manually setting the proxy
> URI and see what happens?
>
> I'll try to create a test case anyway to try to reproduce your problem.
>
> I think Eike is at the Modeling Days so he isn't showing around, but he
> will jump in as the trip finishes ;)
>
> Cheers,
> Víctor.
>
> Mario Winterer escribió:
>> Hi!
>>
>> I'm currenty experiencing problems concerning references from cdo
>> objects to external (non-cdo) proxies.
>>
>> What I'd like to do is to set a reference from a cdo object to an
>> external (non-cdo) object. But as the object graph of the external
>> object is rather large, and I do not have an instance of that object
>> (I'd have to load it from another, non-loaded resource first), I only
>> want to create a proxy manually (I know the object's uri) and simply
>> set the proxy.
>>
>> The problem is that when I commit the transaction, CDO throws a
>> DanglingReferenceException because the external proxy is not contained
>> in a resource, which seems strange as proxies are never contained in
>> any resource.
>>
>> The last part of the StackTrace:
>> org.eclipse.emf.cdo.util.DanglingReferenceException: The object
>> "com.dgr.profi.offert.impl.OffertKopfImpl@1494cc8 (eProxyURI:
>> profi://laspalmas:1099/Offert?id=193#/)(com.dgr.profi.offert.impl.OffertKopfImpl)"
>> is not contained in a resource
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.provideCDOID(C DOViewImpl.java:922)
>>
>> at
>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. writeValues(AbstractCDORevision.java:653)
>>
>> at
>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. write(AbstractCDORevision.java:168)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl.wri teCDORevision(CDODataOutputImpl.java:160)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.writeRevisions(CommitTransactionRequest.java:307)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.requestingCommit(CommitTransactionRequest.java:209)
>>
>>
>>
>> Is this a bug or simply a limitation?
>>
>>
>> Mario
|
|
|
Re: [CDO] Support for external proxies [message #499005 is a reply to message #498978] |
Thu, 19 November 2009 14:02 |
|
Hi Mario,
To me that sounds reasonable and I'll further clarify this with Ed. Can
you please file a bugzilla?
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Mario Winterer schrieb:
> Victor,
>
> thanks for your response.
>
> I've tried two possible scenarios:
> (1) Manual proxy without resource
>
> a) Create new shallow instance that represents the external object
> b) Set the proxy URI
> c) Add the object to a CDOObject (so the CDOObject references the
> external object after this step)
> d) Commit the transaction.
>
> Result: DanglingHrefException, saying the external object is not
> contained in any resource (which seems wrong as a proxy should never
> be contained in any resource).
>
> (2) Manual proxy contained in a resource
>
> a) Create a new resource and add it to the CDOTransaction's ResourcSet
> b) Create new shallow instance that represents the external object
> c) Set the proxy URI
> d) Add the object to the contents of the newly created resource
> e) Add the object to a CDOObject (so the CDOObject references the
> external object after this step)
> f) Commit the transaction.
>
> Result: Changes are saved. If the proxy is navigated afterwards, proxy
> resolution is performed but does not change anything, because the
> proxy resolution mechanism simply loads the external resource using
> the proxy URI. But because this resource is already loaded (it is the
> resource that was created in step a), no additional loading takes
> place and the proxy itself is returned from that resource instead.
>
> I think, maybe the last lines of CDOViewImpl.provideCDOID(Object)
> should be modified:
>
> Now:
> (...)
> if (eObject.eResource() != null)
> {
> return CDOIDUtil.createExternal(uri);
> }
> throw new DanglingReferenceException(eObject);
>
> Suggestion:
> if ((eObject.eResource() != null) || eObject.isProxy())
> {
> return CDOIDUtil.createExternal(uri);
> }
> throw new DanglingReferenceException(eObject);
>
> Mario
>
>
>
> Víctor Roldán Betancort schrieb:
>> Hi Mario,
>>
>> I believe external proxies were actually supported in CDO. I would
>> say it is a bug... maybe the others can clarify.
>>
>> Could you reference that object instead of manually setting the proxy
>> URI and see what happens?
>>
>> I'll try to create a test case anyway to try to reproduce your problem.
>>
>> I think Eike is at the Modeling Days so he isn't showing around, but
>> he will jump in as the trip finishes ;)
>>
>> Cheers,
>> Víctor.
>>
>> Mario Winterer escribió:
>>> Hi!
>>>
>>> I'm currenty experiencing problems concerning references from cdo
>>> objects to external (non-cdo) proxies.
>>>
>>> What I'd like to do is to set a reference from a cdo object to an
>>> external (non-cdo) object. But as the object graph of the external
>>> object is rather large, and I do not have an instance of that object
>>> (I'd have to load it from another, non-loaded resource first), I
>>> only want to create a proxy manually (I know the object's uri) and
>>> simply set the proxy.
>>>
>>> The problem is that when I commit the transaction, CDO throws a
>>> DanglingReferenceException because the external proxy is not
>>> contained in a resource, which seems strange as proxies are never
>>> contained in any resource.
>>>
>>> The last part of the StackTrace:
>>> org.eclipse.emf.cdo.util.DanglingReferenceException: The object
>>> "com.dgr.profi.offert.impl.OffertKopfImpl@1494cc8 (eProxyURI:
>>> profi://laspalmas:1099/Offert?id=193#/)(com.dgr.profi.offert.impl.OffertKopfImpl)"
>>> is not contained in a resource
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.provideCDOID(C DOViewImpl.java:922)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. writeValues(AbstractCDORevision.java:653)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. write(AbstractCDORevision.java:168)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl.wri teCDORevision(CDODataOutputImpl.java:160)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.writeRevisions(CommitTransactionRequest.java:307)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.requestingCommit(CommitTransactionRequest.java:209)
>>>
>>>
>>>
>>> Is this a bug or simply a limitation?
>>>
>>>
>>> Mario
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Support for external proxies [message #499006 is a reply to message #498978] |
Thu, 19 November 2009 14:14 |
|
Hi Mario,
Your fix is good. Please file a bugzilla.
Cheers
/Eike
----
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Mario Winterer schrieb:
> Victor,
>
> thanks for your response.
>
> I've tried two possible scenarios:
> (1) Manual proxy without resource
>
> a) Create new shallow instance that represents the external object
> b) Set the proxy URI
> c) Add the object to a CDOObject (so the CDOObject references the
> external object after this step)
> d) Commit the transaction.
>
> Result: DanglingHrefException, saying the external object is not
> contained in any resource (which seems wrong as a proxy should never
> be contained in any resource).
>
> (2) Manual proxy contained in a resource
>
> a) Create a new resource and add it to the CDOTransaction's ResourcSet
> b) Create new shallow instance that represents the external object
> c) Set the proxy URI
> d) Add the object to the contents of the newly created resource
> e) Add the object to a CDOObject (so the CDOObject references the
> external object after this step)
> f) Commit the transaction.
>
> Result: Changes are saved. If the proxy is navigated afterwards, proxy
> resolution is performed but does not change anything, because the
> proxy resolution mechanism simply loads the external resource using
> the proxy URI. But because this resource is already loaded (it is the
> resource that was created in step a), no additional loading takes
> place and the proxy itself is returned from that resource instead.
>
> I think, maybe the last lines of CDOViewImpl.provideCDOID(Object)
> should be modified:
>
> Now:
> (...)
> if (eObject.eResource() != null)
> {
> return CDOIDUtil.createExternal(uri);
> }
> throw new DanglingReferenceException(eObject);
>
> Suggestion:
> if ((eObject.eResource() != null) || eObject.isProxy())
> {
> return CDOIDUtil.createExternal(uri);
> }
> throw new DanglingReferenceException(eObject);
>
> Mario
>
>
>
> Víctor Roldán Betancort schrieb:
>> Hi Mario,
>>
>> I believe external proxies were actually supported in CDO. I would
>> say it is a bug... maybe the others can clarify.
>>
>> Could you reference that object instead of manually setting the proxy
>> URI and see what happens?
>>
>> I'll try to create a test case anyway to try to reproduce your problem.
>>
>> I think Eike is at the Modeling Days so he isn't showing around, but
>> he will jump in as the trip finishes ;)
>>
>> Cheers,
>> Víctor.
>>
>> Mario Winterer escribió:
>>> Hi!
>>>
>>> I'm currenty experiencing problems concerning references from cdo
>>> objects to external (non-cdo) proxies.
>>>
>>> What I'd like to do is to set a reference from a cdo object to an
>>> external (non-cdo) object. But as the object graph of the external
>>> object is rather large, and I do not have an instance of that object
>>> (I'd have to load it from another, non-loaded resource first), I
>>> only want to create a proxy manually (I know the object's uri) and
>>> simply set the proxy.
>>>
>>> The problem is that when I commit the transaction, CDO throws a
>>> DanglingReferenceException because the external proxy is not
>>> contained in a resource, which seems strange as proxies are never
>>> contained in any resource.
>>>
>>> The last part of the StackTrace:
>>> org.eclipse.emf.cdo.util.DanglingReferenceException: The object
>>> "com.dgr.profi.offert.impl.OffertKopfImpl@1494cc8 (eProxyURI:
>>> profi://laspalmas:1099/Offert?id=193#/)(com.dgr.profi.offert.impl.OffertKopfImpl)"
>>> is not contained in a resource
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.provideCDOID(C DOViewImpl.java:922)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. writeValues(AbstractCDORevision.java:653)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. write(AbstractCDORevision.java:168)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl.wri teCDORevision(CDODataOutputImpl.java:160)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.writeRevisions(CommitTransactionRequest.java:307)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.requestingCommit(CommitTransactionRequest.java:209)
>>>
>>>
>>>
>>> Is this a bug or simply a limitation?
>>>
>>>
>>> Mario
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Support for external proxies [message #499015 is a reply to message #499005] |
Thu, 19 November 2009 14:32 |
Mario Winterer Messages: 136 Registered: July 2009 |
Senior Member |
|
|
Thanks Eike.
I've filed bug #295590
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=295590)
Mario
Eike Stepper schrieb:
> Hi Mario,
>
> To me that sounds reasonable and I'll further clarify this with Ed. Can
> you please file a bugzilla?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Mario Winterer schrieb:
>> Victor,
>>
>> thanks for your response.
>>
>> I've tried two possible scenarios:
>> (1) Manual proxy without resource
>>
>> a) Create new shallow instance that represents the external object
>> b) Set the proxy URI
>> c) Add the object to a CDOObject (so the CDOObject references the
>> external object after this step)
>> d) Commit the transaction.
>>
>> Result: DanglingHrefException, saying the external object is not
>> contained in any resource (which seems wrong as a proxy should never
>> be contained in any resource).
>>
>> (2) Manual proxy contained in a resource
>>
>> a) Create a new resource and add it to the CDOTransaction's ResourcSet
>> b) Create new shallow instance that represents the external object
>> c) Set the proxy URI
>> d) Add the object to the contents of the newly created resource
>> e) Add the object to a CDOObject (so the CDOObject references the
>> external object after this step)
>> f) Commit the transaction.
>>
>> Result: Changes are saved. If the proxy is navigated afterwards, proxy
>> resolution is performed but does not change anything, because the
>> proxy resolution mechanism simply loads the external resource using
>> the proxy URI. But because this resource is already loaded (it is the
>> resource that was created in step a), no additional loading takes
>> place and the proxy itself is returned from that resource instead.
>>
>> I think, maybe the last lines of CDOViewImpl.provideCDOID(Object)
>> should be modified:
>>
>> Now:
>> (...)
>> if (eObject.eResource() != null)
>> {
>> return CDOIDUtil.createExternal(uri);
>> }
>> throw new DanglingReferenceException(eObject);
>>
>> Suggestion:
>> if ((eObject.eResource() != null) || eObject.isProxy())
>> {
>> return CDOIDUtil.createExternal(uri);
>> }
>> throw new DanglingReferenceException(eObject);
>>
>> Mario
>>
>>
>>
>> Víctor Roldán Betancort schrieb:
>>> Hi Mario,
>>>
>>> I believe external proxies were actually supported in CDO. I would
>>> say it is a bug... maybe the others can clarify.
>>>
>>> Could you reference that object instead of manually setting the proxy
>>> URI and see what happens?
>>>
>>> I'll try to create a test case anyway to try to reproduce your problem.
>>>
>>> I think Eike is at the Modeling Days so he isn't showing around, but
>>> he will jump in as the trip finishes ;)
>>>
>>> Cheers,
>>> Víctor.
>>>
>>> Mario Winterer escribió:
>>>> Hi!
>>>>
>>>> I'm currenty experiencing problems concerning references from cdo
>>>> objects to external (non-cdo) proxies.
>>>>
>>>> What I'd like to do is to set a reference from a cdo object to an
>>>> external (non-cdo) object. But as the object graph of the external
>>>> object is rather large, and I do not have an instance of that object
>>>> (I'd have to load it from another, non-loaded resource first), I
>>>> only want to create a proxy manually (I know the object's uri) and
>>>> simply set the proxy.
>>>>
>>>> The problem is that when I commit the transaction, CDO throws a
>>>> DanglingReferenceException because the external proxy is not
>>>> contained in a resource, which seems strange as proxies are never
>>>> contained in any resource.
>>>>
>>>> The last part of the StackTrace:
>>>> org.eclipse.emf.cdo.util.DanglingReferenceException: The object
>>>> "com.dgr.profi.offert.impl.OffertKopfImpl@1494cc8 (eProxyURI:
>>>> profi://laspalmas:1099/Offert?id=193#/)(com.dgr.profi.offert.impl.OffertKopfImpl)"
>>>> is not contained in a resource
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.provideCDOID(C DOViewImpl.java:922)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. writeValues(AbstractCDORevision.java:653)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. write(AbstractCDORevision.java:168)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl.wri teCDORevision(CDODataOutputImpl.java:160)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.writeRevisions(CommitTransactionRequest.java:307)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.requestingCommit(CommitTransactionRequest.java:209)
>>>>
>>>>
>>>>
>>>> Is this a bug or simply a limitation?
>>>>
>>>>
>>>> Mario
|
|
|
Re: [CDO] Support for external proxies [message #499016 is a reply to message #498978] |
Thu, 19 November 2009 14:35 |
Victor Roldan Betancort Messages: 524 Registered: July 2009 |
Senior Member |
|
|
Hi Mario,
thanks for your deep analysis. By looking at the current code and the
two scenarios that you described, I would you've identified a bug :P
Could you please submit a new bug for this? The description you provided
should be enough :D You can also provide a patch if you want. I'll try
to execute the whole test-suite to see if things keep working as
expected with your change proposal.
Thanks!
Víctor.
Mario Winterer escribió:
> Victor,
>
> thanks for your response.
>
> I've tried two possible scenarios:
> (1) Manual proxy without resource
>
> a) Create new shallow instance that represents the external object
> b) Set the proxy URI
> c) Add the object to a CDOObject (so the CDOObject references the
> external object after this step)
> d) Commit the transaction.
>
> Result: DanglingHrefException, saying the external object is not
> contained in any resource (which seems wrong as a proxy should never be
> contained in any resource).
>
> (2) Manual proxy contained in a resource
>
> a) Create a new resource and add it to the CDOTransaction's ResourcSet
> b) Create new shallow instance that represents the external object
> c) Set the proxy URI
> d) Add the object to the contents of the newly created resource
> e) Add the object to a CDOObject (so the CDOObject references the
> external object after this step)
> f) Commit the transaction.
>
> Result: Changes are saved. If the proxy is navigated afterwards, proxy
> resolution is performed but does not change anything, because the proxy
> resolution mechanism simply loads the external resource using the proxy
> URI. But because this resource is already loaded (it is the resource
> that was created in step a), no additional loading takes place and the
> proxy itself is returned from that resource instead.
>
> I think, maybe the last lines of CDOViewImpl.provideCDOID(Object) should
> be modified:
>
> Now:
> (...)
> if (eObject.eResource() != null)
> {
> return CDOIDUtil.createExternal(uri);
> }
> throw new DanglingReferenceException(eObject);
>
> Suggestion:
> if ((eObject.eResource() != null) || eObject.isProxy())
> {
> return CDOIDUtil.createExternal(uri);
> }
> throw new DanglingReferenceException(eObject);
>
> Mario
>
>
>
> Víctor Roldán Betancort schrieb:
>> Hi Mario,
>>
>> I believe external proxies were actually supported in CDO. I would say
>> it is a bug... maybe the others can clarify.
>>
>> Could you reference that object instead of manually setting the proxy
>> URI and see what happens?
>>
>> I'll try to create a test case anyway to try to reproduce your problem.
>>
>> I think Eike is at the Modeling Days so he isn't showing around, but
>> he will jump in as the trip finishes ;)
>>
>> Cheers,
>> Víctor.
>>
>> Mario Winterer escribió:
>>> Hi!
>>>
>>> I'm currenty experiencing problems concerning references from cdo
>>> objects to external (non-cdo) proxies.
>>>
>>> What I'd like to do is to set a reference from a cdo object to an
>>> external (non-cdo) object. But as the object graph of the external
>>> object is rather large, and I do not have an instance of that object
>>> (I'd have to load it from another, non-loaded resource first), I only
>>> want to create a proxy manually (I know the object's uri) and simply
>>> set the proxy.
>>>
>>> The problem is that when I commit the transaction, CDO throws a
>>> DanglingReferenceException because the external proxy is not
>>> contained in a resource, which seems strange as proxies are never
>>> contained in any resource.
>>>
>>> The last part of the StackTrace:
>>> org.eclipse.emf.cdo.util.DanglingReferenceException: The object
>>> "com.dgr.profi.offert.impl.OffertKopfImpl@1494cc8 (eProxyURI:
>>> profi://laspalmas:1099/Offert?id=193#/)(com.dgr.profi.offert.impl.OffertKopfImpl)"
>>> is not contained in a resource
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.provideCDOID(C DOViewImpl.java:922)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. writeValues(AbstractCDORevision.java:653)
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. write(AbstractCDORevision.java:168)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl.wri teCDORevision(CDODataOutputImpl.java:160)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.writeRevisions(CommitTransactionRequest.java:307)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.requestingCommit(CommitTransactionRequest.java:209)
>>>
>>>
>>>
>>> Is this a bug or simply a limitation?
>>>
>>>
>>> Mario
|
|
|
Re: [CDO] Support for external proxies [message #499017 is a reply to message #499006] |
Thu, 19 November 2009 14:40 |
Mario Winterer Messages: 136 Registered: July 2009 |
Senior Member |
|
|
I've attached a patch to bug 295590
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=295590)
Mario
Eike Stepper schrieb:
> Hi Mario,
>
> Your fix is good. Please file a bugzilla.
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Mario Winterer schrieb:
>> Victor,
>>
>> thanks for your response.
>>
>> I've tried two possible scenarios:
>> (1) Manual proxy without resource
>>
>> a) Create new shallow instance that represents the external object
>> b) Set the proxy URI
>> c) Add the object to a CDOObject (so the CDOObject references the
>> external object after this step)
>> d) Commit the transaction.
>>
>> Result: DanglingHrefException, saying the external object is not
>> contained in any resource (which seems wrong as a proxy should never
>> be contained in any resource).
>>
>> (2) Manual proxy contained in a resource
>>
>> a) Create a new resource and add it to the CDOTransaction's ResourcSet
>> b) Create new shallow instance that represents the external object
>> c) Set the proxy URI
>> d) Add the object to the contents of the newly created resource
>> e) Add the object to a CDOObject (so the CDOObject references the
>> external object after this step)
>> f) Commit the transaction.
>>
>> Result: Changes are saved. If the proxy is navigated afterwards, proxy
>> resolution is performed but does not change anything, because the
>> proxy resolution mechanism simply loads the external resource using
>> the proxy URI. But because this resource is already loaded (it is the
>> resource that was created in step a), no additional loading takes
>> place and the proxy itself is returned from that resource instead.
>>
>> I think, maybe the last lines of CDOViewImpl.provideCDOID(Object)
>> should be modified:
>>
>> Now:
>> (...)
>> if (eObject.eResource() != null)
>> {
>> return CDOIDUtil.createExternal(uri);
>> }
>> throw new DanglingReferenceException(eObject);
>>
>> Suggestion:
>> if ((eObject.eResource() != null) || eObject.isProxy())
>> {
>> return CDOIDUtil.createExternal(uri);
>> }
>> throw new DanglingReferenceException(eObject);
>>
>> Mario
>>
>>
>>
>> Víctor Roldán Betancort schrieb:
>>> Hi Mario,
>>>
>>> I believe external proxies were actually supported in CDO. I would
>>> say it is a bug... maybe the others can clarify.
>>>
>>> Could you reference that object instead of manually setting the proxy
>>> URI and see what happens?
>>>
>>> I'll try to create a test case anyway to try to reproduce your problem.
>>>
>>> I think Eike is at the Modeling Days so he isn't showing around, but
>>> he will jump in as the trip finishes ;)
>>>
>>> Cheers,
>>> Víctor.
>>>
>>> Mario Winterer escribió:
>>>> Hi!
>>>>
>>>> I'm currenty experiencing problems concerning references from cdo
>>>> objects to external (non-cdo) proxies.
>>>>
>>>> What I'd like to do is to set a reference from a cdo object to an
>>>> external (non-cdo) object. But as the object graph of the external
>>>> object is rather large, and I do not have an instance of that object
>>>> (I'd have to load it from another, non-loaded resource first), I
>>>> only want to create a proxy manually (I know the object's uri) and
>>>> simply set the proxy.
>>>>
>>>> The problem is that when I commit the transaction, CDO throws a
>>>> DanglingReferenceException because the external proxy is not
>>>> contained in a resource, which seems strange as proxies are never
>>>> contained in any resource.
>>>>
>>>> The last part of the StackTrace:
>>>> org.eclipse.emf.cdo.util.DanglingReferenceException: The object
>>>> "com.dgr.profi.offert.impl.OffertKopfImpl@1494cc8 (eProxyURI:
>>>> profi://laspalmas:1099/Offert?id=193#/)(com.dgr.profi.offert.impl.OffertKopfImpl)"
>>>> is not contained in a resource
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.provideCDOID(C DOViewImpl.java:922)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. writeValues(AbstractCDORevision.java:653)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision. write(AbstractCDORevision.java:168)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl.wri teCDORevision(CDODataOutputImpl.java:160)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.writeRevisions(CommitTransactionRequest.java:307)
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactio nRequest.requestingCommit(CommitTransactionRequest.java:209)
>>>>
>>>>
>>>>
>>>> Is this a bug or simply a limitation?
>>>>
>>>>
>>>> Mario
|
|
|
Goto Forum:
Current Time: Thu Apr 25 22:51:37 GMT 2024
Powered by FUDForum. Page generated in 0.03662 seconds
|