Child pages
  • OSGi Component / Felix Declarative Service Style Guide

Versions Compared

Key

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

...

  1. Components must declare a name property set to a custom, author-supplied string literal if the component is to be referenced outside the declaring bundle.
    1. Consider using the constant NAME if it is local to the component, or ending in COMPONENT_NAME if defined in another class or constants file.
      1. We used to call these constants PID when we referred to them as "service PIDs" or "config PIDs".  Be sure to replace PID with NAME when working with old code.
    2. The string literal constant should follow the pseudo packaging format "org.forgerock.openidm.someplace.somecomponent" - use human-friendly names for somplace and somecomponent that tries to encapsulate the area of code and purpose of the component.
    Components 
  2. should Components must not declare a name property if the component is not referenced as a service or is only used inside the declaring bundle.
  3. Components must declare a service property if
    1. they are to be registered as a service
    2. they do not implement an interface
    3. they implement multiple interfaces but the author wants control over which interfaces the component is registered

...