Hey all,

I was wondering if anyone could point in the right direction for a 'best
practice' in using the configuration admin service.

In my current setup I have database credentials nastily defined as system
properties and a DatabaseProvider interface/implementation that returns
them.  DatabaseProvider instances are used by two other components: admin
and statistics who live in separate bundles.

Now that I'm wanting to move to using the configuration admin service, I'm
finding difficulty with the fact that no configuration can exist (at least
on services that want immediate action taken).  Currently, I have an
AdminService and a StatisticsService depending on the DatabaseProvider
service, which is fine when a configuration exists, but in the case where no
configuration currently exists, or the configuration is changed/removed
things blow up.

What I need is a way to listen to the fact that the DatabaseProvider has
been updated with new configuration details, and react accordingly on the
dependant service.

Whats the best way of handling this?  Would I be better off having say a
DatabaseCredentials service, which registers a DatabaseProvider service in
its ManagedService#updated() method (and deregisters accordingly) and have
AdminService depend on that (allowing me to react on an
(set|unset)DatabaseProvider() method) or some other way?

Thanks,
Mark



-- 
"It is easier to optimize correct code than to correct optimized code." --
Bill Harlan

Reply via email to