Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Resource factory not found by normalized URI?
Resource factory not found by normalized URI? [message #628776] Fri, 24 September 2010 06:00 Go to next message
Bryan Hunt is currently offline Bryan HuntFriend
Messages: 366
Registered: July 2009
Senior Member
Hi Ed,

I have a model stored in a file as XMI. I have registered a URI mapping with a URIConverter that changes the scheme from http: to file: and I also have a (non XMI) resource factory registered with the http scheme.

In my test code, when I try to load a resource that has a URI with the http scheme, EMF uses my resource factory instead of the XMIResourceFactoryImpl. It's obvious from the EMF source that when the resource is demand created, it uses the original URI to look up the resource factory instead of the normalized URI. I was expecting it to use the normalized URI.

Here's the use case: A client has a URI for an object in the form http://host:port/path. The client has a custom resource to send
the URI to the server which normalizes it into file://path, reads the XMI, and returns the object to the client.

What is the reasoning for using the original URI to locate a resource factory instead of the normalized URI? Any suggestions on working around this problem? I thought about moving the registration of the resource factory to a different bundle, but that wouldn't work in all cases.

Bryan
Re: Resource factory not found by normalized URI? [message #628926 is a reply to message #628776] Fri, 24 September 2010 18:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Bryan,

The idea is that the original URI is the logical URI. It should be the
URI of the resource that's created and will be the URI that is used for
references to objects in that resource.

You could specialize ResourceSetImpl.createResource if you want
different behavior.


Bryan Hunt wrote:
> Hi Ed,
>
> I have a model stored in a file as XMI. I have registered a URI
> mapping with a URIConverter that changes the scheme from http: to
> file: and I also have a (non XMI) resource factory registered with the
> http scheme.
> In my test code, when I try to load a resource that has a URI with the
> http scheme, EMF uses my resource factory instead of the
> XMIResourceFactoryImpl. It's obvious from the EMF source that when
> the resource is demand created, it uses the original URI to look up
> the resource factory instead of the normalized URI. I was expecting
> it to use the normalized URI.
> Here's the use case: A client has a URI for an object in the form
> http://host:port/path The client has a custom resource to send
> the URI to the server which normalizes it into file://path, reads the
> XMI, and returns the object to the client.
>
> What is the reasoning for using the original URI to locate a resource
> factory instead of the normalized URI? Any suggestions on working
> around this problem? I thought about moving the registration of the
> resource factory to a different bundle, but that wouldn't work in all
> cases.
>
> Bryan


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Using EMF generated objects with easyb and Groovy
Next Topic:[CDO / Net4j]Connection Problems
Goto Forum:
  


Current Time: Fri Apr 26 08:21:09 GMT 2024

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

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

Back to the top