Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to customize EMF URIs for references
How to customize EMF URIs for references [message #1061726] Mon, 03 June 2013 15:25 Go to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

Hello everyone,
I need to change URIs (for references between resources) persisted in XMI file. I have to use custom URIConverter, right?

But how can I change what will be written in file with my protocol?

myprotocol://myremoterepository/myfile


And where can I menage this URI to retrieve the object?

Very thank you.
Re: How to customize EMF URIs for references [message #1061729 is a reply to message #1061726] Mon, 03 June 2013 15:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Tommaso,

Comments below.

On 03/06/2013 5:25 PM, Tommaso De Sica wrote:
> Hello everyone,
> I need to change URIs (for references between resources) persisted in
> XMI file. I have to use custom URIConverter, right?
Probably not...
>
> But how can I change what will be written in file with my protocol?
Generally you could give each of your resources the logical URI you want
to see in the serialized reference and those will be used. You can use
the URI converter's URI mappings to redirect such logical URIs to
physical locations.
>
> myprotocol://myremoterepository/myfile
Have you done anything to be able to load from or save to such a URI?
>
> And where can I menage this URI to retrieve the object?
Probably you need to give a bit more background about what you're trying
to achieve.
>
> Very thank you.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to customize EMF URIs for references [message #1061801 is a reply to message #1061729] Tue, 04 June 2013 07:22 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

Thanks for your fast reply.
Please see comments below.

Ed Merks wrote on Mon, 03 June 2013 17:39
Tommaso,

Comments below.

On 03/06/2013 5:25 PM, Tommaso De Sica wrote:
> Hello everyone,
> I need to change URIs (for references between resources) persisted in
> XMI file. I have to use custom URIConverter, right?
Probably not...
>
> But how can I change what will be written in file with my protocol?
Generally you could give each of your resources the logical URI you want
to see in the serialized reference and those will be used.


As resource URI?

Ed Merks wrote on Mon, 03 June 2013 17:39
You can use
the URI converter's URI mappings to redirect such logical URIs to
physical locations.


My URIConverter should only override normalize method to convert my logical URI or somthing else?

Ed Merks wrote on Mon, 03 June 2013 17:39

>
> myprotocol://myremoterepository/myfile
Have you done anything to be able to load from or save to such a URI?
>
> And where can I menage this URI to retrieve the object?
Probably you need to give a bit more background about what you're trying
to achieve.


This is what I have to do: my references have logical URI. When I try to resolve a proxy I have to check if the corrispondent file is available locally, otherwise I've to download it from Git repository and return it. Manager for this is ready, I'm not sure where I have to use this manager. Maybe an URIHandler?
Re: How to customize EMF URIs for references [message #1061803 is a reply to message #1061801] Tue, 04 June 2013 07:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Tommaso,

Comments below.

On 04/06/2013 9:22 AM, Tommaso De Sica wrote:
> Thanks for your fast reply.
> Please see comments below.
>
> Ed Merks wrote on Mon, 03 June 2013 17:39
>> Tommaso,
>>
>> Comments below.
>>
>> On 03/06/2013 5:25 PM, Tommaso De Sica wrote:
>> > Hello everyone,
>> > I need to change URIs (for references between resources) persisted
>> in > XMI file. I have to use custom URIConverter, right?
>> Probably not...
>> >
>> > But how can I change what will be written in file with my protocol?
>> Generally you could give each of your resources the logical URI you
>> want to see in the serialized reference and those will be used.
>
>
> As resource URI?
Resource.setURI.
>
> Ed Merks wrote on Mon, 03 June 2013 17:39
>> You can use the URI converter's URI mappings to redirect such logical
>> URIs to physical locations.
>
>
> My URIConverter should only override normalize method to convert my
> logical URI or somthing else?
URIConverter.getURIMap(). That map is used to do normalization.
>
> Ed Merks wrote on Mon, 03 June 2013 17:39
>> >
>> > myprotocol://myremoterepository/myfile
>> Have you done anything to be able to load from or save to such a URI?
>> >
>> > And where can I menage this URI to retrieve the object?
>> Probably you need to give a bit more background about what you're
>> trying to achieve.
>
>
> This is what I have to do: my references have logical URI. When I try
> to resolve a proxy I have to check if the corrispondent file is
> available locally, otherwise I've to download it from Git repository
> and return it. Manager for this is ready, I'm not sure where I have to
> use this manager. Maybe an URIHandler?
Maybe a URI handler. You can look at how other ones are implemented,
e.g, FileURIHandlerImpl.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to customize EMF URIs for references [message #1061890 is a reply to message #1061803] Tue, 04 June 2013 14:27 Go to previous message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

I've written MyURIConverter and MyURIHandler and used my logical URIs for Resources and everything goes right.
Very thank you Merks.

Last difficult question: now all references follow my uri protocol. Is there a way to choose which URI (file or My) persist in a reference?
I still want that all resources has my logical URI, but sometimes references have to use physical file URI.

Thanks again.
Previous Topic:[CDO] CDOTransaction or CDOXATransaction participating in XA transaction
Next Topic:[EMF Compare] Graphical Representation (solved)
Goto Forum:
  


Current Time: Fri Mar 29 00:48:30 GMT 2024

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

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

Back to the top