A factory for {@link Constants#SCOPE_BUNDLE bundle scope} services. Thefactory can provide service objects customized for each bundle in the OSGi environment.
When registering a service, a {@code ServiceFactory} object can be usedinstead of a service object, so that the bundle developer can create a customized service object for each bundle that is using the service.
When a bundle {@link BundleContext#getService(ServiceReference) requests} theservice object, the framework calls the {@link #getService(Bundle,ServiceRegistration) getService} method to returna service object customized for the requesting bundle. The returned service object is cached by the Framework for subsequent calls to {@link BundleContext#getService(ServiceReference)} until the bundle releasesits use of the service.
When the bundle's use count for the service is {@link BundleContext#ungetService(ServiceReference) decremented} to zero(including the bundle stopping or the service being unregistered), the framework will call the {@link #ungetService(Bundle,ServiceRegistration,Object) ungetService}method.
{@code ServiceFactory} objects are only used by the Framework and are notmade available to other bundles in the OSGi environment. The Framework may concurrently call a {@code ServiceFactory}.
@param < S> Type of Service
@see BundleContext#getService(ServiceReference)
@ThreadSafe
@author $Id: f11fc6bee18315fb659c7987d1b66f1c9c95548a $