I did misunderstand something. When using a ManagedServiceFactory the value for the name attribute is "servicePid-instanceId", where servicePid is the service pid of the ManagedServiceFactory and instanceId is a label used to uniquely identify a particular service instance.
If this is correct, I can update the Karaf Provisioning page (http://felix.apache.org/site/46-provisioning.html). There also appears to be a bug in FeaturesServiceImpl.java. I think that line 439 should be changed from ... ALIAS_KEY + "=" + pid ... to ... ALIAS_KEY + "=" + factoryPid ... so that existing configurations can be retrieved. Several follow on comments/questions. - I was originally confused by the variable named "factoryPid". A less confusing name would be instanceId since it is definitely not the factory service pid. - The filter used to get the list of configurations searches for a property name ".alias_factory_pid". However checkKey() in the ConfigurationAdmin's CaseInsensitiveDictionary only allows keys to start with an alpha-numeric character and has an addition test to prevent keys from starting or ending with a period. Therefore the filter can be simplified from (|(ALIAS_KEY=factoryPid)(.alias_factory_pid=factoryPid)) to just (ALIAS_KEY=factoryPid) BTW, this same filter also appears in FileMonitor.java in Karaf's deployer. - Would it be reasonable to add the "instanceId" (as I called it above) to the displayed bundle properties in the webconsole? - Should the feature's configurations be deleted when it is uninstalled? If everything that I said above is correct/reasonable, I'll create JIRA issues and start working on patches. Tim Moloney The reasonable man adapts himself to MRSL the world; the unreasonable one persists 2015 Cattlemen Road in trying to adapt the world to himself. Sarasota, FL 34232 Therefore all progress depends on the (941) 377-6775 x208 unreasonable man. George Bernard Shaw > -----Original Message----- > From: Moloney, Tim M [mailto:[email protected]] > Sent: Saturday, June 06, 2009 14:19 > To: [email protected] > Subject: Configuring a ManagedServiceFactory from a feature > > > I was figuring out why my ManagedServiceFactory wasn't getting > configured by the feature when I discovered the odd notation used to > specify the service pid. > > I found that if the name attribute of the config element has a dash in > it, the attribute value will be split into a service pid and a service > factory pid. If I read the code correctly, both the service > pid and the > factory service pid need to be set to the name of the > ManagedServiceFactory. So I managed to get my ManagedServiceFactory > configured by specifying: > > <config > name="com.foo.MyManagedServiceFactory-com.foo.MyManagedService > Factory"> > ... </config> > > However that seems a bit verbose and is just one more place > where a typo > can stop things from working. I think it would be better if > there was a > different attribute name to configure ManagedServiceFactories. For > example, configuring a ManagedService would stay the same: > > <config name="com.foo.MyManagedService"> ... </config> > > But configuring a ManagedServiceFactory would be: > > <config factoryName="com.foo.MyManagedServiceFactory"> ... </config> > > Is this a good idea or do I misunderstand something? > > > Tim Moloney The reasonable man adapts himself to > MRSL the world; the unreasonable one persists > 2015 Cattlemen Road in trying to adapt the world to himself. > Sarasota, FL 34232 Therefore all progress depends on the > (941) 377-6775 x208 unreasonable man. George Bernard Shaw > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

