felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: Passing services to other bundles
Date Fri, 27 May 2011 19:34:33 GMT
Why make them available as services if you don't want to access them as 
services? Just create one service (e.g., a ResourceRegistry) from which 
you can access your other objects.

Otherwise, use something like iPOJO or DS to manage your services for 
you and don't worry about it.

-> richard

On 5/27/11 15:22, chronozphere wrote:
> 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.

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

View raw message