cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF > DOSGi DS Demo page
Date Fri, 25 Jun 2010 11:37:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/15/_/styles/combined.css?spaceKey=CXF&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF/DOSGi+DS+Demo+page">DOSGi
DS Demo page</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davidb@apache.org">David
Bosschaert</a>
    </h4>
        <br/>
                         <h4>Changes (11)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The service implementation providers
a [simplistic implementation of the AdderService interface|http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/impl/src/main/java/org/apache/cxf/dosgi/samples/ds/impl/AdderServiceImpl.java],
which is instantiated as a DS component. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >In the [{{OSGI-INF/component.xml}}|http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/impl/src/main/resources/OSGI-INF/component.xml]
file the AdderServiceImpl is instantiated and registered with the OSGi service registry with
the distribution properties. These properties instruct. Distributed OSGi into making the service
available on <span class="diff-changed-words"><span class="diff-added-chars"style="background-color:
#dfd;">[</span>http://localhost:9090/adder<span class="diff-added-chars"style="background-color:
#dfd;">]</span>.</span> <br></td></tr>
            <tr><td class="diff-unchanged" >{code:xml}&lt;scr:component xmlns:scr=&quot;http://www.osgi.org/xmlns/scr/v1.1.0&quot;
name=&quot;DS Service Sample&quot;&gt; <br>  &lt;implementation class=&quot;org.apache.cxf.dosgi.samples.ds.impl.AdderServiceImpl&quot;/&gt;
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>So let&#39;s install
the server side in Equinox, together with the Equinox DS implementation. You can do this from
the Equinox command line, but in this document I&#39;ll launch Equinox from within Eclipse.
<br></td></tr>
            <tr><td class="diff-changed-lines" >I&#39;m starting off by importing
the Single Bundle Distribution as a binary project in Eclipse by going _File <span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">\</span>-&gt;</span>
Import <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
<span class="diff-added-words"style="background-color: #dfd;">\|</span> Plug-ins
and Fragments_ and then select the directory that contains the single bundle distribution
JAR file. My workspace now looks like this: <br></td></tr>
            <tr><td class="diff-unchanged" >!start.JPG! <br>Next I&#39;ll
create an OSGi Framework launch configuration that includes DS. To do this <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >osgi&gt; start 6 <br>...
log messages may appear ...{code} <br></td></tr>
            <tr><td class="diff-changed-lines" >{tip}You can also import the maven
projects of the DS demo into Eclipse, this would save you from installing it with a URL as
above. To do this, check out the CXF/DOSGi source from SVN <span class="diff-changed-words">(<span
class="diff-added-chars"style="background-color: #dfd;">[</span>http://svn.apache.org/repos/asf/cxf/dosgi/trunk<span
class="diff-added-chars"style="background-color: #dfd;">]</span>),</span> run
{{mvn eclipse:eclipse}} and import all Eclipse projects under the {{samples/ds}} directory
in Eclipse with _File <span class="diff-changed-words"><span class="diff-added-chars"style="background-color:
#dfd;">\</span>-&gt;</span> Import <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">|</span>
<span class="diff-added-words"style="background-color: #dfd;">\|</span> Existing
Projects into Workspace_.{tip} <br></td></tr>
            <tr><td class="diff-unchanged" >At this point, the service should
be available remotely, you can check this by obtaining the WSDL: <br>!wsdl.JPG! <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code}  Service-Component: OSGI-INF/component.xml{code}
<br>As in the Greeter demo, the client side needs to be configured to know where the
remote service actually is. This is one in the [{{OSGI-INF/remote-service/remote-services.xml}}|http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml]
file: <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code:xml}&lt;service-descriptions
xmlns=&quot;http://www.osgi.org/xmlns/sd/v1.0.0&quot;&gt; <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{code:xml}&lt;endpoint-descriptions
xmlns=&quot;http://www.osgi.org/xmlns/rsa/v1.0.0&quot;&gt; <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">&lt;service-description&gt;</span>
<span class="diff-added-words"style="background-color: #dfd;">&lt;endpoint-description&gt;</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
   &lt;provide interface=&quot;org.apache.cxf.dosgi.samples.ds.AdderService&quot;
