There is a quite typical pattern I see in many uses of
ManagedServiceFactory in karaf.
The config is created as a file with a name like
etc/<factoryPid>-<name>.cfg.
I think this is a good thing as for many types of configs the naming
makes sense. For example in pax jdbc it is used by convention as the
name of the data source.
The problem is that in ConfigurationAdmin there is only one way to
create a config for a factory:
Configuration createFactoryConfiguration(java.lang.String factoryPid)
The real id of the config is created as a random string.
So it is not possible to know the name given from the spec perspective.
In pax jdbc and many other cases we worked around this by creating an
additional property for this name. This is a bit redundant though. Even
more the file name can differ from this property value and so mislead
the user.
I know that the config admin spec does not look into mapping to files
but it would make sense to provide all data to make the mapping easy.
So my proposal is to allow to add an id in the creation:
Configuration createFactoryConfiguration(String factoryPid, String name)
The full config pid could then match the file name we use above.
This change would make it much easier t map between the files and the
configs. Config admin could the also add the name/id as a property to
the config.
What do you think?
Christian
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev