You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Kurvers, Eelco" <ee...@logicacmg.com> on 2006/06/01 14:31:06 UTC

OSGi/ Java newbie question

Hi all.

Currently I'm writing my first "real" application using the OSGi
framework as a basis. Now I've got a problem with/ question about the
connection between a service and its client. I haven't dealt with this
problem in the OSGi environment before.

I've got a "control" unit, controlling a GUI and managing the entire
application. I also have got a service delivering the needed
connectivity to the network (used for sending simple TCP/IP messages).
Now the control registers the "messaging service". It can send a
message, which works perfect. However the Messaging Service can also
receive messages. The problem is the service doesn't now the control,
does it? How do I trigger the control to act upon an incoming message?
Should I throw an event or something or is there an easier way? The
control unit is not a service itself, so it can not be registered by the
service.

Anybody's got a suggestion to solving this problem? Thanks in advance.

Regards,

Eelco Kurvers
Trainee
_________________________________________

LogicaCMG - Releasing your potential

Kralingseweg 241-249
3062 CE Rotterdam
Netherlands
T:  +31 (0) 10 253 7339
E:  eelco.kurvers@logicacmg.com <ma...@logicacmg.com> 
www.logicacmg.com

 



This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Re: OSGi/ Java newbie question

Posted by Didier Donsez <di...@imag.fr>.
Kurvers, Eelco a écrit :

>Hi all.
>
>Currently I'm writing my first "real" application using the OSGi
>framework as a basis. Now I've got a problem with/ question about the
>connection between a service and its client. I haven't dealt with this
>problem in the OSGi environment before.
>
>I've got a "control" unit, controlling a GUI and managing the entire
>application. I also have got a service delivering the needed
>connectivity to the network (used for sending simple TCP/IP messages).
>Now the control registers the "messaging service". It can send a
>message, which works perfect. However the Messaging Service can also
>receive messages. The problem is the service doesn't now the control,
>does it? How do I trigger the control to act upon an incoming message?
>Should I throw an event or something or is there an easier way?
>
OSGi R4 introduces a new service enabling asynchonous event 
publish-subcribe between bundles.
http://bundles.osgi.org/javadoc/r4/org/osgi/service/event/package-summary.html

This slide sumarizes this service
p://www-adele.imag.fr/~donsez/cours/osgi.pdf#page=92

Karl Pauls did an implementation of it (the Felix one in fact).

I did some bridge of the EventAdmin with Ivy and Flash applications
http://www-adele.imag.fr/~donsez/dev/osgi/eaivybridge/readme.html
http://www-adele.imag.fr/~donsez/dev/osgi/eaflashbridge/readme.html

I hope this help you !
Best regards

Didier

>The
>control unit is not a service itself, so it can not be registered by the
>service.
>
>Anybody's got a suggestion to solving this problem? Thanks in advance.
>
>Regards,
>
>Eelco Kurvers
>Trainee
>_________________________________________
>
>LogicaCMG - Releasing your potential
>
>Kralingseweg 241-249
>3062 CE Rotterdam
>Netherlands
>T:  +31 (0) 10 253 7339
>E:  eelco.kurvers@logicacmg.com <ma...@logicacmg.com> 
>www.logicacmg.com
>
> 
>
>
>
>This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
>
>  
>


-- 
---------------------------------------------------------
Didier DONSEZ
Laboratoire LSR, Institut Imag, Universite Joseph Fourier
Bat. C, 220 rue de la Chimie, Domaine Universitaire
BP 53, 38041 Grenoble Cedex 9, France
GPS : lat 45°11'38.3"N, lon 05°46'14.7"E, alt 223m
Tel : +33 4 76 63 55 49           Fax : +33 4 76 63 55 50
mailto:Didier.Donsez@imag.fr
URL: http://www-adele.imag.fr/~donsez
---------------------------------------------------------



Re: OSGi/ Java newbie question

Posted by Rob Walker <ro...@ascert.com>.
Basically - to get asynchronous event feedback from a service, you'll 
probably need to use one of the established design models:

    * create a listener interface on your service where bundles can
      register to be notified of incoming message events. This is a
      fairly generic Java model, not an OSGi specific one, and it's
      workable but you do need to be careful around services stopping /
      restarting in terms of what happens to listener lists.
    * use a "whiteboard" model for services. I've never much used this
      myself, but there are quite a few papers and examples on the web
      if you google for "whiteboard". One of your whiteboard hooks can
      be incoming message event notification
    * user a service binder or iPojo style model (which can be used with
      either of the above) to wire up events from potential message
      sources to interested message destinations

There are probably many other variations and alternatives along these lines.

Regards

-- Rob

Kurvers, Eelco wrote:
> Hi all.
>
> Currently I'm writing my first "real" application using the OSGi
> framework as a basis. Now I've got a problem with/ question about the
> connection between a service and its client. I haven't dealt with this
> problem in the OSGi environment before.
>
> I've got a "control" unit, controlling a GUI and managing the entire
> application. I also have got a service delivering the needed
> connectivity to the network (used for sending simple TCP/IP messages).
> Now the control registers the "messaging service". It can send a
> message, which works perfect. However the Messaging Service can also
> receive messages. The problem is the service doesn't now the control,
> does it? How do I trigger the control to act upon an incoming message?
> Should I throw an event or something or is there an easier way? The
> control unit is not a service itself, so it can not be registered by the
> service.
>
> Anybody's got a suggestion to solving this problem? Thanks in advance.
>
> Regards,
>
> Eelco Kurvers
> Trainee
> _________________________________________
>
> LogicaCMG - Releasing your potential
>
> Kralingseweg 241-249
> 3062 CE Rotterdam
> Netherlands
> T:  +31 (0) 10 253 7339
> E:  eelco.kurvers@logicacmg.com <ma...@logicacmg.com> 
> www.logicacmg.com
>
>  
>
>
>
> This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
>
>   

-- 


Ascert - Taking systems to the Edge
robw@ascert.com
+44 (0)20 7488 3470
www.ascert.com