/&gt; <br></td></tr>
            <tr><td class="diff-changed-lines" >&lt;property <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">name=&quot;osgi.remote.interfaces&quot;&gt;*&lt;/property&gt;</span>
<span class="diff-added-words"style="background-color: #dfd;">name=&quot;objectClass&quot;&gt;</span>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
     &lt;array&gt; <br>        &lt;value&gt;org.apache.cxf.dosgi.samples.ds.AdderService&lt;/value&gt;
<br>      &lt;/array&gt; <br>    &lt;/property&gt; <br></td></tr>
            <tr><td class="diff-changed-lines" >&lt;property <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">name=&quot;osgi.remote.configuration.type&quot;&gt;pojo&lt;/property&gt;</span>
<span class="diff-added-words"style="background-color: #dfd;">name=&quot;endpoint.id&quot;&gt;http://localhost:9090/adder&lt;/property&gt;</span>
<br>&lt;property <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">name=&quot;osgi.remote.configuration.pojo.address&quot;&gt;http://localhost:9090/adder&lt;/property&gt;</span>
<span class="diff-added-words"style="background-color: #dfd;">name=&quot;service.imported.configs&quot;&gt;org.apache.cxf.ws&lt;/property&gt;</span>
<br><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">&lt;/service-description&gt;</span>
<span class="diff-added-words"style="background-color: #dfd;">&lt;/endpoint-description&gt;</span>
<br><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">&lt;/service-descriptions&gt;{code}</span>
<span class="diff-added-words"style="background-color: #dfd;">&lt;/endpoint-descriptions&gt;{code}</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >Install and run the consumer side
of the demo in a separate Equinox instance (tip: you can duplicate the launch configuration
used for the server side in the &#39;Run Configurations&#39; dialog): <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The remote adder service has now been
invoked. You will see the following line on the server side Equinox window: <br>{code}Adder
service invoked: 1 + 1 = 2{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h3. Consumer Note <br> <br>Some OSGi Declarative Services implementations
don&#39;t explicitly register interest in the requested services with the OSGi Framework.
They rather user a generic Service Tracker or Service Listener to track all available services.
This doesn&#39;t provide the CXF-DOSGi implementation with the information about what
services the consumer is looking for through the ListenerHook and hence it can&#39;t register
the remote service on-the-fly. A simple workaround to this problem is to add an Activator
to a bundle in the client-side framework (this activator could be in any bundle) which registers
an explicit ServiceTracker for the remote service the DS component wants to be injected with.
An example of such an [Activator can be found here|http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/Activator.java].
<br> <br>In the future a more elegant solution to this problem will hopefully
be provided. <br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>This page describes the CXF Distributed OSGi with Declarative Services demo.</p>

<p>The Declarative Services demo uses a DS implementation to create a remoted OSGi service
from a DS component. The consumer side uses DS to create a component that consumes the remote
OSGi service. By using Declarative Services, you don't need to write code to interact with
the OSGi Service Registry. That's all handled through injection which hugely simpliefies the
code.<br/>
Declarative Services is similar to Spring-DM/OSGi Blueprint in that service dependencies are
satisfied through injection. There are a few differences as well. DS is lighter weight than
Spring-DM but also has less features. Declarative Services have been part of the OSGi specifications
since version 4.0.</p>

<p>This demo can be used with any DOSGi distribution, in this document the single-bundle
distribution is used with the Equinox implementation of DS.</p>

<h2><a name="DOSGiDSDemopage-Demodesign"></a>Demo design</h2>

<p>This demo is quite similar to the Spring-DM demo and the Greeter demo in structure.
It consists of 3 bundles:</p>
<ul>
	<li>An interface bundle defining the Adder Service interface.</li>
	<li>An Adder Service implementation bundle.</li>
	<li>An Adder Service consumer bundle.</li>
</ul>


<p>The service implementation and consumer bundle are built using DS.<br/>
<span class="image-wrap" style=""><img src="/confluence/download/attachments/119430/dosgi_cxf_ds.png?version=1&amp;modificationDate=1244109957000"
style="border: 0px solid black" /></span><br/>
The <a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/interface/src/main/java/org/apache/cxf/dosgi/samples/ds/AdderService.java"
class="external-link" rel="nofollow">Adder Service interface</a> is as follows:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"><span class="code-keyword">public</span> <span
class="code-keyword">interface</span> AdderService {
    <span class="code-object">int</span> add(<span class="code-object">int</span>
a, <span class="code-object">int</span> b);
}</pre>
</div></div>

<h2><a name="DOSGiDSDemopage-TheAdderServiceImplementation"></a>The Adder
Service Implementation</h2>

<p>The service implementation providers a <a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/impl/src/main/java/org/apache/cxf/dosgi/samples/ds/impl/AdderServiceImpl.java"
class="external-link" rel="nofollow">simplistic implementation of the AdderService interface</a>,
which is instantiated as a DS component.</p>

<p>In the <a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/impl/src/main/resources/OSGI-INF/component.xml"
class="external-link" rel="nofollow"><tt>OSGI-INF/component.xml</tt></a>
file the AdderServiceImpl is instantiated and registered with the OSGi service registry with
the distribution properties. These properties instruct. Distributed OSGi into making the service
available on <a href="http://localhost:9090/adder" class="external-link" rel="nofollow">http://localhost:9090/adder</a>.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;scr:component <span class="code-keyword">xmlns:scr</span>=<span
class="code-quote">"http://www.osgi.org/xmlns/scr/v1.1.0"</span> name=<span class="code-quote">"DS
Service Sample"</span>&gt;</span>
  <span class="code-tag">&lt;implementation class=<span class="code-quote">"org.apache.cxf.dosgi.samples.ds.impl.AdderServiceImpl"</span>/&gt;</span>

  <span class="code-tag">&lt;property name=<span class="code-quote">"service.exported.interfaces"</span>
value=<span class="code-quote">"*"</span> /&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"service.exported.configs"</span>
value=<span class="code-quote">"org.apache.cxf.ws"</span> /&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"org.apache.cxf.ws.address"</span>
value=<span class="code-quote">"http://localhost:9090/adder"</span> /&gt;</span>

  <span class="code-tag">&lt;service&gt;</span>
    <span class="code-tag">&lt;provide interface=<span class="code-quote">"org.apache.cxf.dosgi.samples.ds.AdderService"</span>/&gt;</span>
  <span class="code-tag">&lt;/service&gt;</span>
<span class="code-tag">&lt;/scr:component&gt;</span></pre>
</div></div>
<p>Note that the <tt>META-INF/MANIFEST.MF</tt> file needs to contain a special
DS header that tells the system where to find this file. In case of this demo, this header
is added by the Maven build system. The header used by the demo is:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">  Service-Component: OSGI-INF/component.xml</pre>
</div></div>

<p>So let's install the server side in Equinox, together with the Equinox DS implementation.
You can do this from the Equinox command line, but in this document I'll launch Equinox from
within Eclipse.<br/>
I'm starting off by importing the Single Bundle Distribution as a binary project in Eclipse
by going <em>File &#45;&gt; Import &#124; Plug-ins and Fragments</em>
and then select the directory that contains the single bundle distribution JAR file. My workspace
now looks like this:<br/>
<span class="image-wrap" style=""><img src="/confluence/download/attachments/119430/start.JPG?version=2&amp;modificationDate=1259958791000"
style="border: 0px solid black" /></span><br/>
Next I'll create an OSGi Framework launch configuration that includes DS. To do this</p>
<ol>
	<li><em>deselect</em> the 'Target Platform' tickbox in the Eclipse Launch
configuration screen</li>
	<li>select org.eclipse.equinox.ds</li>
	<li>hit the 'Add Required Bundles' button</li>
</ol>


<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/119430/launch.JPG?version=2&amp;modificationDate=1259958791000"
style="border: 0px solid black" /></span></p>

<p>Now run the OSGi container, you will get a setup like this:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">osgi&gt; ss

Framework is launched.

id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.5.0.v20090520
1	ACTIVE      org.eclipse.equinox.util_1.0.100.v20090520-1800
2	ACTIVE      org.eclipse.osgi.services_3.2.0.v20090520-1800
3	ACTIVE      cxf-dosgi-ri-singlebundle-distribution_1.1.0.SNAPSHOT
4	ACTIVE      org.eclipse.equinox.ds_1.1.0.v20090520-1800</pre>
</div></div>
<p>Now I can install the DOSGi DS bundles in the OSGi container directly from the maven
repository.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">osgi&gt; install http:<span class="code-comment">//repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-ds-<span
class="code-keyword">interface</span>/1.1/cxf-dosgi-ri-samples-ds-<span class="code-keyword">interface</span>-1.1.jar
</span>Bundle id is 5

osgi&gt; install http:<span class="code-comment">//repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-ds-impl/1.1/cxf-dosgi-ri-samples-ds-impl-1.1.jar
</span>Bundle id is 6

osgi&gt; start 6
... log messages may appear ...</pre>
</div></div>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>You can also import the maven
projects of the DS demo into Eclipse, this would save you from installing it with a URL as
above. To do this, check out the CXF/DOSGi source from SVN (<a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk"
class="external-link" rel="nofollow">http://svn.apache.org/repos/asf/cxf/dosgi/trunk</a>),
run <tt>mvn eclipse:eclipse</tt> and import all Eclipse projects under the <tt>samples/ds</tt>
directory in Eclipse with <em>File &#45;&gt; Import &#124; Existing Projects
into Workspace</em>.</td></tr></table></div>
<p>At this point, the service should be available remotely, you can check this by obtaining
the WSDL:<br/>
<span class="image-wrap" style=""><img src="/confluence/download/attachments/119430/wsdl.JPG?version=1&amp;modificationDate=1244110019000"
style="border: 0px solid black" /></span></p>

<h2><a name="DOSGiDSDemopage-TheAdderServiceConsumer"></a>The Adder Service
Consumer</h2>

<p>The service consumer is also created using DS. DS creates an AdderConsumer component
which is injected with a reference to the remote AdderService. Like in Spring, the injection
is done by DS, which makes the code nice and simple. When the injection is done, the start()
method is called.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"><span class="code-keyword">public</span> class AdderConsumer
{
    <span class="code-keyword">private</span> AdderService adder;

    <span class="code-keyword">public</span> void bindAdder(AdderService a) {
        adder = a;
    }

    <span class="code-keyword">public</span> void unbindAdder(AdderService a)
{
        adder = <span class="code-keyword">null</span>;
    }

    <span class="code-keyword">public</span> void start(ComponentContext cc) {
        <span class="code-object">System</span>.out.println(<span class="code-quote">"Using
adder service: 1 + 1 = "</span> + adder.add(1, 1));
    }
}</pre>
</div></div>
<p>The client side bundle contains an <a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/component.xml"
class="external-link" rel="nofollow"><tt>OSGI-INF/component.xml</tt></a>
which drives the component creation and injection:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;scr:component <span class="code-keyword">xmlns:scr</span>=<span
class="code-quote">"http://www.osgi.org/xmlns/scr/v1.1.0"</span> activate=<span
class="code-quote">"start"</span>&gt;</span>
   <span class="code-tag">&lt;implementation class=<span class="code-quote">"org.apache.cxf.dosgi.samples.ds.consumer.AdderConsumer"</span>/&gt;</span>
   <span class="code-tag">&lt;reference interface=<span class="code-quote">"org.apache.cxf.dosgi.samples.ds.AdderService"</span>
name=<span class="code-quote">"AdderService"</span> cardinality=<span class="code-quote">"1..1"</span>
policy=<span class="code-quote">"dynamic"</span> bind=<span class="code-quote">"bindAdder"</span>
unbind=<span class="code-quote">"unbindAdder"</span>/&gt;</span>
<span class="code-tag">&lt;/scr:component&gt;</span></pre>
</div></div>
<p>As on the service provider side, the client side bundle needs to contain the DS header
in the <tt>META-INF/MANIFEST.MF</tt>:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">  Service-Component: OSGI-INF/component.xml</pre>
</div></div>
<p>As in the Greeter demo, the client side needs to be configured to know where the
remote service actually is. This is one in the <a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml"
class="external-link" rel="nofollow"><tt>OSGI-INF/remote-service/remote-services.xml</tt></a>
file:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;endpoint-descriptions xmlns=<span
class="code-quote">"http://www.osgi.org/xmlns/rsa/v1.0.0"</span>&gt;</span>
  <span class="code-tag">&lt;endpoint-description&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"objectClass"</span>&gt;</span>
      <span class="code-tag">&lt;array&gt;</span>
        <span class="code-tag">&lt;value&gt;</span>org.apache.cxf.dosgi.samples.ds.AdderService<span
class="code-tag">&lt;/value&gt;</span>
      <span class="code-tag">&lt;/array&gt;</span>
    <span class="code-tag">&lt;/property&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"endpoint.id"</span>&gt;</span>http://localhost:9090/adder<span
class="code-tag">&lt;/property&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"service.imported.configs"</span>&gt;</span>org.apache.cxf.ws<span
class="code-tag">&lt;/property&gt;</span>
  <span class="code-tag">&lt;/endpoint-description&gt;</span>
<span class="code-tag">&lt;/endpoint-descriptions&gt;</span></pre>
</div></div>
<p>Install and run the consumer side of the demo in a separate Equinox instance (tip:
you can duplicate the launch configuration used for the server side in the 'Run Configurations'
dialog):</p>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">osgi&gt; install http:<span class="code-comment">//repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-ds-<span
class="code-keyword">interface</span>/1.1/cxf-dosgi-ri-samples-ds-<span class="code-keyword">interface</span>-1.1.jar
</span>Bundle id is 5

osgi&gt; install http:<span class="code-comment">//repo1.maven.org/maven2/org/apache/cxf/dosgi/samples/cxf-dosgi-ri-samples-ds-client/1.1/cxf-dosgi-ri-samples-ds-client-1.1.jar
</span>Bundle id is 6

osgi&gt; start 6
... log messages may appear, after a little <span class="code-keyword">while</span>
the following message appears:
Using adder service: 1 + 1 = 2</pre>
</div></div>
<p>The remote adder service has now been invoked. You will see the following line on
the server side Equinox window:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">Adder service invoked: 1 + 1 = 2</pre>
</div></div>

<h3><a name="DOSGiDSDemopage-ConsumerNote"></a>Consumer Note</h3>

<p>Some OSGi Declarative Services implementations don't explicitly register interest
in the requested services with the OSGi Framework. They rather user a generic Service Tracker
or Service Listener to track all available services. This doesn't provide the CXF-DOSGi implementation
with the information about what services the consumer is looking for through the ListenerHook
and hence it can't register the remote service on-the-fly. A simple workaround to this problem
is to add an Activator to a bundle in the client-side framework (this activator could be in
any bundle) which registers an explicit ServiceTracker for the remote service the DS component
wants to be injected with. An example of such an <a href="http://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/ds/client/src/main/java/org/apache/cxf/dosgi/samples/ds/consumer/Activator.java"
class="external-link" rel="nofollow">Activator can be found here</a>.</p>

<p>In the future a more elegant solution to this problem will hopefully be provided.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF/DOSGi+DS+Demo+page">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=119430&revisedVersion=13&originalVersion=12">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF/DOSGi+DS+Demo+page?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message