|Re: [equinox-dev] Registering two services in the same bundle|
You can use the registerService(java.lang.String clazzes,java.lang.Object service, java.util.Dictionary properties) to register your service object under multiple service interfaces. This will allow you to control the registration with a single ServiceRegistration object. But in order to get a ServiceReference that is guaranteed to implement both service interfaces then you must use the getServiceReferences(String clazz, String filter) with a null clazz and a filter that looks something like this:
This will ensure that the ServiceReference objects returned implement both Interface1 and Interface2. This should allow you to cast the Object returned from getService(ServiceReference) to both Interface1 and Interface2 in your service using client bundle. But for client code I recommend you use an injection mechanism (like Declarative Services, Spring DM or Blueprint) if possible so you don't have to worry about tracking the services yourself.
"David Conde" ---11/16/2009 02:34:18 AM---Hi,
"David Conde" <dconde@xxxxxxxx>
"'Equinox development mailing list'" <equinox-dev@xxxxxxxxxxx>
11/16/2009 02:34 AM
[equinox-dev] Registering two services in the same bundle