Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Using the URI Converter
Using the URI Converter [message #415533] Thu, 20 December 2007 00:34 Go to next message
Vikram is currently offline VikramFriend
Messages: 17
Registered: July 2009
Junior Member
Hi,
I am trying to load a resource and them update the references that have been
renamed.

Here are the steps:

/// Code snippet
ResourceSet rset = loadedResource.eResource().getResourceSet();

URIConverter converter = rset.getURIConverter();

converter.getURIMap().put(oldURI, newURI);

EcoreUtil.resolveAll(rset);

save(loadedResource);

///////

No error is being generated, however, when I open the loadedResource, it
still has the old references.

Thanks,

Vikram
Re: Using the URI Converter [message #415543 is a reply to message #415533] Thu, 20 December 2007 13:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040408040208000803020402
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Vikram,

The thread from "Inhibiting EMF Lazy Loading For Manual Proxy URI
Update" a few notes up is dealing with the same issue. As explained
there, the reference to an object in a resource always uses
eObject.eResource().getURI() as the URI, so while a URI mapping can be
used to redirect where the input stream for the URI is located, it
doesn't affect the form in which references are saved. For that, the
resource's URI is always considered the logical URI and will be used
directly. So to rename a resource you must literally rename the
resource (or load it directly with the new renamed URI *before *using it
to resolve references to the old URI).


Vikram wrote:
> Hi,
> I am trying to load a resource and them update the references that have been
> renamed.
>
> Here are the steps:
>
> /// Code snippet
> ResourceSet rset = loadedResource.eResource().getResourceSet();
>
> URIConverter converter = rset.getURIConverter();
>
> converter.getURIMap().put(oldURI, newURI);
>
> EcoreUtil.resolveAll(rset);
>
> save(loadedResource);
>
> ///////
>
> No error is being generated, however, when I open the loadedResource, it
> still has the old references.
>
> Thanks,
>
> Vikram
>
>
>
>
>
>
>


--------------040408040208000803020402
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">
Vikram,<br>
<br>
The thread from "Inhibiting EMF Lazy Loading For Manual Proxy URI
Update" a few notes up is dealing with the same issue.&nbsp; As explained
there, the reference to an object in a resource always uses
eObject.eResource().getURI() as the URI, so while a URI mapping can be
used to redirect where the input stream for the URI is located, it
doesn't affect the form in which references are saved.&nbsp; For that, the
resource's URI is always considered the logical URI and will be used
directly.&nbsp; So to rename a resource you must literally rename the
resource (or load it directly with the new renamed URI <b>before </b>using
it to resolve references to the old URI).<br>
<br>
<br>
Vikram wrote:
<blockquote cite="mid:fkcdaf$9ae$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,
I am trying to load a resource and them update the references that have been
renamed.

Here are the steps:

/// Code snippet
ResourceSet rset = loadedResource.eResource().getResourceSet();

URIConverter converter = rset.getURIConverter();

converter.getURIMap().put(oldURI, newURI);

EcoreUtil.resolveAll(rset);

save(loadedResource);

///////

No error is being generated, however, when I open the loadedResource, it
still has the old references.

Thanks,

Vikram






</pre>
</blockquote>
<br>
</body>
</html>

--------------040408040208000803020402--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using the URI Converter [message #415576 is a reply to message #415543] Thu, 20 December 2007 17:19 Go to previous message
Vikram is currently offline VikramFriend
Messages: 17
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0036_01C84302.916B67F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Ed,
Thanks for your help.=20
Vikram

"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fkdq1i$nki$1@build.eclipse.org...
Vikram,

The thread from "Inhibiting EMF Lazy Loading For Manual Proxy URI =
Update" a few notes up is dealing with the same issue. As explained =
there, the reference to an object in a resource always uses =
eObject.eResource().getURI() as the URI, so while a URI mapping can be =
used to redirect where the input stream for the URI is located, it =
doesn't affect the form in which references are saved. For that, the =
resource's URI is always considered the logical URI and will be used =
directly. So to rename a resource you must literally rename the =
resource (or load it directly with the new renamed URI before using it =
to resolve references to the old URI).


Vikram wrote:=20
Hi,
I am trying to load a resource and them update the references that have =
been=20
renamed.

Here are the steps:

/// Code snippet
ResourceSet rset =3D loadedResource.eResource().getResourceSet();

URIConverter converter =3D rset.getURIConverter();

converter.getURIMap().put(oldURI, newURI);

EcoreUtil.resolveAll(rset);

save(loadedResource);

///////

No error is being generated, however, when I open the loadedResource, it =

still has the old references.

Thanks,

Vikram






=20

------=_NextPart_000_0036_01C84302.916B67F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.3243" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for your help. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Vikram</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fkdq1i$nki$1@build.eclipse.org">news:fkdq1i$nki$1@build.ecli=
pse.org</A>...</DIV>Vikram,<BR><BR>The=20
thread from "Inhibiting EMF Lazy Loading For Manual Proxy URI Update" =
a few=20
notes up is dealing with the same issue.&nbsp; As explained there, the =

reference to an object in a resource always uses =
eObject.eResource().getURI()=20
as the URI, so while a URI mapping can be used to redirect where the =
input=20
stream for the URI is located, it doesn't affect the form in which =
references=20
are saved.&nbsp; For that, the resource's URI is always considered the =
logical=20
URI and will be used directly.&nbsp; So to rename a resource you must=20
literally rename the resource (or load it directly with the new =
renamed URI=20
<B>before </B>using it to resolve references to the old=20
URI).<BR><BR><BR>Vikram wrote:=20
<BLOCKQUOTE cite=3Dmid:fkcdaf$9ae$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi,
I am trying to load a resource and them update the references that have =
been=20
renamed.

Here are the steps:

/// Code snippet
ResourceSet rset =3D loadedResource.eResource().getResourceSet();

URIConverter converter =3D rset.getURIConverter();

converter.getURIMap().put(oldURI, newURI);

EcoreUtil.resolveAll(rset);

save(loadedResource);

///////

No error is being generated, however, when I open the loadedResource, it =

still has the old references.

Thanks,

Vikram






</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0036_01C84302.916B67F0--
Previous Topic:what's the adapter factory for?
Next Topic:EMF examples
Goto Forum:
  


Current Time: Thu Apr 25 16:07:36 GMT 2024

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

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

Back to the top