package com.acme.webconf;The PID is defined by the interface name, in this example it is com.acme.webconf.WebConf. This "record" has a port (an integer) and a host name (a String). A bundle that wants to receive this information, only has to register a Configurable<WebConf> service. For example:
public interface WebConf {
int port();
String host();
}
@ComponentNo more type error prone type conversions, no more spelling errors in property names or PIDs! And you're not restricted to a single PID, you can extend the interfaces with other interfaces and each extended interface name will automatically be used as PID, merging all underlying configuration records. Annotations in this specification will also make data validation easier.
public Webserver implements Configurable<WebConf> {
public void setup(WebConf conf ) {
web( conf.port(), conf.host() );
}
public void deleted(WebConf conf) {
stop();
}
}
It is also possible to use factories. In that case, register a ConfigurableFactory
public interface ConfigurableFactory<WebConf> {This specification will make Configuration Admin significantly easier to use.
Configurable<WebConf> newInstance();
void noConfigurations();
}
Peter Kriens
P.S. Did you already register for the community event?
P.S. And did you look at the Masterclass On OSGi (with certificate) in Girona?