references to meta-model in another Eclipse project [message #368546] |
Tue, 09 June 2009 09:58 |
Eclipse User |
|
|
|
Originally posted by: hoe.zurich.ibm.com
I am relatively new to BIRT and have the following question:
I'm trying to run from a report design that includes a data source which
references an (EMF) meta-model in another Eclipse (plug-in) project than
itself. The BIRT Report Designers translates this into a URI of the form
platform:/resource/..., as makes sense at development time.
However, at runtime there is no such resource in the (runtime)
workspace; but then an analogous URI of the form platform:/plugin/...
would work instead (as I can confirm by manually editing the URI),
because in the runtime environment the (Eclipse plug-in) project that
contains the meta-model has become a plug-in.
Is there a good way (best practice) for handling a situation like this?
Thanks for your help,
Christian
|
|
|
Re: references to meta-model in another Eclipse project [message #368548 is a reply to message #368546] |
Tue, 09 June 2009 10:43 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------080609030406070501080506
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Christian,
The URIConverter could be used to redirect URIs in general
Map
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82Map ><URI
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI >,
URI
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI >>
org.eclipse.emf.ecore.resource.URIConverter
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter >.getURIMap()
Returns the map used for remapping a logical URI to a physical URI
when |normalizing
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82%E2%98%82normalize >|.
An implementation will typically also delegate to the |global
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URIConverter%E2%98%82URI_MAP >|
map, so registrations made in this map are /local/ to this URI
converter, i.e., they augment or override those of the global map.
The map generally specifies instance to instance mapping, except for
the case that both the key URI and the value URI end with "/", which
specifies a folder to folder mapping. A folder mapping will remap
any URI that has the key as its |prefix
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI%E2%98%82replacePrefix >|,
e.g., if the map contains:
http://www.example.com/ -> platform:/resource/example/
then the URI
http://www.example.com/a/b/c.d
will map to
platform:/resource/example/a/b/c.d
A matching instance mapping is considered first. If there isn't one,
the folder mappings are considered starting with the |longest
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI%E2%98%82segmentCount%E2%98%82 >|
prefix.
A global mapping from platform:/resource/ to platform:/plugin/ might
well do the trick
Map
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82Map ><URI
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URI >,
URI
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URI >>
org.eclipse.emf.ecore.resource.URIConverter
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter >.URI_MAP
The global static URI map. Registrations made in this instance will
(typically) be available for |use
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URIConverter%E2%98%82normalize >|
by any URI converter. It is populated by URI mappings registered via
|plugin registration
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82org.eclipse.emf.ecore.plugin.EcorePl ugin.Implementation%E2%98%82startup%E2%98%82 >|.
Note that if your serialized URIs were relative (i.e.,
.../../<project-name/plugin-id>/model/foo.bar) they out to work equally
well in the workspace or deployed in the plugins.
Christian H?oertnagl wrote:
> I am relatively new to BIRT and have the following question:
>
> I'm trying to run from a report design that includes a data source
> which references an (EMF) meta-model in another Eclipse (plug-in)
> project than itself. The BIRT Report Designers translates this into a
> URI of the form platform:/resource/..., as makes sense at development
> time.
>
> However, at runtime there is no such resource in the (runtime)
> workspace; but then an analogous URI of the form platform:/plugin/...
> would work instead (as I can confirm by manually editing the URI),
> because in the runtime environment the (Eclipse plug-in) project that
> contains the meta-model has become a plug-in.
>
> Is there a good way (best practice) for handling a situation like this?
>
> Thanks for your help,
> Christian
--------------080609030406070501080506
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Christian,<br>
<br>
The URIConverter could be used to redirect URIs in general<br>
<blockquote>
<h5>
<div style="margin-top: 0px; margin-left: 22px;"><a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82Map ">Map</a><<a
class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI ">URI</a>,
<a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI ">URI</a>>
org.eclipse.emf.ecore.resource.<a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter ">URIConverter</a>.getURIMap()</div>
</h5>
<p>Returns the map used for remapping a logical URI to a physical URI
when <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82%E2%98%82normalize ">normalizing</a></code>.
</p>
<p>An implementation will typically also delegate to the <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URIConverter%E2%98%82URI_MAP ">global</a></code>
map, so registrations made in this map are <em>local</em> to this URI
converter, i.e., they augment or override those of the global map. </p>
<p>The map generally specifies instance to instance mapping, except
for the case that both the key URI and the value URI end with "/",
which specifies a folder to folder mapping. A folder mapping will remap
any URI that has the key as its <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI%E2%98%82replacePrefix ">prefix</a></code>,
e.g., if the map contains: </p>
<pre> <a class="moz-txt-link-freetext" href="http://www.example.com/">http://www.example.com/</a> -> platform:/resource/example/
</pre>
then the URI
<pre> <a class="moz-txt-link-freetext" href="http://www.example.com/a/b/c.d">http://www.example.com/a/b/c.d</a>
</pre>
will map to
<pre> platform:/resource/example/a/b/c.d
</pre>
A matching instance mapping is considered first. If there isn't one,
the folder mappings are considered starting with the <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%7EgetURIMap%E2%98%82URI%E2%98%82segmentCount%E2%98%82 ">longest</a></code>
prefix. <br>
</blockquote>
A global mapping from platform:/resource/ to platform:/plugin/ might
well do the trick<br>
<blockquote>
<h5>
<div style="margin-top: 0px; margin-left: 22px;"><a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82Map ">Map</a><<a
class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URI ">URI</a>,
<a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URI ">URI</a>>
org.eclipse.emf.ecore.resource.<a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter ">URIConverter</a>.URI_MAP</div>
</h5>
The global static URI map. Registrations made in this instance will
(typically) be available for <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URIConverter%E2%98%82normalize ">use</a></code>
by any URI converter. It is populated by URI mappings registered via <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82org.eclipse.emf.ecore.plugin.EcorePl ugin.Implementation%E2%98%82startup%E2%98%82 ">plugin
registration</a></code>.<br>
</blockquote>
<p>Note that if your serialized URIs were relative (i.e.,
.../../<project-name/plugin-id>/model/foo.bar) they out to work
equally well in the workspace or deployed in the plugins.<br>
</p>
<br>
<br>
Christian H?oertnagl wrote:
<blockquote cite="mid:h0lbp3$o6s$1@build.eclipse.org" type="cite">I am
relatively new to BIRT and have the following question:
<br>
<br>
I'm trying to run from a report design that includes a data source
which references an (EMF) meta-model in another Eclipse (plug-in)
project than itself. The BIRT Report Designers translates this into a
URI of the form platform:/resource/..., as makes sense at development
time.
<br>
<br>
However, at runtime there is no such resource in the (runtime)
workspace; but then an analogous URI of the form platform:/plugin/...
would work instead (as I can confirm by manually editing the URI),
because in the runtime environment the (Eclipse plug-in) project that
contains the meta-model has become a plug-in.
<br>
<br>
Is there a good way (best practice) for handling a situation like this?
<br>
<br>
Thanks for your help,
<br>
Christian
<br>
</blockquote>
</body>
</html>
--------------080609030406070501080506--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: references to meta-model in another Eclipse project [message #368562 is a reply to message #368548] |
Wed, 10 June 2009 08:16 |
Eclipse User |
|
|
|
Originally posted by: hoe.zurich.ibm.com
Ed,
Thank you very much. Indeed this seems to make a difference.
For future reference: I'm now calling
URIConverter.URI_MAP.put(URI.createURI("platform:/resource/... "),
URI.createURI("platform:/plugin/...")); immediately before the call to
IRunAndRenderTask.run(), and then all URIConverter.URI_MAP.remove(...)
after IRunAndRenderTask.close().
Best regards,
Christian
Ed Merks wrote:
> A global mapping from platform:/resource/ to platform:/plugin/ might
> well do the trick
>
> Map
> < eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82Map ><URI
> < eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URI >,
> URI
> < eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter%5EURI_MAP%E2%98%82URI >>
> org.eclipse.emf.ecore.resource.URIConverter
> < eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore.resource%7BURIConverter.java%E2%98%83URIConv erter >.URI_MAP
|
|
|
Powered by
FUDForum. Page generated in 0.03114 seconds