...
Examples
XML Metadata
Panel | |||||
---|---|---|---|---|---|
<Provides> <DynamicProperty name="language" value="fr" field="language"/> </Provides> <ConfigurableProperty field="language" name="lang"/> <ConfigurableProperty field="user" value="Clement"/> </Component> </iPOJO>
|
In the previous snippet, you can see two three configurable properties. The first is a configurable property attached to the field language foo that is a service property too. Therefore, when a new configuration is pushed, the published service properties changes too. The second configurable property just pushed a value to the field user. But this property has an initial value: "Clement".The second is an array property. The third property is a static property, in the sense that no field is attached to this property.
These three properties are configured by the instance configuration.
The attribute configurable="true" allows the exposition of the ManagedService service. Therefore, when a new configuration is pushed, the published service properties changes tooThe name attribute of the component element is the name of the component. The configuration admin uses this the name of the instance to know which configuration is associated with which component instance. The name needs to be unique for the framework. If the attribute name does not exist, the class name is used as name.
Manifest Metadata
The following code snippet shows you the same metadata but in the manifest format:
Panel |
---|
Component { $className=fr.imag.adele.escoffier.hello.impl.HelloServiceImpl $name=Adele.HelloService |
Technical Explanations
Technical Explanations
This handler has two capacity :
- first, pushing instance configuration to the component instance
- and allowing the dynamic configuration of these properties
The second point is not enable by default. To enable it, the attribute configurable need to be true. Then the handlers In fact, when an iPOJO container uses one or several configurable property, it provides the "org.osgi.service.cm.ManagedService" service. Therefore, the configuration admin looks for all this services and manages (push or update) configurations to the components.
When the configuration admin push a configuration to a component, the configurable property value change but it diffuses the change to service property if needed.
Limitation and perspectives
The configuration admin uses two kind of service the ManagedService and the ManagedServiceFactory. Today, iPOJO support only ManagedService. Therefore, one of the next improvements of the configuration feature is to support the ManagedServiceFactory.