THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
@Service(properties={@Property(name="foo", value="bar")})
public class MyServiceImpl implements MyService {
@ConfigurationDependency(pid="MyPid", propagate=true)
void updated(Dictionary conf) {
// "conf" contains foo2=bar2, for example, and since we have set the "propagate" attribute to true, then
// the property will be propagated to our published service ...
}
@Start
Map start() {
// Return some extra properties to be inserted along with our published properties. This map takes
// precedence, and may override some properties specified in our @Service annotation, or some properties
// propagated from our @ConfigurationDependency dependency ...
return new HashMap() {{ put("foo3", "bar3"); }};
}
}
|
...
- foo=bar (specified in our @Service annotation)
- foo2=bar2 (propagated by our ConfigurationDependency dependency)
- foo3=bar3 (specified dynamically in the map returned by from our start method)
Notice that properties returned by the Map takes precedence over other properties, and may override some of them.