blob: 7faefe4c4d735093c9ee8d1ffdb6f3d091e6e6c7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>OSBP DSL Matadata Service Bundle Overview</title>
<div style="background: rgb(238, 238, 238); padding: 5px 10px; border: 1px solid rgb(204, 204, 204); border-image: none;"><strong>DSL Metadata Service</strong></div>
<p>The DSL Metadata Service provides DSL metadata to the centralized MetadataBuilderService as a participant of the service&nbsp;via the&nbsp;interface <em>IMetadataBuilderService</em>.&nbsp;To achive this, it&nbsp;extends the abstract class AbstractBuilderParticipant. During startup DSL Metadata Service examines every bundle presented by the OSGi extender pattern and looks for a&nbsp;key in the bundle&#39;s manifest file <strong><em>&quot;Factory-Model&quot;</em></strong> and&nbsp;takes the presented value as extension for this model instance. The value must match the DSL extension of the related grammar.</p>
<p>Example MANIFEST.MF:</p>
<p>Factory-Model: perspective</p>
<hr />
<p>DSL Metadata Service provides a service via the interface <em>IDSLMetadataService</em> which can be tracked by ServiceTrackers to consume this service. The service presents any EClass from the analyzed model instances and furthermore can return their translators. If a bundleclass path must be constructed, it also returns the bundel in which the model instance was found.</p>
<p>A typical sequence looks like this:</p>
<p style="margin-left: 40px;">ServiceTracker<idslmetadataservice, idslmetadataservice=""> tracker = new ServiceTracker&lt;&gt;(<br />
&nbsp;&nbsp;&nbsp;&nbsp;Activator.getContext(), IDSLMetadataService.class, null);<br />
&nbsp;&nbsp;;<br />
&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;IDSLMetadataService dslService = tracker.waitForService(5000);<br />
&nbsp;&nbsp;&nbsp;return (ActionToolbar) dslService.getMetadata(toolbarId, ActionDSLPackage.Literals.ACTION_PACKAGE);<br />
&nbsp;&nbsp;} catch (InterruptedException e) {<br />
&nbsp;&nbsp;&nbsp;log.error(&quot;&quot;, e);<br />
&nbsp;&nbsp;} finally {<br />
&nbsp;&nbsp;&nbsp;tracker.close();<br />
<p><idslmetadataservice, idslmetadataservice="">&nbsp;</idslmetadataservice,></p>