You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by "John E. Conlon" <jc...@verticon.com> on 2009/11/15 09:30:09 UTC

[Configuration Admin] Type conversion

How does the Config Admin deal with type conversion between the 
properties oriented *.cfg files (storing Strings) and the updated 
configurations that are sent by the service that may be a non String 
(Integer, Boolean, etc)?

Have worked with another framework that use the Metatype service for 
this kind of conversion, but I am not aware that Felix has a Metatype 
service?? 

Without a Metatype service in Felix, do I have to manage the conversion 
for all non Strings myself?

thanks,

John

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


Re: [Configuration Admin] Type conversion

Posted by "John E. Conlon" <jc...@verticon.com>.
Hi Stuart,

See inline responses...

Stuart McCulloch wrote:
> 2009/11/15 John E. Conlon <jc...@verticon.com>
>
>   
>> How does the Config Admin deal with type conversion between the properties
>> oriented *.cfg files (storing Strings) and the updated configurations that
>> are sent by the service that may be a non String (Integer, Boolean, etc)?
>>
>> Have worked with another framework that use the Metatype service for this
>> kind of conversion, but I am not aware that Felix has a Metatype service??
>> Without a Metatype service in Felix, do I have to manage the conversion for
>> all non Strings myself?
>>
>>     
>
> FYI, Felix does have a metatype service:
>
>    http://felix.apache.org/site/apache-felix-metatype-service.html
>
>    http://www.apache.org/dist/felix/org.apache.felix.metatype-1.0.4.jar
>   
Duh, - that's what I get for working so late:-)  
> also you can often mix service bundles between frameworks - for example,
> there is nothing Felix specific (afaik) about its metatype implementation so
> you could deploy it onto any other OSGi framework (equinox, KF, etc.)
>
> the same is true for most OSGi services, so feel free to mix'n'match
>   
Yes, I have done this with the org.eclipse.equinox.io and 
org.eclipse.equinox.wireadmin as I couldn't find these in Felix when 
(that was during the daytime when I was awake;-).

thanks for the reminder,

John

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


Re: [Configuration Admin] Type conversion

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/11/15 John E. Conlon <jc...@verticon.com>

> How does the Config Admin deal with type conversion between the properties
> oriented *.cfg files (storing Strings) and the updated configurations that
> are sent by the service that may be a non String (Integer, Boolean, etc)?
>
> Have worked with another framework that use the Metatype service for this
> kind of conversion, but I am not aware that Felix has a Metatype service??
> Without a Metatype service in Felix, do I have to manage the conversion for
> all non Strings myself?
>

FYI, Felix does have a metatype service:

   http://felix.apache.org/site/apache-felix-metatype-service.html

   http://www.apache.org/dist/felix/org.apache.felix.metatype-1.0.4.jar

also you can often mix service bundles between frameworks - for example,
there is nothing Felix specific (afaik) about its metatype implementation so
you could deploy it onto any other OSGi framework (equinox, KF, etc.)

the same is true for most OSGi services, so feel free to mix'n'match

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


-- 
Cheers, Stuart

Re: [Configuration Admin] Type conversion

Posted by "John E. Conlon" <jc...@verticon.com>.
Hi Felix,

Felix Meschberger wrote:
> Hi John,
>
> John E. Conlon schrieb:
>   
>> How does the Config Admin deal with type conversion between the
>> properties oriented *.cfg files (storing Strings) and the updated
>> configurations that are sent by the service that may be a non String
>> (Integer, Boolean, etc)?
>>     
>
> It depends on what you mean by "*.cfg" files. Are these the files
> maintained internally by the config admin service ?
>   
No.  But I am not familiar with the files maintained by the config admin 
service at all.  As a matter of fact, another issue I have is with a pid 
configuration that was generated by my manipulating config:xxx commands 
in the console. I don't need this config anymore but I can't really get 
rid of it with config:propdel on the pid itself.  Is there a command for 
completely deleting a config?  Or do I have to manually delete the 
configs?  If so where do these get persisted and how do I interact with 
them? 

> Or is this the files handled by fileinstall ?
>   
Yes the files I was refering to are being managed by the fileinstall.  
I'm adding a my.factory.pid-xxx.cfg configuration properties file to the 
deploy directory.  This config is for a service factory that generates 
wireadmin producer instances.

> In the first case the config admin service internally ensures with type
> tags that properties are read into the correct type when loading.
>
> In fact, the Felix config admin service implementation does not use the
> metatype service: It just stores and loads the data types as they are
> provided in the configuration object. There is no conversion involved.
>   
So if I have a configuration that contains Booleans and Integers,  when 
I create the configuration through the console and the updated method 
returns a dictionary to my ManagedService/Factory all the objects will 
still be Strings because that is what a property file is storing? 


> For fileinstall, I don't know.
>   
One further question - Can the internal configs be combined with hard 
configurations coming in from the fileinstall?  Meaning if one installs 
a config in the deploy directory can one then go into the console and 
still change configurations?  Where would it store changes if it does 
anything at all - in the internal or the external config files?

best regards,
John

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


Re: [Configuration Admin] Type conversion

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

John E. Conlon schrieb:
> How does the Config Admin deal with type conversion between the
> properties oriented *.cfg files (storing Strings) and the updated
> configurations that are sent by the service that may be a non String
> (Integer, Boolean, etc)?

It depends on what you mean by "*.cfg" files. Are these the files
maintained internally by the config admin service ?

Or is this the files handled by fileinstall ?

In the first case the config admin service internally ensures with type
tags that properties are read into the correct type when loading.

In fact, the Felix config admin service implementation does not use the
metatype service: It just stores and loads the data types as they are
provided in the configuration object. There is no conversion involved.

For fileinstall, I don't know.

Regards
Felix

> 
> Have worked with another framework that use the Metatype service for
> this kind of conversion, but I am not aware that Felix has a Metatype
> service??
> Without a Metatype service in Felix, do I have to manage the conversion
> for all non Strings myself?
> 
> thanks,
> 
> John
> 
> ---------------------------------------------------------------------
> 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