felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Declarative Services
Date Wed, 19 Jun 2013 23:55:11 GMT
Could you give more details of your scenario?  SCR components are set up and discarded by the
scr framework.  They can get osgi services from the service registry, and they can arrange
to be registered as osgi services.  The services they get from the service registry do not
have to be SCR components although they can be.

In your scenario which objects are SCR components?  

If all the objects are SCR components, the "service consumer" would declare the interfaces
(or classes) it wants to be registered under and would be registered in the service registry
after its references are satisfied and set (and it's activated). Other SCR components in any
bundle, whether or not they are registered as services, can deciare a reference on your "service
consumer" service and be supplied the service by SCR.  Non-SCR components can use a ServiceTracker
to get the service instance.  If you only need optional momentary access to the service you
can deal with the service registry directly.

hope this helps
david jencks

On Jun 19, 2013, at 1:26 PM, bokie <jms.cercas@gmail.com> wrote:

> During my work with declarative services I've come across a design question.
> 
> If we have a service consumer that I assume gets instantiated and injected
> with the service via the SCR, how do we get a the reference to that consumer
> instance (in terms of best practices) within the same bundle for example.
> 
> I've come up with a few solutions but would like to hear other opinions.
> 
> Thanks
> Jorge
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Declarative-Services-tp5004036.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message