/** * unregister a service from the service discovery layer. * * @param reg the remote service registration. */ void unregisterFromServiceDiscovery(final RemoteServiceRegistration reg) { final Object[] handler = serviceDiscoveryHandlerTracker.getServices(); if (handler != null) { for (int i = 0; i < handler.length; i++) { ((ServiceDiscoveryHandler) handler[i]).unregisterService(reg.getReference()); } } }
/** register a service with the remote service discovery layer. */ void registerWithServiceDiscovery(final RemoteServiceRegistration reg) { // register the service with all service // discovery // handler final Dictionary props = reg.getProperties(); final Object[] handler = serviceDiscoveryHandlerTracker.getServices(); if (handler != null) { for (int i = 0; i < handler.length; i++) { ((ServiceDiscoveryHandler) handler[i]) .registerService( reg.getReference(), props, URI.create( "r-osgi://" //$NON-NLS-1$ + RemoteOSGiServiceImpl.MY_ADDRESS + ":" //$NON-NLS-1$ + RemoteOSGiServiceImpl.R_OSGI_PORT + "#" //$NON-NLS-1$ + reg.getServiceID())); } } }