|Proxy Resolution among Resources [message #1008731]
||Wed, 13 February 2013 13:31
| Markus Riedl
Registered: November 2012
I'm sorry if this was asked somewhere before (and I'm pretty sure it was) but I searched and didn't find a good answer.
Two resources A and B, the modelelement of resource A contains a reference to the modelelement defined in resource B. But both are in the same ResourceSet.
Loading them leads to a proxy-reference in A to the element in B. Normally it should be the case ('Resolve Proxies = true' for this reference) that the proxy is resolved at the time I access the reference or at least if I force it with EcoreUtil.resolve(..)
Neither one works.
The modelelement B is loaded and in the same resource set, even if I make sure that the "correct" order is executed (B before A) it can't be resolved...
What do I miss any ideas, hints which could help me?
|Re: Proxy Resolution among Resources [message #1008901 is a reply to message #1008783]
||Thu, 14 February 2013 00:04
| Ed Merks
Registered: July 2009
Note that even an absolute file URI could be problematic if the
underlying file path itself isn't an absolute file system path.
When an attempt to resolve a proxy occurs, ResourceSet.getEObject will
be called with the proxy's URI. This will call ResourceSet.getResource
with the URI with the fragment trimmed. So your resource set will
definitely contain a resource with the URI [abspathtoresourceA], if
proxy resolution is attempted. That could fail to load for some reason,
but the cause of the failure will be recorded in Resource.getErrors.
Assuming it loads properly, Resource.getEObject will be called with the
fragment. If the resource is able to find the object with that
fragment, it will be returned and all will work well; if it returns
null, the proxy will fail to resolve. So, somewhere along this path,
something is failing for you. Setting breakpoints in
ResourceSetImpl.getResource and ResourceImpl.getEObject should help you
track down what's going wrong in your scenario.
On 13/02/2013 9:58 PM, Markus Riedl wrote:
> The URI's are absolute and the URI - kind is fileURI. In my case there
> is no XML, "I" parse a file into ECore-Representation, nonetheless the
> proxies should resolve ... the proxy - uri looks like:
> [abspathtoresourceA]#EMFTEXT_INTERNAL_URI_FRAGMENT_0_A, if this gives
> you some hint
Powered by FUDForum
. Page generated in 0.01735 seconds