Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-243

Add support for ServiceFactory components

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • scr-1.0.0
    • None
    • Felix SCR trunk Rev. 515074

    Description

      Currently the SCR bundle only supports delayed components but not ServiceFactory components. That is the servicefactory attribute of the <service> element is in fact ignored. Another issue is, that for each bundle using a delayed component which is NOT a ServiceFactory a new instance of the component is created.

      Attaching a patch which solves the issues as follows:

      • Creates a new inner DelayedServiceFactoryServiceFactory (name is more functional than beautiful) class which supports for ServiceFactory components. Each call to the getService method creates a new instance of the component. The m_implementationObject is never set in this case. The ComponentContext used to call the activate method is kept in an map to use the same ComponentContext to call deactivate when the service is released through the ungetService method.
      • Modified DelayedComponentServiceFactory.getService method to return the m_implementationObject if not null. Otherwise the m_implementationObject is created, bound, activated and returned. The ungetService method is just enhanced with a comment indicating that the delayed component is only deactivated when the component is deactivated. The ComponentContext created by the getService method has the owner bundle field set to null as there is only really a single Component instance shared by all bundles.
      • Modified the invokeBindMethod and invokeUnbindMethods to take the object on which to call the method as a parameter. This accomodates for the DelayedServiceFactoryServiceFactory which never sets the m_implementationObject field.

      Attachments

        1. FELIX-243_2.diff
          18 kB
          Felix Meschberger
        2. FELIX-243.diff
          18 kB
          Felix Meschberger

        Activity

          People

            rickhall Richard S. Hall
            fmeschbe Felix Meschberger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: