Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Any properties specified in the @Service @Component annotation are used to provide the OSGi Service
  • Any properties provided by a FactorySet are also inserted in the published service
  • Any Dependency whose propagate attribute is set to true will also insert its properties to the published service

...

Code Block
@Component(properties={@Property(name="foo", value="bar")})
public class MyServiceImpl implements MyService {
    @ConfigurationDependency(pid="MyPid", propagate=true)
    void updated(Dictionary conf) {
       // "conf" contains foo2=bar2, for example, and since we have set the "propagate" attribute to true, then
       // the property will be propagated to our published service ...
    }

    @Start
    Map start() {
        // Return some extra properties to be inserted along with our published properties. This map takes
        // precedence, and may override some properties specified in our @Service@Component annotation, or some properties
        // propagated from our @ConfigurationDependency dependency ...
        return new HashMap() {{ put("foo3", "bar3"); }};
    }
}

...

  • foo=bar (specified in our @Service @Component annotation)
  • foo2=bar2 (propagated by our ConfigurationDependency dependency)
  • foo3=bar3 (specified dynamically in the map returned from our start method)

...