karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Gardfjäll <peter.gardfjall.w...@gmail.com>
Subject Re: Best practice on propagating configuration errors from ManagedFactoryService to client?
Date Mon, 30 Jan 2012 13:36:20 GMT
Thanks Filippo,

but I believe that a straight service lookup wouldn't work.
I don't think that there are any guarantees that the service instance has
been registered right after the config.update(...) call.
Thus, I would need to wait for the service to appear (how long?), for
example using a ServiceTracker.
Although clearly doable, such a solution sounds a bit ugly/cumbersome.
I was hoping for a more elegant solution.

best regards, Peter

On Mon, Jan 30, 2012 at 2:13 PM, Filippo Balicchia <fbalicchia@gmail.com>wrote:

> Why,
> don't you use a lookup that after the call to the factory check if the
> registration was successful ?
> If lookup fail you  thrown a ServiceUnavailableException.
>
>
> --Filippo
>
> Il 30 gennaio 2012 09:24, Peter Gardfjäll
> <peter.gardfjall.work@gmail.com> ha scritto:
> > Hi all,
> >
> > thought I'd ask this general OSGi question on this list full of
> > OSGi-knowledgeable people.
> > Please tell me if it belongs better on a more OSGi-standard specific
> forum
> > (such as Felix/Equinox perhaps).
> >
> > So I have a ManagedFactoryService that creates service instances and I
> have
> > another (client-)bundle that creates instances by registering new
> > configurations with the factory.
> > What I currently find difficult is to propagate errors (such as a
> required
> > configuration property missing) from the ManagedFactoryService to the
> > client.
> >
> > When the client uses an invalid configuration dictionary to instantiate a
> > new service instance as follows
> >
> >         // instantiate new service with serviceConfig as instantiation
> > parameters
> >         Configuration config =
> > configurationAdmin.createFactoryConfiguration(factoryPid, null);
> >         config.update(serviceConfig);
> >
> > no exception is raised despite the ManagedFactoryService throwing a
> > ConfigurationException.
> > I guess this is expected since configuration updates are handled on a
> > separate thread of execution.
> > But this is problematic since, from the client bundle's perspective, the
> > configuration update appears to have been successful.
> >
> > So what I really need to know is if there is a best practice for
> propagating
> > the configuration error from the ManagedFactoryService to the client?
> > Any suggestions would be appreciated.
> >
> > best regards, Peter
>

Mime
View raw message