Re: Same private service in different bundles

2016-06-17 Thread David Jencks
I join the calls telling you not to try hooks. DS has at least two mechanisms to allow you to configure different instances differently. Since the code and configuration xml are separate, you could just include different xml in each bundle. However, hopefully you are generating the component

Re: Same private service in different bundles

2016-06-17 Thread Raymond Auge
Vincent, what is the mechanism you are using to get the service? If you can use a service filter, then you can easily filter on the bundle id of the service. Bundle id is a required property of services. It's simple to do this using a service tracker, but not simple with DS (DS doesn't have a

Re: Same private service in different bundles

2016-06-17 Thread Clement Escoffier
Hi, You may be able to achieve what you want with a composites: http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-composition-tutorial.html

Re: Same private service in different bundles

2016-06-17 Thread Neil Bartlett
I guarantee that you will waste a lot of time on Find Hooks. Please don’t go that route! The service *should* already be private so what you need to do is work out why that is not the case. Both bundles should simply contain the interface package as a private package. If either of them need to

Re: Same private service in different bundles

2016-06-17 Thread Timothy Ward
Hi Vincent, As Neil says, if the service interface is contained in the bundle and the service API package is not exported or imported then it will be “private”. The service registry ensures that you only see services that you are class space compatible with. Making the service API private to

Re: Same private service in different bundles

2016-06-17 Thread Vincent Vandemeulebrouck
In our case, the reason behind the bundle-private service is that it is based on different other public services. The current solution we have is to instantiate an object with all the requirements as construction parameters. It becomes impractical because we have to repeat the exact same

Re: Same private service in different bundles

2016-06-17 Thread Neil Bartlett
You don’t need to use either registry hooks or regions for this. If the service interface package is private within the bundle (or if each bundle does not import the interface package from the other bundle) then your service will only be visible within its own bundle. This is known as service

Re: Same private service in different bundles

2016-06-17 Thread David Bosschaert
You can also use OSGi Service Registry Hooks to enforce this, see here: https://osgi.org/javadoc/r6/core/org/osgi/framework/hooks/service/package-summary.html You would implement the service hooks in a separate bundle to control which client gets which service. On the other hand, if the object

Re: Same private service in different bundles

2016-06-17 Thread Guillaume Nodet
You can investigate the use of equinox regions. You can define regions and visibility between regions. 2016-06-17 12:27 GMT+02:00 Vincent Vandemeulebrouck < vincent.vandemeulebro...@ullink.com>: > I need two different bundles to have the same private iPojo service, to be > used internally. It

Same private service in different bundles

2016-06-17 Thread Vincent Vandemeulebrouck
I need two different bundles to have the same private iPojo service, to be used internally. It is defined in a shared library, included in both bundle. How can I enforce that the requiring service get the service from their own bundle? Currently, as each bundle has the same service and same