Service Discovery

With the 1.0 release, service discovery has become an orthogonal concern and is no longer an integral part of R-OSGi. You can use service discovery, if you want, but it requires to install additional bundles. R-OSGi contains the API for service discovery. For the discovery, several different implementations can be used. One is the SLP service discovery that uses jSLP but we also have an implementation on top of Bluetooth SDP as part of the Bluetooth transport implementation.

If there is a service discovery implementation running, you can register your discovery listener like in the following example:

	.getName(), new ServiceDiscoveryListener() {

		public void announceService(final String serviceInterface, final URI uri) {
			final RemoteServiceReference ref = remote
			service = (ServiceInterface) remote

		public void discardService(String serviceInterface, URI uri) {
			System.out.println("LOST SERVICE " + uri);
			// the service proxy is unregistered automatically

}, null);