Type: New Feature
Affects Version/s: scr-1.0.6
Fix Version/s: scr-1.2.0
Environment:OSGi RFC-0134, OSGi R4.2 Early Draft 2 (http://www.osgi.org/download/osgi-4.2-early-draft2.pdf)
A way is needed for the component declaration to say only create a component configuration IF there is a Configuration( or Configurations).
To support this, the follow attribute is added to the component element:
<attribute name="configuration-policy" type="scr:Tconfiguration-policy"
default="optional" use="optional" />
<enumeration value="optional" />
<enumeration value="require" />
<enumeration value="ignore" />
If the attribute is present and set to require, then a component cannot be satisfied (section 112.5.2) unless there is a Configuration in ConfigurationAdmin for the component. In this situation, the No Configuration case in 112.7 does not apply.If the component is a Factory Component and the component is not satisfied because there is no Configuration present, then the ComponentFactory service will not be registered.
If the attribute is present and set to ignore, then ConfigurationAdmin will not be consulted for the component. In this situation, only the No Configuration case in 112.7 applies.
If the attribute is not present or present and set to optional, then SCR will act as it did prior to this RFC. That is, a Configuration will be used if present in ConfigurationAdmin.