...
- the service publication
- the component instance / service object creation
- the service unregistering
A simple example
...
Code Block | ||||
---|---|---|---|---|
| ||||
<component className="...FooProviderType1"> <provides/> </component> |
Handler providing a Foo Service
The <provides/> element suffice to declare that each instance of this type will provide the FooService. Indeed, the provided interface can be discovered by analyzing the implementation class.
...
Code Block | ||||
---|---|---|---|---|
| ||||
<component className="...FooProviderType1"> <provides interface="{...FooService, ...BarService}"/> </component> |
Instance providing the Foo service and the Bar service
Note: if you use the interface attribute, the handler check that all declared interface are really implemented by the implementation class. If an interface is not implemented, the handler throws an error.
...
The second property is published with the name intProps. This property is not attached to a field, so, we need to declare the property type. All primitive types or objects can be used has property type (for object, the qualified name of the class is used as java.lang.String).
Service Properties Publication
The implementation class set a new value to the m_foo field in the code. When this action occurs, the handler will modify the service publication to update the foo property published value. If a published property value becomes null, the property is unpublished since it has a new value.
If property does not have default value, the instance configuration needs to set a value for each unvalued property. Moreover, the instance can override the property value. The following xml snippet shows the declaration of an instance overriding the property values:
Code Block | ||||
---|---|---|---|---|
| ||||
<instance component="...FooProviderType1" name="myFooServiceProvider"> <property name="foo" value="baz"/> <property name="intProps" value="2"/> </instance> |
Advanced features
...
Code Block |
---|
<component className="...FooProviderType1"> <provides interface="...Foo"/> <provides interface="...Bar"> <property name="foo" value="baz"/> </provides> </component> |
Several publications for one instance
Service Property Propagation
The configuration handler has the possibility to propagate received properties to service publication. So, when the propagation is activated, all properties received by the configuration handler will be propagated to all published service.
Instance reconfiguration
...