[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>
<composite xmlns="<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912"<BR> \
xmlns:tuscany="<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1"<BR> \
xmlns:xsd="<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<BR>
targetNamespace="<a \
href="http://">http://</a>calculator.dosgi"<BR> \
name="SMSComposite"><BR> <BR>
<component name="SMSComponent"><BR>
<tuscany:implementation.osgi \
bundleSymbolicName="DeveloperGardenSDK.SMS" bundleVersion="0.0.1" \
/><BR> <service \
name="smsService"><BR> \
<binding.ws \
uri="<a href="http://">http://</a>localhost:8082/SMSService"/><BR> \
</service><BR> \
</component> <BR> \
</composite><BR> <BR>
bundle.componentType:<BR>
<BR>
<componentType xmlns="<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912"<BR> \
xmlns:xsd="<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<BR>
xmlns:t="<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1"><BR> \
<service name="smsService"><BR> \
<interface.java \
interface="de.fhg.fokus.ngni.xposer.see.developergarden.sms.SMS"/><BR> \
</service><BR> </componentType><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>
<composite xmlns="<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912"<BR> \
xmlns:tuscany="<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1"<BR> \
xmlns:xsd="<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<BR>
targetNamespace="<a \
href="http://">http://</a>calculator.dosgi"<BR> \
name="ReminderComposite"><BR> \
<component name="ReminderComponent"><BR> \
<tuscany:implementation.osgi \
bundleSymbolicName="Reminder_SCA" bundleVersion="1.0" /><BR> \
<service \
name="ReminderService"><BR> \
<binding.ws \
uri="<a href="http://">http://</a>localhost:8082/ReminderService"/><BR> \
</service><BR> \
<reference \
name="smsService"><BR> \
<binding.ws \
uri="<a href="http://">http://</a>localhost:8082/SMSService"/><BR> \
</reference><BR> \
</component> <BR> \
</composite><BR> <BR>
bundle.componentType:<BR>
<BR>
<componentType xmlns="<a \
href="http://">http://</a>docs.oasis-open.org/ns/opencsa/sca/200912"<BR> \
xmlns:xsd="<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<BR>
xmlns:t="<a \
href="http://">http://</a>tuscany.apache.org/xmlns/sca/1.1"><BR> \
<service name="ReminderService"><BR> \
<interface.java \
interface="de.fhg.fokus.ngni.xposer.see.service.sca.reminder.ReminderService"/><BR>
</service><BR>
<reference name="smsService"><BR>
<interface.java \
interface="de.fhg.fokus.ngni.xposer.see.developergarden.sms.SMS"/><BR> \
</reference><BR> </componentType><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 {
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"); }
}<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