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

ipojo @Component with propagation set to true doesn't propagate properties

    Details

      Description

      I use config admin to instantiate my component and I want its property to be deployed with its registered service as a service property.
      According to the documentation, I have to set the flag propagation to true to do so. So my code is like :

      @Component(name="component", propagation=true)
      @Provides
      public class MyComponent implements MyService
      {
      @Property(name="p")
      private String p;

      }

      Then I look to my instance details and I don't see the property attached to the service, it's just attached to the component instance :
      instance name="component.16d0dcc1-ae65-49b9-a7fe-17f6723997db" state="valid" bundle="8" component.type="component"
      handler name="org.apache.felix.ipojo:properties" state="valid"
      property name="p" value="1"
      handler name="org.apache.felix.ipojo:provides" state="valid"
      provides specifications="[test.ipojo.MyService]" state="registered" service.id="50"
      property name="service.pid" value="component.16d0dcc1-ae65-49b9-a7fe-17f6723997db"
      property name="service.factoryPid" value="component"
      property name="factory.name" value="component"
      property name="instance.name" value="component.16d0dcc1-ae65-49b9-a7fe-17f6723997db"
      handler name="org.apache.felix.ipojo:architecture" state="valid"

      Then I tried to add the @ServiceProperty on my property field and I also removed the propgation flag. So my code is now like :

      @Component(name="component")
      @Provides
      public class MyComponent implements MyService
      {
      @Property(name="p")
      @ServiceProperty
      private String p;

      }

      and if I look to my instance details I can see the property attached to both my component and my service :
      instance name="component.c4ee23a1-14c3-447c-93f8-78caf65a8304" state="valid" bundle="8" component.type="component"
      handler name="org.apache.felix.ipojo:properties" state="valid"
      property name="p" value="1"
      handler name="org.apache.felix.ipojo:provides" state="valid"
      provides specifications="[test.ipojo.MyService]" state="registered" service.id="52"
      property name="service.pid" value="component.c4ee23a1-14c3-447c-93f8-78caf65a8304"
      property name="service.factoryPid" value="component"
      property name="p" value="1"
      property name="factory.name" value="component"
      property name="instance.name" value="component.c4ee23a1-14c3-447c-93f8-78caf65a8304"
      handler name="org.apache.felix.ipojo:architecture" state="valid"

      Is it a but with the propagation flag or is the documentation wrong?

        Attachments

          Activity

            People

            • Assignee:
              clement.escoffier Clement Escoffier
              Reporter:
              gdelafosse Guillaume Delafosse
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: