Well I now have this working seemingly quite well: * DatabaseProviderAdmin component with associated configuration, registers a DatabaseProvider service when update() is called with a valid configuration, and unregisters when null is passed in. * Entity Manager component has a reference to a DatabaseProvider service with policy="dynamic" which enables its hibernate discovery extender/session factory service registration when a DatabaseProvider is set, disabling it and unregistering the sessionFactory when the component is deactivated. * Other services/bundles use the SessionFactory as normal.
Things to note: Spring-DM's @ServiceReference annotation is darn handy for easily looking up a service and injecting it into your beans, but doesn't provide a set/unset notification process (spring-dm's <osgi:reference> element however does). The use of @ServiceReference sent my code, and my thought process down a tunnel of 'the service is always there'. Once I backtracked and started just using SCR and got my mindset refocused things started to fall rather simply into shape. On Mon, Aug 4, 2008 at 5:06 PM, Mark Derricutt <[EMAIL PROTECTED]> wrote: > 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. > -- "It is easier to optimize correct code than to correct optimized code." -- Bill Harlan

