You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Tom Remoleur <to...@ulp.u-strasbg.fr> on 2008/02/11 10:07:26 UTC

Questions about configuration admin service

Hi everyone,

I'm using felix configuration admin implementation since long time now and  
it's works great, but I've got some big problems with the OSGI  
configuration admin specification :
When a update() is called on a configuration, the configuration admin  
service, first, will store the configuration and after, will schedule the  
call of the updated function on the ManagedService

My problems are here :
-If during the execution of ManagedService.updated(), the new  
configuration can't be applied, the only way to restore previous  
configuration that I've found is to recall update function on the  
configuration with previous dictionnary.
But this solution need my ManagedService to have a dependance with the  
configuration admin service and so break the white board pattern,  
furthermore, even if I raise a ConfigurationException, a  
ConfigurationEvent.CM_UPDATED is fired and can create some bugs in my  
application.

-My second problem is when a suthdown or a crash occurs after the  
configuration is save but before that the ManagedService.updated()  
function was called, if the configuration was good, no problems, but if  
the new configuration has problems, I can't restore the previous  
configuration after my application restart.
The solution that I've found is to add a function in my PersistanceManager  
to really store the configuration on disk, and I call this function when  
the ManagedService.updated() function succesfully execute. But to do this  
I need a dependance with my persistanceManager and it's not really clean.

Now I thinks to create my custom configuration admin implementation but  
before, do you know standards solutions for these problems ? I've search  
in the OSGI specifications but I've don't find anythink.

Regards,
Tom

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


Re: Questions about configuration admin service

Posted by Karl Pauls <ka...@gmail.com>.
On Feb 13, 2008 2:51 PM, Felix Meschberger <fm...@gmail.com> wrote:
> Hi Tom,
>
> Am Dienstag, den 12.02.2008, 10:19 +0100 schrieb Tom Remoleur:
> > Hi Felix,
> >
> > Thanks you, it's a good idea to persist the good configuration directly in
> > the ManagedService, I can't completly apply your solution because my
> > application use an unique XML configuration file, but that isn't a
> > problem, I found how to do that cleanly.
>
> Superb.
>
> > The last problem is about ConfigurationListeners that will received
> > ConfigurationEvent.CM_UPDATED even if the configuration failed to update.
>
> Yes, because this event just tells that the configuration data has been
> modified not that the ManagedService has accepted the modified
> configuration.
>
> > So I will create a new ConfigurationListener system with events
> > (UPDATE_SUCCESS, UPDATE_FAILED) send by my ManagedServices.
> >
> > With all these problems, I thinks that current OSGI configuration admin
> > specification is incomplete. Could OSGI Alliance be interested by these
> > feedbacks in order to do evolve the spec ?
>
> Yes, I thought the same. Because the spec only speaks of management
> agents being interested in failed updates to ManagedServices but do not
> elaborate on the details.
>
> What do others think about a potential extension to the Configuration
> Admin spec in our implementation which sends an event after calling the
> update method: The event would contain something like the PID of the
> ManagedService and optionally any update failure information from the
> update call ?
>
> Regards
> Felix

I think that is a good idea. Maybe bring up the issue on osgi-dev?

regards,

Karl

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



-- 
Karl Pauls
karlpauls@gmail.com

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


Re: Questions about configuration admin service

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Tom,

Am Dienstag, den 12.02.2008, 10:19 +0100 schrieb Tom Remoleur:
> Hi Felix,
> 
> Thanks you, it's a good idea to persist the good configuration directly in  
> the ManagedService, I can't completly apply your solution because my  
> application use an unique XML configuration file, but that isn't a  
> problem, I found how to do that cleanly.

Superb.

> The last problem is about ConfigurationListeners that will received  
> ConfigurationEvent.CM_UPDATED even if the configuration failed to update.  

Yes, because this event just tells that the configuration data has been
modified not that the ManagedService has accepted the modified
configuration.

> So I will create a new ConfigurationListener system with events  
> (UPDATE_SUCCESS, UPDATE_FAILED) send by my ManagedServices.
> 
> With all these problems, I thinks that current OSGI configuration admin  
> specification is incomplete. Could OSGI Alliance be interested by these  
> feedbacks in order to do evolve the spec ?

Yes, I thought the same. Because the spec only speaks of management
agents being interested in failed updates to ManagedServices but do not
elaborate on the details.

What do others think about a potential extension to the Configuration
Admin spec in our implementation which sends an event after calling the
update method: The event would contain something like the PID of the
ManagedService and optionally any update failure information from the
update call ?

Regards
Felix


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


Re: Questions about configuration admin service

Posted by Tom Remoleur <to...@ulp.u-strasbg.fr>.
Hi Felix,

Thanks you, it's a good idea to persist the good configuration directly in  
the ManagedService, I can't completly apply your solution because my  
application use an unique XML configuration file, but that isn't a  
problem, I found how to do that cleanly.
The last problem is about ConfigurationListeners that will received  
ConfigurationEvent.CM_UPDATED even if the configuration failed to update.  
So I will create a new ConfigurationListener system with events  
(UPDATE_SUCCESS, UPDATE_FAILED) send by my ManagedServices.

With all these problems, I thinks that current OSGI configuration admin  
specification is incomplete. Could OSGI Alliance be interested by these  
feedbacks in order to do evolve the spec ?

Regards,
Tom

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


Re: Questions about configuration admin service

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Tom,

Am Montag, den 11.02.2008, 10:07 +0100 schrieb Tom Remoleur:
> Hi everyone,
> 
> I'm using felix configuration admin implementation since long time now and  
> it's works great, 

Thanks ;-)

> but I've got some big problems with the OSGI  
> configuration admin specification :
> When a update() is called on a configuration, the configuration admin  
> service, first, will store the configuration and after, will schedule the  
> call of the updated function on the ManagedService

This is how I understand the Configuration Admin Service specification,
yes.

> 
> My problems are here :
> -If during the execution of ManagedService.updated(), the new  
> configuration can't be applied, the only way to restore previous  
> configuration that I've found is to recall update function on the  
> configuration with previous dictionnary.
> But this solution need my ManagedService to have a dependance with the  
> configuration admin service and so break the white board pattern,  
> furthermore, even if I raise a ConfigurationException, a  
> ConfigurationEvent.CM_UPDATED is fired and can create some bugs in my  
> application.

The easy solution to this problem might be for the ManagedService to
just not update according to the new configuration and throw a
ConfigurationException. This however will not be stable across restarts
of the ManagedService itself.

So the next best thing might be that the ManagedService persists the
valid configuration and only updates this persistent cache if the
provided configuration is valid. You may do this by accessing bundle
private data through BundleContext.getDataFile(String path). So you keep
your own copy of a valid configuration, yet enable being updated through
the Configuration Admin Service.

> 
> -My second problem is when a suthdown or a crash occurs after the  
> configuration is save but before that the ManagedService.updated()  
> function was called, if the configuration was good, no problems, but if  
> the new configuration has problems, I can't restore the previous  
> configuration after my application restart.

If you keep a copy of your good configuration in the bundle's private
data area, you always have a good starting point. Even in the case of a
crash, because your ManagedService will only accept any properties and
overwrite the local cache, if the configuration is valid.

> The solution that I've found is to add a function in my PersistanceManager  
> to really store the configuration on disk, and I call this function when  
> the ManagedService.updated() function succesfully execute. But to do this  
> I need a dependance with my persistanceManager and it's not really clean.

I agree, that this is not the best of all solutions and in fact is quite
fragile and locks you into using the Felix Config Admin service.

Hope this helps.

Regards
Felix


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