You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Craig Dickson <cr...@gmail.com> on 2010/02/05 23:40:32 UTC

ConfigurationAdmin vs PreferencesService

Hi,

I am developing a plugin model for a Swing based application.

The plugins are currently being deployed as OSGi Services and these services
will need to be configured by each individual user for their local
requirements/environment etc. using the Swing UI. This configuration data
will need to be persisted to the local filesystem and reloaded when they
launch the application again.

Looking at the OSGi API, I see the ConfigurationAdmin and also the
PreferencesService that both seem to talk about persisting data about
bundles and services.

Can anyone tell me based on my brief requirements above, which one of these
I should be looking at for my needs? Maybe neither of them and I will need
to develop a custom persistence mechanism?

Thanks

==========================
Craig S. Dickson
http://craigsdickson.com
http://twitter.com/craigsdickson

Re: ConfigurationAdmin vs PreferencesService

Posted by Marcel Offermans <ma...@luminis.nl>.
To add to that, take care that the life cycle for both configurations is different. Preferences belong to a bundle, if the bundle goes away, so do its preferences. ConfigAdmin keeps configurations around (before or after the actual service bundle is installed).

Based on your brief requirements, I would prefer ConfigAdmin.

Greetings, Marcel


On Feb 6, 2010, at 1:21 , Richard S. Hall wrote:

> My view is slightly different:
> 
>   * ConfigAdmin is for externally managed configuration data.
>   * PreferencesService is for application managed preferences and
>     settings.
> 
> But, I agree, I think you could use either depending on the specific scenario.
> 
> -> richard
> 
> On 2/5/10 6:45 PM, Andreas Kollegger wrote:
>> Hi Craig,
>> 
>> The config admin stuff is used for per-installation configuration of
>> individual services. The preferences is more appropriate if you need
>> to store per-user settings for the same installation. At least, that's
>> how I think of them.
>> 
>> For a swing application, I assume you'll have a 1-to-1 relationship
>> of installation to user; so you could use whichever API seems more
>> natural for what you're persisting. For simple text based name/value
>> pair storage, config admin is really easy.
>> 
>> -Andreas
>> 
>> On Feb 5, 2010, at 5:40 PM, Craig Dickson wrote:
>> 
>>   
>>> Hi,
>>> 
>>> I am developing a plugin model for a Swing based application.
>>> 
>>> The plugins are currently being deployed as OSGi Services and these services
>>> will need to be configured by each individual user for their local
>>> requirements/environment etc. using the Swing UI. This configuration data
>>> will need to be persisted to the local filesystem and reloaded when they
>>> launch the application again.
>>> 
>>> Looking at the OSGi API, I see the ConfigurationAdmin and also the
>>> PreferencesService that both seem to talk about persisting data about
>>> bundles and services.
>>> 
>>> Can anyone tell me based on my brief requirements above, which one of these
>>> I should be looking at for my needs? Maybe neither of them and I will need
>>> to develop a custom persistence mechanism?
>>> 
>>> Thanks
>>> 
>>> ==========================
>>> Craig S. Dickson
>>> http://craigsdickson.com
>>> http://twitter.com/craigsdickson
>>>     
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
>>   


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


Re: ConfigurationAdmin vs PreferencesService

Posted by "Richard S. Hall" <he...@ungoverned.org>.
My view is slightly different:

    * ConfigAdmin is for externally managed configuration data.
    * PreferencesService is for application managed preferences and
      settings.

But, I agree, I think you could use either depending on the specific 
scenario.

-> richard

On 2/5/10 6:45 PM, Andreas Kollegger wrote:
> Hi Craig,
>
> The config admin stuff is used for per-installation configuration of
> individual services. The preferences is more appropriate if you need
> to store per-user settings for the same installation. At least, that's
> how I think of them.
>
> For a swing application, I assume you'll have a 1-to-1 relationship
> of installation to user; so you could use whichever API seems more
> natural for what you're persisting. For simple text based name/value
> pair storage, config admin is really easy.
>
> -Andreas
>
> On Feb 5, 2010, at 5:40 PM, Craig Dickson wrote:
>
>    
>> Hi,
>>
>> I am developing a plugin model for a Swing based application.
>>
>> The plugins are currently being deployed as OSGi Services and these services
>> will need to be configured by each individual user for their local
>> requirements/environment etc. using the Swing UI. This configuration data
>> will need to be persisted to the local filesystem and reloaded when they
>> launch the application again.
>>
>> Looking at the OSGi API, I see the ConfigurationAdmin and also the
>> PreferencesService that both seem to talk about persisting data about
>> bundles and services.
>>
>> Can anyone tell me based on my brief requirements above, which one of these
>> I should be looking at for my needs? Maybe neither of them and I will need
>> to develop a custom persistence mechanism?
>>
>> Thanks
>>
>> ==========================
>> Craig S. Dickson
>> http://craigsdickson.com
>> http://twitter.com/craigsdickson
>>      
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

Re: ConfigurationAdmin vs PreferencesService

Posted by Andreas Kollegger <ak...@tembopublic.org>.
Hi Craig,

The config admin stuff is used for per-installation configuration of 
individual services. The preferences is more appropriate if you need
to store per-user settings for the same installation. At least, that's
how I think of them.

For a swing application, I assume you'll have a 1-to-1 relationship
of installation to user; so you could use whichever API seems more
natural for what you're persisting. For simple text based name/value
pair storage, config admin is really easy. 

-Andreas

On Feb 5, 2010, at 5:40 PM, Craig Dickson wrote:

> Hi,
> 
> I am developing a plugin model for a Swing based application.
> 
> The plugins are currently being deployed as OSGi Services and these services
> will need to be configured by each individual user for their local
> requirements/environment etc. using the Swing UI. This configuration data
> will need to be persisted to the local filesystem and reloaded when they
> launch the application again.
> 
> Looking at the OSGi API, I see the ConfigurationAdmin and also the
> PreferencesService that both seem to talk about persisting data about
> bundles and services.
> 
> Can anyone tell me based on my brief requirements above, which one of these
> I should be looking at for my needs? Maybe neither of them and I will need
> to develop a custom persistence mechanism?
> 
> Thanks
> 
> ==========================
> Craig S. Dickson
> http://craigsdickson.com
> http://twitter.com/craigsdickson


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