Hi Alex, [email protected] schrieb: > Hi out there > > I read the OSGi R4.1 specification about the ConfigurationAdmin and do not > clearly understand > if ConfigurationAdmin.getConfiguration(String pid) must only return > configurations for ManagedService > (singleton) or also configurations for ManagedServiceFactory. > > According to section 104.7.1 (OSGi Service Platform Service Compendium > Release 4, Version 4.1) the > getConfiguration(String pid) method should only return Configuration objects > whose getFactoryPid() method > returns null.
This is very subtle in my opinion. Generally the PID of factory configurations is automatically generated (by the createFactoryConfiguration method). So it is not possible to create a valid factory configuration using the getConfiguration method. But I would say, that if you happen to know the PID of an existing factory configuration and call the getConfiguration() method, you should get back the factory configuration. This is what the Apache Felix implementation does in fact. > > And section 104.7.3 states that existing Configurations should be accessed > using the function > ConfigurationAdmin.listConfigurations(String filter). And > getConfiguration(String pid) should be > use to access single Configurations. What does the expression single > Configuration mean? Is > this expression used to refer to a ManagedService Configuration (singleton) > or does it mean any > Configuration identified by that PID no mather whether it is a factory > configuration or not? "Single" here means a specific configuration you already know by PID in my understanding. The listConfigurations method returns an array of Configuration objects whose configuration properties match the filter. This filter may be as simple as "(service.pid=xxx)" and as complex as involving all sorts of properties. The difference between getConfiguration() and listConfigurations() - apart from the parameters and the return value - is, that listConfigurations() never creates a configuration, while getConfiguration() creates a configuration object for a given PID, if it does not exist. Hope this helps. Regards Felix > > Kind regards > > -Alex > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

