Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-4233

Change distribution component creation from osgi config factories to osgi component factories

    XMLWordPrintableJSON

Details

    Description

      In SLING-4154 we introduced the generation of osgi configs from a settings resource tree. This approach has the advantage of using osgi target bindings but has the disadvantage that it stores the settings in two places (in a resource tree e.g. /etc/.../agents and in osgi configs).

      To overcome this we can generate osgi components directly instead of osgi configs using the ComponentFactory API [1]. That leads to the following setup.

      1. Component providers register a component with componentFactory=sling.disitribution.importer.remote
      2. All registered factories starting with sling.distribution are picked up by the internal DistributionComponentManager [2]
      3. The ResourceBasedComponentFactory [3] listens to content changes in the resource tree and tries to create the corresponding component using the registered factories through [2].

      Note that wiring is still done by osgi as the component factories use target reference to bind the needed subcomponents, however the settings are stored in the resource tree.

      [1] http://www.osgi.org/javadoc/r4v42/org/osgi/service/component/ComponentFactory.html
      [2] https://github.com/apache/sling/blob/05575da39d80fc29ebd5cd4c2087933c6a97323d/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/component/impl/DistributionComponentManager.java
      [3] https://github.com/apache/sling/blob/05575da39d80fc29ebd5cd4c2087933c6a97323d/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/component/impl/ResourceBasedDistributionComponentFactory.java

      Attachments

        Activity

          People

            marett Timothee Maret
            mpetria Marius Petria
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: