[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tuscany-user
Subject:    OSGi implementation
From:       Alexander Blotny <Alexander.Blotny () fokus ! fraunhofer ! de>
Date:       2010-08-13 16:44:24
Message-ID: C88B4308.C510%Alexander.Blotny () fokus ! fraunhofer ! de
[Download RAW message or body]

Hi,

I am just experimenting a little bit with the implementation.osgi stuff
taking some samples as start...

I would like to have the following scenario. Two bundles are started in the
OSGi framework and are registered in for SCA. One bundle is consuming a
service that is implemented by the other bundle. I do not get an idea how
this can be done or maybe it is not possible.

So from the samples I have an OSGI-INF/sca folder with a bundle.composite
and a bundle.componentType file.

bundle.composite:

<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
    xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://calculator.dosgi"
    name="SMSComposite">

    <component name="SMSComponent">
        <tuscany:implementation.osgi
bundleSymbolicName="DeveloperGardenSDK.SMS" bundleVersion="0.0.1" />
        <service name="smsService">
            <binding.ws uri="http://localhost:8082/SMSService"/>
        </service>
    </component>   
</composite>

bundle.componentType:

<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
    <service name="smsService">
        <interface.java
interface="de.fhg.fokus.ngni.xposer.see.developergarden.sms.SMS"/>
    </service>
</componentType>

Furthermore the service is registered in the Activator class. The
registration is working and I am also able to consume the service via SOAP.
Now I want to have a second bundle that is able to consume the service.
Following files are created:

bundle.composite:

<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
    xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://calculator.dosgi"
    name="ReminderComposite">
    <component name="ReminderComponent">
        <tuscany:implementation.osgi bundleSymbolicName="Reminder_SCA"
bundleVersion="1.0" />
        <service name="ReminderService">
            <binding.ws uri="http://localhost:8082/ReminderService"/>
        </service>
        <reference name="smsService">
            <binding.ws uri="http://localhost:8082/SMSService"/>
        </reference>
    </component>   
</composite>

bundle.componentType:

<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
    <service name="ReminderService">
        <interface.java
interface="de.fhg.fokus.ngni.xposer.see.service.sca.reminder.ReminderService
"/>
    </service>
    <reference name="smsService">
        <interface.java
interface="de.fhg.fokus.ngni.xposer.see.developergarden.sms.SMS"/>
    </reference>
</componentType>

Again this service is registered via the Activator class. How I am getting
now the SMS service in the Java Code? I tried some things I have found in
other samples.
So the ReminderService implementation looks like that:

public class ReminderServiceImpl implements ReminderService {        private
SMS smsService;        @Reference    public void setSmsService(SMS
smsService){        this.smsService = smsService;    }     @Override
public boolean startReminder(String user) {        return
smsService.sendSMS("xy", "number", "Hallo", "Reminder");    } }

This structure is taken from another sample I looked at. The smsService is
null at this point.
I know that I could get the SMS service over OSGi reference stuff but I want
to use SCA stuff.

Please tell me if my scenario is wrong (or stupid) or if this is just not
working.

Thanks in advance.

greetings,
Alex 

[Attachment #3 (text/html)]

<HTML>
<HEAD>
<TITLE>OSGi implementation</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi,<BR>
<BR>
I am just experimenting a little bit with the implementation.osgi stuff taking some \
samples as start...<BR> <BR>
I would like to have the following scenario. Two bundles are started in the OSGi \
framework and are registered in for SCA. One bundle is consuming a service that is \
implemented by the other bundle. I do not get an idea how this can be done or maybe \
it is not possible.<BR> <BR>
So from the samples I have an OSGI-INF/sca folder with a bundle.composite and a \
bundle.componentType file.<BR> <BR>
bundle.composite:<BR>
<BR>
&lt;composite xmlns=&quot;<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;xmlns:tuscany=&quot;<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xsd=&quot;<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&quot;<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;targetNamespace=&quot;<a \
href="http://">http://</a>calculator.dosgi&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;SMSComposite&quot;&gt;<BR> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;component name=&quot;SMSComponent&quot;&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tuscany:implementation.osgi \
bundleSymbolicName=&quot;DeveloperGardenSDK.SMS&quot; bundleVersion=&quot;0.0.1&quot; \
/&gt;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;service \
name=&quot;smsService&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;binding.ws \
uri=&quot;<a href="http://">http://</a>localhost:8082/SMSService&quot;/&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/service&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/component&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR> \
&lt;/composite&gt;<BR> <BR>
bundle.componentType:<BR>
<BR>
&lt;componentType xmlns=&quot;<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xsd=&quot;<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&quot;<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:t=&quot;<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&lt;service name=&quot;smsService&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;interface.java \
interface=&quot;de.fhg.fokus.ngni.xposer.see.developergarden.sms.SMS&quot;/&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/service&gt;<BR> &lt;/componentType&gt;<BR>
<BR>
Furthermore the service is registered in the Activator class. The registration is \
working and I am also able to consume the service via SOAP. <BR> Now I want to have a \
second bundle that is able to consume the service. Following files are created:<BR> \
<BR> bundle.composite:<BR>
<BR>
&lt;composite xmlns=&quot;<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;xmlns:tuscany=&quot;<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xsd=&quot;<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&quot;<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;targetNamespace=&quot;<a \
href="http://">http://</a>calculator.dosgi&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;ReminderComposite&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&lt;component name=&quot;ReminderComponent&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tuscany:implementation.osgi \
bundleSymbolicName=&quot;Reminder_SCA&quot; bundleVersion=&quot;1.0&quot; /&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;service \
name=&quot;ReminderService&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;binding.ws \
uri=&quot;<a href="http://">http://</a>localhost:8082/ReminderService&quot;/&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/service&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;reference \
name=&quot;smsService&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;binding.ws \
uri=&quot;<a href="http://">http://</a>localhost:8082/SMSService&quot;/&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/reference&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/component&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR> \
&lt;/composite&gt;<BR> <BR>
bundle.componentType:<BR>
<BR>
&lt;componentType xmlns=&quot;<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912&quot;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xsd=&quot;<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&quot;<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:t=&quot;<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&lt;service name=&quot;ReminderService&quot;&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;interface.java \
interface=&quot;de.fhg.fokus.ngni.xposer.see.service.sca.reminder.ReminderService&quot;/&gt;<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;&lt;/service&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;reference name=&quot;smsService&quot;&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;interface.java \
interface=&quot;de.fhg.fokus.ngni.xposer.see.developergarden.sms.SMS&quot;/&gt;<BR> \
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/reference&gt;<BR> &lt;/componentType&gt;<BR>
<BR>
Again this service is registered via the Activator class. How I am getting now the \
SMS service in the Java Code? I tried some things I have found in other samples.<BR> \
So the ReminderService implementation looks like that:<BR> <BR>
public class ReminderServiceImpl implements ReminderService {
 &nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;private SMS smsService;
 &nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;@Reference
 &nbsp;&nbsp;&nbsp;public void setSmsService(SMS smsService){
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.smsService = smsService;
 &nbsp;&nbsp;&nbsp;}

 &nbsp;&nbsp;&nbsp;@Override
 &nbsp;&nbsp;&nbsp;public boolean startReminder(String user) {
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return smsService.sendSMS(&quot;xy&quot;, \
&quot;number&quot;, &quot;Hallo&quot;, &quot;Reminder&quot;);  &nbsp;&nbsp;&nbsp;}
}<BR>
<BR>
This structure is taken from another sample I looked at. The smsService is null at \
this point.<BR> I know that I could get the SMS service over OSGi reference stuff but \
I want to use SCA stuff.<BR> <BR>
Please tell me if my scenario is wrong (or stupid) or if this is just not \
working.<BR> <BR>
Thanks in advance.<BR>
<BR>
greetings,<BR>
Alex </SPAN></FONT>
</BODY>
</HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic