felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chronozphere <chronozph...@gmail.com>
Subject Passing services to other bundles
Date Fri, 27 May 2011 19:22:45 GMT

Hello,

I'm using felix for a project of mine that uses a lot of services/interfaces
for communication between bundles. For example, one bundle contains a
manager to manage X resources. Each X resource contains multiple Y resources
and every Y resource has some Z resources. Ofcourse, these resources are
accessible as services.

It is tempting to let this bundle register an XManager service, who's
interface just returns X service interfaces (my own defined type). The good
thing about this is that other modules can directly access the X resources
and their corresponding Y and Z resources.

However, I have the impression that you have to use the mechanism provided
by ServiceReference and context.getService(). This would mean that I have to
keep track of all X service-instances in each of my client bundles, in order
to unget them when no longer needed. Moreover, I would need to do the same
with the Y and Z that can be accessed through each X service. I would need a
big number of getService() calls all over my code and it wouldn't look nice.

So, is it neccesary to use the getService/ungetService calls EVERYTIME you
want to access services from other bundles, or can I just pass the
interfaces around if I want? What are the implications of doing the latter? 

Thanks alot!

P.S: The bundles I'm programming are not part of a program which is
completely used offline. So the bundles will be available at all times
during the program's lifetime.
-- 
View this message in context: http://old.nabble.com/Passing-services-to-other-bundles-tp31719679p31719679.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


Mime
View raw message