felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohica Jasha <mohica.ja...@gmail.com>
Subject configurationAdmin & update handler
Date Thu, 02 Feb 2012 15:42:03 GMT
Hi,

I have the following configuration dependency and its corresponding update
handler method:

@ConfigurationDependency(pid = "mypid", propagate = true)
void updated(Dictionary<String, ?> properties) throws
ConfigurationException {
    ....
}

If I change the configuration of mypid either by editing the etc/mypid.cfg
or by editing the configurion through the felix-webconsole everything works
fine and the above "updated" method will be called EXACTLY ONCE to handle
the new configuration.

Let's say the content of etc/mypid.cfg is the following:
oldParam = oldValue

THE PART THAT I DON'T GET:
I have implemented a webinterface for my service within the same bundle,
the webinterface through the following operations tries to update the
configuration of mypid:

Configuration config = configurationAdmin.getConfiguration("mypid", null);
Dictionary properties = new Hashtable<String, String>();
properties.put("felix.fileinstall.filename",
"file:/Users/mohica/apps/apache-karaf-2.2.5/etc/mypid.cfg");
properties.put("newParam", "newValue");
config.update(properties);

Now the problem is that the "updated" method will be called TWICE:

First with the following properties:
{service.pid=mypid, newparam=newValue,
felix.fileinstall.filename=file:/Users/mohica/apps/apache-karaf-2.2.5/etc/mypid.cfg}

and the second time with the following properties:
{service.pid=mypid, newparam=newValue,
felix.fileinstall.filename=file:/Users/mohica/apps/apache-karaf-2.2.5/etc/mypid.cfg,
oldparam=oldValue}


Why is it called twice? Am I doing anything wrong?

Mohica

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message