felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: Can i make the webconsole react to Config Admin Service ConfigurationException?
Date Tue, 08 Sep 2015 15:21:41 GMT
Hi,

the webconsole is creating/updating configurations through config admin.
The config admin simply stores this configuration as-is regardless
whether there is someone using this configuration or not.
That's why the webconsole immediately returns with no error messages.

The new/updated configuration is eventually delivered to the managed
service. Whether that service is happy with the configuration or throws
an exception does not influence the storage of the configuration within
config admin. Therefore the exception you are throwing, is just logged.

Unfortunately metatype does not allow to describe validation rules like
you need and even if there were, the configuration is never checked
against metatype. These specs are loosely coupled.

I don't have an answer on how to exactly solve your problem, but it
would be good to validate the configuration before it hits config admin.

Maybe someone else has a good idea?

Carsten

Am 08.09.15 um 10:51 schrieb Martin Nielsen:
> Hello
> First of, let me say that this is my first time using the Config Admin
> Service, so if i have just completely misunderstood something, please do
> tell.
> 
> I have created a bundle that uses the Configuration Admin and MetaType
> services to handle the configuration. Inside the updated(Dictionary) method
> in my bundle, i have made a few checks that throws a ConfigurationException
> if they fail (Files actualy existing, URLs being well-formed and whatnot).
> 
> I would assume that when the updated(Dictionary) method throws one of these
> exceptions, that they actually be reflected in the WebConsole, but this
> does not seem to occur.
> 
> When i enter a "bad" value for the bundle in the OSGi->Configuration window
> of the web console, the karaf.log sure enough shows.
> 
> 2015-09-07 10:44:30,412 | ERROR | d=TestConsumer1) | configadmin
>            | 3 - org.apache.felix.configadmin - 1.8.4 |
> [org.osgi.service.cm.ManagedService, id=154,
> bundle=93/mvn:com.netdesign.common/managedproperties/0.2-SNAPSHOT]:
> Updating property URLProperty of configuration TestConsumer1 caused a
> problem: Could not load properties. Could not filter value.
> org.osgi.service.cm.ConfigurationException: URLProperty : Could not load
> properties. Could not filter value.
> at
> dk.netdesign.common.osgi.config.ManagedProperties.filterObject(ManagedProperties.java:341)[93:ManagedPropertiesService:0.2.0.SNAPSHOT]
> at
> dk.netdesign.common.osgi.config.ManagedProperties.updated(ManagedProperties.java:222)[93:ManagedPropertiesService:0.2.0.SNAPSHOT]
> at
> org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.4]
> at
> org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.4]
> at
> org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.4]
> at
> org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1747)[3:org.apache.felix.configadmin:1.8.4]
> at
> org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)[3:org.apache.felix.configadmin:1.8.4]
> at java.lang.Thread.run(Thread.java:744)[:1.8.0]
> 
> But there is reaction to this exception in the WebConsole. Furthermore, the
> "bad" value is still written in the field when i open the configuration
> window again, even though it was not added to the bundles configuration(I
> checked).
> 
> Is there something more i need to do in order to make the WebConsole aware
> that an error occured with the configuration?
> 
> Preferably i would like that the WebConsole returned at least the message
> of the ConfigurationException, and did not save bad values. Right now i see
> one value when i open the configuration window, and another value when i
> inspect the bundles configuration.
> 
> Thanks in advance
> -Martin
> 


-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message