I'm using Apache Felix declarative services in my application and I'm looking for a cheat sheet which describes the parameters one can give to the @Reference
annotation. I saw a webpage once which contained a very informative cheat sheet (or table) about it but I can't seem to find it. I think this would be useful for a lot of Felix users out there. The parameters I'm talking about:
MANDATORY_UNARY, MANDATORY_MULTIPLE, OPTIONAL_UNARY, OPTIONAL_MULTIPLE
EVENT, LOOKUP
DYNAMIC, STATIC
GREEDY, RELUCTANT
cardinality is rather straightforward but the others are not clear to me. What do they do and how do they work?
from official OSGI R5 Compendium Spec page 281ff.
Reference Cardinality
The cardinality for a reference can be specified as one of four choices:
Strategy
Policy
The static policy is the most simple policy and is the default policy. A component instance never sees any of the dynamics. Component configurations are deactivated before any bound service for a reference having a static policy becomes unavailable. If a target service is available to replace the bound service which became unavailable, the component configuration must be reactivated and bound to the replacement service.
The dynamic policy is slightly more complex since the component implementation must properly handle changes in the set of bound services that can occur on any thread. With the dynamic policy, SCR can change the set of bound services without deactivating a component configuration. If the component uses the event strategy to access services, then the component instance will be notified of changes in the set of bound services by calls to the bind, and unbind methods.
Policy Option
other felix specific resources
[Felic SCR Annotations] (http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.html)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With