Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Resolve platform:/resources outside the platform
Resolve platform:/resources outside the platform [message #1233693] Mon, 20 January 2014 09:47 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
Hi,

I have a case where I load a platform:/resource uri which contains
references to other platform:/resource models, but those models are not
available in the workspace, so when accessing these references, I get
proxy objects.

However, I have a way of locating those resources externally.

Is there a good way where I can hook into the resolution for
platform:/resource uris to import missing projects dynamically?
Re: Resolve platform:/resources outside the platform [message #1233714 is a reply to message #1233693] Mon, 20 January 2014 10:15 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
On 20/01/2014 10:47, Felix Dorner wrote:
> Hi,
>
> I have a case where I load a platform:/resource uri which contains
> references to other platform:/resource models, but those models are not
> available in the workspace, so when accessing these references, I get
> proxy objects.
>
> However, I have a way of locating those resources externally.
>
> Is there a good way where I can hook into the resolution for
> platform:/resource uris to import missing projects dynamically?

Maybe I don't even have to import the project.. If I look at

EcorePlugin.resolvePlatformResourcePath(String)
EcorePlugin.handlePlatformResourceOptions(String[])
EcorePlugin.getPlatformResourceMap()

these might be just perfect for me to use :)

Felix
Re: Resolve platform:/resources outside the platform [message #1233750 is a reply to message #1233693] Mon, 20 January 2014 12:00 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
HI

Within your own application you can play games with ResourceSet locators.

If you want your resolution to work more generally you can use a custom
ResourceFactory registered either for a custom file extension, or for a
custom scheme. OCL uses this approach to perform an autoconversion so
that an access to X.ecore.oclas wakes up the OCL Abstract Syntax
ResourceFactory which loads X.ecore and converts it to provide the
requested representation.

Regards

Ed Willink


On 20/01/2014 09:47, Felix Dorner wrote:
> Hi,
>
> I have a case where I load a platform:/resource uri which contains
> references to other platform:/resource models, but those models are
> not available in the workspace, so when accessing these references, I
> get proxy objects.
>
> However, I have a way of locating those resources externally.
>
> Is there a good way where I can hook into the resolution for
> platform:/resource uris to import missing projects dynamically?
>
>
Re: Resolve platform:/resources outside the platform [message #1233799 is a reply to message #1233714] Mon, 20 January 2014 14:07 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
On 20/01/2014 11:15, Felix Dorner wrote:
> Maybe I don't even have to import the project.. If I look at
>
> EcorePlugin.resolvePlatformResourcePath(String)
> EcorePlugin.handlePlatformResourceOptions(String[])
> EcorePlugin.getPlatformResourceMap()
>
> these might be just perfect for me to use :)

Or not. I hoped that the default URIHandler would use this map as a
fallback to open streams, even if the workbench is available; But it
only uses the map in "standalone" mode.
Re: Resolve platform:/resources outside the platform [message #1233810 is a reply to message #1233799] Mon, 20 January 2014 14:41 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
On 20/01/2014 15:07, Felix Dorner wrote:

> Or not. I hoped that the default URIHandler
URIConverter, not handler.
Re: Resolve platform:/resources outside the platform [message #1234549 is a reply to message #1233750] Wed, 22 January 2014 08:36 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
Hey,

> Within your own application you can play games with ResourceSet locators.

You mean
http://download.eclipse.org/modeling/emf/emf/javadoc/2.8.0/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.ResourceLocator.html

These look good. Unfortunately I'm on EMF 2.6 :(. But thanks very much
for pointing it out.

I can't change the file extensions either, nor use a custom protocol.
The only way I can think of solving my problem is to find a hook in the
API where, right before the URIHandler opens the stream, I locate my
project in the environment (Basically I have to search , in a set of
directories outside the workspace root) and import it. Then the
URIHandler continues as if the project had always been in the workspace.
Maybe the only solution is to use a high-priority customized
PlatformResourceURIHandler (High-priority by adding it before any of the
built-in resource handlers).



Felix
Re: Resolve platform:/resources outside the platform [message #1240930 is a reply to message #1234549] Fri, 07 February 2014 08:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Felix,

If you know "ahead of time" which things you want to redirect, you can
always use the resource set's URI converter's URI map to redirect
platform:/resource/<project> to some other URI that represents the
location of that project.

On 22/01/2014 9:36 AM, Felix Dorner wrote:
> Hey,
>
> > Within your own application you can play games with ResourceSet
> locators.
>
> You mean
> http://download.eclipse.org/modeling/emf/emf/javadoc/2.8.0/org/eclipse/emf/ecore/resource/impl/ResourceSetImpl.ResourceLocator.html
>
> These look good. Unfortunately I'm on EMF 2.6 :(. But thanks very much
> for pointing it out.
>
> I can't change the file extensions either, nor use a custom protocol.
> The only way I can think of solving my problem is to find a hook in
> the API where, right before the URIHandler opens the stream, I locate
> my project in the environment (Basically I have to search , in a set
> of directories outside the workspace root) and import it. Then the
> URIHandler continues as if the project had always been in the
> workspace. Maybe the only solution is to use a high-priority
> customized PlatformResourceURIHandler (High-priority by adding it
> before any of the built-in resource handlers).
>
>
>
> Felix
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Why code shows class as interface
Next Topic:Opposite and many to many
Goto Forum:
  


Current Time: Thu Apr 18 03:12:56 GMT 2024

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

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

Back to the top