Interface PrototypeServiceFactory<S>

    • Method Detail

      • getService

        S getService​(Bundle bundle,
                     ServiceRegistration<S> registration)
        Returns a service object for a caller.

        The Framework invokes this method for each caller requesting a service object using ServiceObjects.getService(). The factory can then return a customized service object for the caller.

        The Framework must check that the returned service object is valid. If the returned service object is null or is not an instanceof all the classes named when the service was registered, a framework event of type FrameworkEvent.ERROR is fired containing a service exception of type ServiceException.FACTORY_ERROR and null is returned to the caller. If this method throws an exception, a framework event of type FrameworkEvent.ERROR is fired containing a service exception of type ServiceException.FACTORY_EXCEPTION with the thrown exception as the cause and null is returned to the caller.

        Specified by:
        getService in interface ServiceFactory<S>
        Parameters:
        bundle - The bundle requesting the service.
        registration - The ServiceRegistration object for the requested service.
        Returns:
        A service object that must be an instance of all the classes named when the service was registered.
        See Also:
        ServiceObjects.getService()