Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Resolve proxy URI always file URI?
Resolve proxy URI always file URI? [message #427537] Fri, 20 February 2009 14:31 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
I am pushing my luck for today with one more questions.
I have the following situation;

Model A is stored in a DB with Teneo/Hibernate. I use an extension
called .modelA to trigger an Hibernate Resource, with
HibernateResourceFactory.


Model B is stored in a file. B has references to various elements in
model A.

I create a new Model B, and use "load resource" to load an existing
Model A.

I set references from B to A, and the URI when serialized in B looks
like this:


<networkNodes xmi:type="networkplan:NetworkNode"
xmi:id="_usPVUP7NEd2l0_eU-RB3cA">
<node xmi:type="networkdata:Node" href="sample.modelA#Node|id=9"/>
</networkNodes>


So the URI for the Hibernate resource is "sample.modelA#Node|id=9"

Now when I re-open my Model B, and automatic proxy resolv kicks in,
the URI "sample.modelA" is interpreted as "file://user home
path/sample.modelA. It opens the correct resource, but the URI is
converted in a file URI, which is not what I expected.

So:
- Would it perhaps make more sense to use a URI in the form as described
on the elver site?

String uriStr = "hibernate://?" + HibernateResource.DS_NAME_PARAM + "=MySF";


If I do so, what do I put in the extension parser?

<extension point="org.eclipse.emf.ecore.extension_parser">
<parser
type="modelA"

class=" org.eclipse.emf.teneo.hibernate.resource.HibernateResourceFa ctory "/>
</extension>



Any advise is most welcome.

Thanks Christophe
Re: Resolve proxy URI always file URI? [message #427538 is a reply to message #427537] Fri, 20 February 2009 14:48 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020304070603030505080708
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christophe,

Comments below.

Christophe Bouhier wrote:
> I am pushing my luck for today with one more questions.
You're in luck.
> I have the following situation;
>
> Model A is stored in a DB with Teneo/Hibernate. I use an extension
> called .modelA to trigger an Hibernate Resource, with
> HibernateResourceFactory.
>
>
> Model B is stored in a file. B has references to various elements in
> model A.
>
> I create a new Model B, and use "load resource" to load an existing
> Model A.
>
> I set references from B to A, and the URI when serialized in B looks
> like this:
>
>
> <networkNodes xmi:type="networkplan:NetworkNode"
> xmi:id="_usPVUP7NEd2l0_eU-RB3cA">
> <node xmi:type="networkdata:Node"
> href="sample.modelA#Node|id=9"/>
> </networkNodes>
>
>
> So the URI for the Hibernate resource is "sample.modelA#Node|id=9"
>
> Now when I re-open my Model B, and automatic proxy resolv kicks in,
> the URI "sample.modelA" is interpreted as "file://user home
> path/sample.modelA. It opens the correct resource, but the URI is
> converted in a file URI, which is not what I expected.
This is why I always say always use absolute URIs for resources.

..An absolute URI starts with a scheme
--Always uses absolute URIs to identify resources!
--Relative URIs are useful within resources for referring to other
resources within the same authority
..This supports moving groups of related resources
--Examples of relative URIs
.. #id
.. ../directory/file.extension
.. file.extension


..Deresolving an absolute URI against a base absolute URI yields the URI
relative to that base
-- E.g., deresolving platform:/resource/a/foo.html against
platform:/resource/b/bar.html yields ../a/foo.html
..Resolving a relative URI against a base absolute URI yields the
absolute URI relative to that base
E.g., resolving ../a/foo.html against platform:/resource/b/bar.html
>
> So:
> - Would it perhaps make more sense to use a URI in the form as
> described on the elver site?
>
> String uriStr = "hibernate://?" + HibernateResource.DS_NAME_PARAM +
> "=MySF";
>
>
> If I do so, what do I put in the extension parser?
>
> <extension point="org.eclipse.emf.ecore.extension_parser">
> <parser
> type="modelA"
>
> class=" org.eclipse.emf.teneo.hibernate.resource.HibernateResourceFa ctory "/>
>
> </extension>
>
It sounds like you already have that. There's also a protocol_parser
you can register against hibernate I suppose...
>
>
> Any advise is most welcome.
>
> Thanks Christophe
>
>
>
>
>

--------------020304070603030505080708
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Christophe,<br>
<br>
Comments below.<br>
<br>
Christophe Bouhier wrote:
<blockquote cite="mid:gnmes3$88d$1@build.eclipse.org" type="cite">I am
pushing my luck for today with one more questions.
<br>
</blockquote>
You're in luck.<br>
<blockquote cite="mid:gnmes3$88d$1@build.eclipse.org" type="cite">I
have the following situation;
<br>
<br>
Model A is stored in a DB with Teneo/Hibernate. I use an extension
called .modelA to trigger an Hibernate Resource, with
HibernateResourceFactory.
<br>
<br>
<br>
Model B is stored in a file. B has references to various elements in
model A.
<br>
<br>
I create a new Model B, and use "load resource" to load an existing
Model A.
<br>
<br>
I set references from B to A, and the URI when serialized in B looks
like this:
<br>
<br>
<br>
&lt;networkNodes xmi:type="networkplan:NetworkNode"
xmi:id="_usPVUP7NEd2l0_eU-RB3cA"&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;node xmi:type="networkdata:Node"
href="sample.modelA#Node|id=9"/&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/networkNodes&gt;
<br>
<br>
<br>
So the URI for the Hibernate resource is "sample.modelA#Node|id=9"
<br>
<br>
Now when I re-open my Model B, and automatic proxy resolv kicks in,
<br>
the URI "sample.modelA" is interpreted as "<a class="moz-txt-link-freetext" href="file://user">file://user</a> home
path/sample.modelA. It opens the correct resource, but the URI is
converted in a file URI, which is not what I expected.
<br>
</blockquote>
This is why I always say always use absolute URIs for resources.&nbsp; <br>
<br>
<div
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in;"><span
style="font-size: 28pt;"><span style="">&#8226;</span></span><span
style="font-size: 28pt; font-family: Corbel;">An absolute URI starts
with a scheme</span></div>
<div class="O1"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0.81in; text-indent: -0.31in;"><span
style="font-size: 24pt;"><span style="">&#8211;</span></span><span
style="font-size: 24pt; font-family: Corbel; font-weight: bold;">Always</span><span
style="font-size: 24pt; font-family: Corbel;"> uses absolute
URIs to identify resources!</span></div>
<div class="O1"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0.81in; text-indent: -0.31in;"><span
style="font-size: 24pt;"><span style="">&#8211;</span></span><span
style="font-size: 24pt; font-family: Corbel;">Relative URIs are useful
within resources for referring to
other resources within the same authority</span></div>
<div class="O2"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 1.25in; text-indent: -0.25in;"><span
style="font-size: 24pt;"><span style="">&#8226;</span></span><span
style="font-size: 24pt; font-family: Corbel;">This supports moving
groups of related resources</span></div>
<div class="O1"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0.81in; text-indent: -0.31in;"><span
style="font-size: 24pt;"><span style="">&#8211;</span></span><span
style="font-size: 24pt; font-family: Corbel;">Examples of relative URIs</span></div>
<div class="O2"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 1.25in; text-indent: -0.25in;"><span
style="font-size: 20pt;"><span style="">&#8226;</span></span><span
style="font-size: 20pt; font-family: Corbel;"> </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(119, 147, 60);">#id</span></div>
<div class="O2"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 1.25in; text-indent: -0.25in;"><span
style="font-size: 20pt;"><span style="">&#8226;</span></span><span
style="font-size: 20pt; font-family: Corbel;"> </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">../directory/</span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">file.extension</span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">
</span></div>
<div class="O2"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 1.25in; text-indent: -0.25in;"><span
style="font-size: 20pt;"><span style="">&#8226;</span></span><span
style="font-size: 20pt; font-family: Corbel;"> </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">file.extension</span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">
</span></div>
<br>
<br>
<div
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in;"><span
style="font-size: 28pt;"><span style="">&#8226;</span></span><span
style="font-size: 28pt; font-family: Corbel;">Deresolving</span><span
style="font-size: 28pt; font-family: Corbel;"> an absolute URI against
a
base absolute URI yields the URI relative to that base</span></div>
<div class="O1"
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0.81in; text-indent: -0.31in;"><span
style="font-size: 24pt;"><span style="">&#8211;</span></span><span
style="font-size: 24pt; font-family: Corbel;"> E.g., </span><span
style="font-size: 24pt; font-family: Corbel;">deresolving</span><span
style="font-size: 24pt; font-family: Corbel;"> </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(192, 80, 77);">platform</span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">:/resource/a/foo.html
</span><span style="font-size: 24pt; font-family: Corbel;">against </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(192, 80, 77);">platform:</span><span
style="font-size: 20pt; font-family: Corbel;">/</span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">resource/b/bar.html
</span><span style="font-size: 24pt; font-family: Corbel;">yields </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">../a/foo.html</span><span
style="font-size: 24pt; font-family: Corbel; color: rgb(31, 73, 125);">
</span></div>
<div
style="margin-top: 0pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in;"><span
style="font-size: 28pt;"><span style="">&#8226;</span></span><span
style="font-size: 28pt; font-family: Corbel;">Resolving a relative URI
against a base absolute URI yields the
absolute URI relative to that base</span></div>
<span style="font-size: 24pt; font-family: Corbel;">E.g., resolving </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">../a/foo.html
</span><span style="font-size: 24pt; font-family: Corbel;">against </span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(192, 80, 77);">platform:</span><span
style="font-size: 20pt; font-family: Corbel;">/</span><span
style="font-size: 20pt; font-family: Corbel; color: rgb(31, 73, 125);">resource/b/bar.html
</span><br>
<blockquote cite="mid:gnmes3$88d$1@build.eclipse.org" type="cite"><br>
So:
<br>
- Would it perhaps make more sense to use a URI in the form as
described on the elver site?
<br>
<br>
String uriStr = "hibernate://?" + HibernateResource.DS_NAME_PARAM +
"=MySF";
<br>
<br>
<br>
If I do so, what do I put in the extension parser?
<br>
<br>
&nbsp;&lt;extension point="org.eclipse.emf.ecore.extension_parser"&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parser
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="modelA"
<br>
<br>
class=" org.eclipse.emf.teneo.hibernate.resource.HibernateResourceFa ctory "/&gt;
<br>
&nbsp;&nbsp; &lt;/extension&gt;
<br>
<br>
</blockquote>
It sounds like you already have that.&nbsp; There's also a protocol_parser
you can register against hibernate I suppose...<br>
<blockquote cite="mid:gnmes3$88d$1@build.eclipse.org" type="cite"><br>
<br>
Any advise is most welcome.
<br>
<br>
Thanks Christophe
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
</body>
</html>

--------------020304070603030505080708--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:hexbinary and Edit custom itemprovider for storing binaries(images)
Next Topic:EClass defined in ecore model not (always) loaded correctly
Goto Forum:
  


Current Time: Sat Apr 27 00:06:12 GMT 2024

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

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

Back to the top