You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scr/README.md
+47-1Lines changed: 47 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ The Apache Felix Service Component Runtime described by the [OSGi Declarative Se
4
4
5
5
The Java annotations defined by the specification make implementing components easy and reduce the amount of code that needs be written. These annotations are processed at build time and translated into XML descriptor files which in turn are listed in the `Service-Component` header of the declaring bundle. But the good news is, you usually don't have to worry about this XML, however in case things don't work as expected , it's good to know how these things work.
6
6
7
-
The Apache Felix Declarative Services implementation is the reference implementation for the OSGi Declarative Services Specification Version 1.4 (R7) and therefore passes the OSGi CT.
7
+
The Apache Felix Declarative Services implementation is the reference implementation for the OSGi Declarative Services Specification Version 1.4 (R7) and therefore passes the OSGi CT. This implementation also includes support for OSGi R8 features such as the Satisfying Condition specification.
8
8
9
9
## Example Usage
10
10
@@ -112,6 +112,52 @@ public Comparator(@Reference LogService logService)
112
112
}
113
113
```
114
114
115
+
## Satisfying Condition (OSGi R8)
116
+
117
+
Apache Felix SCR implements the Satisfying Condition feature as specified in the OSGi R8 Declarative Services specification. This feature allows components to be activated only when specific runtime conditions are met.
118
+
119
+
### How It Works
120
+
121
+
When the OSGi framework provides a `true` condition service (registered by the system bundle with the property `osgi.condition.id=true`), Apache Felix SCR automatically adds an implicit satisfying condition reference to all components. This implicit reference:
122
+
123
+
- Has the name `osgi.ds.satisfying.condition`
124
+
- References the `org.osgi.service.condition.Condition` service
125
+
- Uses a dynamic policy
126
+
- Defaults to target `(osgi.condition.id=true)`
127
+
128
+
### Customizing the Satisfying Condition
129
+
130
+
Components can customize the satisfying condition target by setting the `osgi.ds.satisfying.condition.target` property:
Both, the [maven-bundle-plugin](http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html) as well as the [bnd-maven-plugin](https://github.com/bndtools/bnd/tree/master/maven) supports processing the annotations and creating the XML component descriptors.
0 commit comments