How to customize EMF URIs for references [message #1061726] |
Mon, 03 June 2013 15:25 |
|
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 #1061801 is a reply to message #1061729] |
Tue, 04 June 2013 07:22 |
|
Thanks for your fast reply.
Please see comments below.
Ed Merks wrote on Mon, 03 June 2013 17:39Tommaso,
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 |
Ed Merks 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 |
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03701 seconds