You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by LongkerDandy <lo...@gmail.com> on 2010/10/13 05:55:52 UTC

ConfigAdmin change the files location

Hi

I'm try to use ConfigAdmin to save and load configurations.
The default place of the configurations is under the cache folder and deep
into the ConfigAdmin bundle.

I don't know it is designed like this.
I should suppose to have some pre-defined configuration values,
And when I deliver my software there is no cache folder, how can I put i
into this.

I try to change the configuration location to the felix/conf folder like
this:
felix.cm.dir=../../../conf

But it complains about ".." reference.

I also wondered if I can use the default "config.properties" with
ConfigAdmin

Regards
LongkerDandy

Re: ConfigAdmin change the files location

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

On 13.10.2010 15:01, LongkerDandy wrote:
> I read in another thread that the change made by ConfigAdmin will not
> propagated back to FileInstall.
> Too bad for this.
> 
> Is this going to be fixed?

Yes, chances are that there will be a fix as of
https://issues.apache.org/jira/browse/FELIX-2571. But I cannot say, when.

Regards
Felix

> Or I need a another solution?
> 
> On Wed, Oct 13, 2010 at 8:50 PM, LongkerDandy <lo...@gmail.com>wrote:
> 
>> Hi
>>
>> Try to using FileInstall and ConfigAdmin together.
>> I can read the config properties from ConfigAdmin,
>> But I have problem to write it back.
>> Both FileInstall .cfg file and ConfigAdmin cache .config filw won't update.
>> My code is like:
>>
>>             Configuration config =
>> configAdmin.getConfiguration("xxx.xxx.xxx.xxx");
>>             props = config.getProperties();
>>             props = new Hashtable();
>>             props.put("xxx", "xxx");
>>             config.update(props);
>>
>> Any clue?
>>
>> Thanks
>> LongkerDandy
>>
>>
>>
>> On Wed, Oct 13, 2010 at 3:21 PM, Felix Meschberger <fm...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> Just to clarify what the OSGi Configuration Admin Service is all about:
>>>
>>>  - Allows Management Agents (administrators, tools, whatever) to manage
>>>    configuration
>>>  - Delivers configuration to interested parties
>>>  - Persistently stores configuration
>>>
>>> A Configuration basically is just a Dictionary whose keys are strings
>>> (case-insensitive) and whose values are of a limited set of types,
>>> basically primitive types, their wrappers plus Collections or Arrays
>>> thereof. (For the OSGi R 4.3 release it is planed to have more
>>> interesting ways to describe configuration....)
>>>
>>> Back to your question: Yes you can use Configuration Admin for your
>>> configuration and yes you can put into the configuration whatever you
>>> want.
>>>
>>> To manage configuration you have a number of tools at your disposal:
>>>
>>>  - Use the Web Console allowing for a simple GUI to configure values
>>>     (makes use of the Metatype Service to describe configurations)
>>>  - Use File Install to provide preconfigured configuration files to
>>>     be loaded into the Configuration Admin service automatically.
>>>     This tool also recognizes changes to files and thus updates
>>>     configuration.
>>>  - Do it yourself coding an application using the Configuration Admin
>>>     Service API...
>>>
>>> IIRC the configuration files processed by File Install are more or less
>>> pure property files.
>>>
>>> Regards
>>> Felix
>>>
>>> On 13.10.2010 09:05, Christian Schneider wrote:
>>>>  Hi,
>>>>
>>>> I am currently also evaluating the config admin service. I ported a
>>>> spring application to osgi and now have the problem where to put the
>>>> properties files. The property files contain db and jms connection
>>> infos.
>>>> Is config admin service the right tool for this job?
>>>>
>>>> I already succeeded in creating the config programmatically and using it
>>>> in spring with help of the spring osgi config admin support. As
>>>> implementation I used the felix cm bundle. What I do not like is that
>>>> the persisted files contain additional information compared to the
>>>> normal property files. So it is quite difficult to create and change
>>>> them by hand. If I only put the original properties into the file I even
>>>> get a nullpointer exception.
>>>> Is it possible to conffigure felix cm to work with pure propety files
>>>> that do not contain additional information or would you recommand
>>>> another aproach?
>>>>
>>>> Thanks
>>>>
>>>> Christian
>>>>
>>>>
>>>> Am 13.10.2010 08:14, schrieb Felix Meschberger:
>>>>> Hi,
>>>>>
>>>>> On 13.10.2010 05:55, LongkerDandy wrote:
>>>>>> Hi
>>>>>>
>>>>>> I'm try to use ConfigAdmin to save and load configurations.
>>>>>> The default place of the configurations is under the cache folder and
>>>>>> deep
>>>>>> into the ConfigAdmin bundle.
>>>>>>
>>>>>> I don't know it is designed like this.
>>>>> Yes, the default location is the bundle private data area provided by
>>>>> the framework through the BundleContext.getDataFile(String) method.
>>>>>
>>>>>> I should suppose to have some pre-defined configuration values,
>>>>>> And when I deliver my software there is no cache folder, how can I put
>>> i
>>>>>> into this.
>>>>>>
>>>>>> I try to change the configuration location to the felix/conf folder
>>> like
>>>>>> this:
>>>>>> felix.cm.dir=../../../conf
>>>>>>
>>>>>> But it complains about ".." reference.
>>>>>>
>>>>>> I also wondered if I can use the default "config.properties" with
>>>>>> ConfigAdmin
>>>>> You can use and you can change the setup.
>>>>>
>>>>> BUT: This is not to inject default configuration. This data area must
>>> be
>>>>> configured private to the Configuration Admin service because changes
>>>>> are expected to only be carried out by the Configuration Admin service.
>>>>>
>>>>> If you want to provide "default" configuration you might want to
>>>>> consider FileInstall and provide respective .cfg files. See [1] for
>>> more
>>>>> details.
>>>>>
>>>>> Hope this helps.
>>>>>
>>>>> Regards
>>>>> Felix
>>>>>
>>>>> [1] http://felix.apache.org/site/apache-felix-file-install.html
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>>
>>
> 

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


Re: ConfigAdmin change the files location

Posted by LongkerDandy <lo...@gmail.com>.
I read in another thread that the change made by ConfigAdmin will not
propagated back to FileInstall.
Too bad for this.

Is this going to be fixed?
Or I need a another solution?

On Wed, Oct 13, 2010 at 8:50 PM, LongkerDandy <lo...@gmail.com>wrote:

> Hi
>
> Try to using FileInstall and ConfigAdmin together.
> I can read the config properties from ConfigAdmin,
> But I have problem to write it back.
> Both FileInstall .cfg file and ConfigAdmin cache .config filw won't update.
> My code is like:
>
>             Configuration config =
> configAdmin.getConfiguration("xxx.xxx.xxx.xxx");
>             props = config.getProperties();
>             props = new Hashtable();
>             props.put("xxx", "xxx");
>             config.update(props);
>
> Any clue?
>
> Thanks
> LongkerDandy
>
>
>
> On Wed, Oct 13, 2010 at 3:21 PM, Felix Meschberger <fm...@gmail.com>wrote:
>
>> Hi,
>>
>> Just to clarify what the OSGi Configuration Admin Service is all about:
>>
>>  - Allows Management Agents (administrators, tools, whatever) to manage
>>    configuration
>>  - Delivers configuration to interested parties
>>  - Persistently stores configuration
>>
>> A Configuration basically is just a Dictionary whose keys are strings
>> (case-insensitive) and whose values are of a limited set of types,
>> basically primitive types, their wrappers plus Collections or Arrays
>> thereof. (For the OSGi R 4.3 release it is planed to have more
>> interesting ways to describe configuration....)
>>
>> Back to your question: Yes you can use Configuration Admin for your
>> configuration and yes you can put into the configuration whatever you
>> want.
>>
>> To manage configuration you have a number of tools at your disposal:
>>
>>  - Use the Web Console allowing for a simple GUI to configure values
>>     (makes use of the Metatype Service to describe configurations)
>>  - Use File Install to provide preconfigured configuration files to
>>     be loaded into the Configuration Admin service automatically.
>>     This tool also recognizes changes to files and thus updates
>>     configuration.
>>  - Do it yourself coding an application using the Configuration Admin
>>     Service API...
>>
>> IIRC the configuration files processed by File Install are more or less
>> pure property files.
>>
>> Regards
>> Felix
>>
>> On 13.10.2010 09:05, Christian Schneider wrote:
>> >  Hi,
>> >
>> > I am currently also evaluating the config admin service. I ported a
>> > spring application to osgi and now have the problem where to put the
>> > properties files. The property files contain db and jms connection
>> infos.
>> > Is config admin service the right tool for this job?
>> >
>> > I already succeeded in creating the config programmatically and using it
>> > in spring with help of the spring osgi config admin support. As
>> > implementation I used the felix cm bundle. What I do not like is that
>> > the persisted files contain additional information compared to the
>> > normal property files. So it is quite difficult to create and change
>> > them by hand. If I only put the original properties into the file I even
>> > get a nullpointer exception.
>> > Is it possible to conffigure felix cm to work with pure propety files
>> > that do not contain additional information or would you recommand
>> > another aproach?
>> >
>> > Thanks
>> >
>> > Christian
>> >
>> >
>> > Am 13.10.2010 08:14, schrieb Felix Meschberger:
>> >> Hi,
>> >>
>> >> On 13.10.2010 05:55, LongkerDandy wrote:
>> >>> Hi
>> >>>
>> >>> I'm try to use ConfigAdmin to save and load configurations.
>> >>> The default place of the configurations is under the cache folder and
>> >>> deep
>> >>> into the ConfigAdmin bundle.
>> >>>
>> >>> I don't know it is designed like this.
>> >> Yes, the default location is the bundle private data area provided by
>> >> the framework through the BundleContext.getDataFile(String) method.
>> >>
>> >>> I should suppose to have some pre-defined configuration values,
>> >>> And when I deliver my software there is no cache folder, how can I put
>> i
>> >>> into this.
>> >>>
>> >>> I try to change the configuration location to the felix/conf folder
>> like
>> >>> this:
>> >>> felix.cm.dir=../../../conf
>> >>>
>> >>> But it complains about ".." reference.
>> >>>
>> >>> I also wondered if I can use the default "config.properties" with
>> >>> ConfigAdmin
>> >> You can use and you can change the setup.
>> >>
>> >> BUT: This is not to inject default configuration. This data area must
>> be
>> >> configured private to the Configuration Admin service because changes
>> >> are expected to only be carried out by the Configuration Admin service.
>> >>
>> >> If you want to provide "default" configuration you might want to
>> >> consider FileInstall and provide respective .cfg files. See [1] for
>> more
>> >> details.
>> >>
>> >> Hope this helps.
>> >>
>> >> Regards
>> >> Felix
>> >>
>> >> [1] http://felix.apache.org/site/apache-felix-file-install.html
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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: ConfigAdmin change the files location

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

On 13.10.2010 14:50, LongkerDandy wrote:
> Hi
> 
> Try to using FileInstall and ConfigAdmin together.
> I can read the config properties from ConfigAdmin,
> But I have problem to write it back.
> Both FileInstall .cfg file and ConfigAdmin cache .config filw won't update.

Yes and no: Yes, FileInstall will not currently write back changes.
There is an enhancement request for this
(https://issues.apache.org/jira/browse/FELIX-2571).

But the ConfigurationAdmin internal persistance file is certainly
written back. But this is not your consumption ;-)

> My code is like:
> 
>             Configuration config =
> configAdmin.getConfiguration("xxx.xxx.xxx.xxx");
>             props = config.getProperties();
>             props = new Hashtable();

Beware: I suggest you only create a new Hashtable() if getProperties()
returns null (if the configuration is new). For an existing
configuration, I would rather just update the modified properties.

Regards
Felix

>             props.put("xxx", "xxx");
>             config.update(props);
> 
> Any clue?
> 
> Thanks
> LongkerDandy
> 
> 
> On Wed, Oct 13, 2010 at 3:21 PM, Felix Meschberger <fm...@gmail.com>wrote:
> 
>> Hi,
>>
>> Just to clarify what the OSGi Configuration Admin Service is all about:
>>
>>  - Allows Management Agents (administrators, tools, whatever) to manage
>>    configuration
>>  - Delivers configuration to interested parties
>>  - Persistently stores configuration
>>
>> A Configuration basically is just a Dictionary whose keys are strings
>> (case-insensitive) and whose values are of a limited set of types,
>> basically primitive types, their wrappers plus Collections or Arrays
>> thereof. (For the OSGi R 4.3 release it is planed to have more
>> interesting ways to describe configuration....)
>>
>> Back to your question: Yes you can use Configuration Admin for your
>> configuration and yes you can put into the configuration whatever you want.
>>
>> To manage configuration you have a number of tools at your disposal:
>>
>>  - Use the Web Console allowing for a simple GUI to configure values
>>     (makes use of the Metatype Service to describe configurations)
>>  - Use File Install to provide preconfigured configuration files to
>>     be loaded into the Configuration Admin service automatically.
>>     This tool also recognizes changes to files and thus updates
>>     configuration.
>>  - Do it yourself coding an application using the Configuration Admin
>>     Service API...
>>
>> IIRC the configuration files processed by File Install are more or less
>> pure property files.
>>
>> Regards
>> Felix
>>
>> On 13.10.2010 09:05, Christian Schneider wrote:
>>>  Hi,
>>>
>>> I am currently also evaluating the config admin service. I ported a
>>> spring application to osgi and now have the problem where to put the
>>> properties files. The property files contain db and jms connection infos.
>>> Is config admin service the right tool for this job?
>>>
>>> I already succeeded in creating the config programmatically and using it
>>> in spring with help of the spring osgi config admin support. As
>>> implementation I used the felix cm bundle. What I do not like is that
>>> the persisted files contain additional information compared to the
>>> normal property files. So it is quite difficult to create and change
>>> them by hand. If I only put the original properties into the file I even
>>> get a nullpointer exception.
>>> Is it possible to conffigure felix cm to work with pure propety files
>>> that do not contain additional information or would you recommand
>>> another aproach?
>>>
>>> Thanks
>>>
>>> Christian
>>>
>>>
>>> Am 13.10.2010 08:14, schrieb Felix Meschberger:
>>>> Hi,
>>>>
>>>> On 13.10.2010 05:55, LongkerDandy wrote:
>>>>> Hi
>>>>>
>>>>> I'm try to use ConfigAdmin to save and load configurations.
>>>>> The default place of the configurations is under the cache folder and
>>>>> deep
>>>>> into the ConfigAdmin bundle.
>>>>>
>>>>> I don't know it is designed like this.
>>>> Yes, the default location is the bundle private data area provided by
>>>> the framework through the BundleContext.getDataFile(String) method.
>>>>
>>>>> I should suppose to have some pre-defined configuration values,
>>>>> And when I deliver my software there is no cache folder, how can I put
>> i
>>>>> into this.
>>>>>
>>>>> I try to change the configuration location to the felix/conf folder
>> like
>>>>> this:
>>>>> felix.cm.dir=../../../conf
>>>>>
>>>>> But it complains about ".." reference.
>>>>>
>>>>> I also wondered if I can use the default "config.properties" with
>>>>> ConfigAdmin
>>>> You can use and you can change the setup.
>>>>
>>>> BUT: This is not to inject default configuration. This data area must be
>>>> configured private to the Configuration Admin service because changes
>>>> are expected to only be carried out by the Configuration Admin service.
>>>>
>>>> If you want to provide "default" configuration you might want to
>>>> consider FileInstall and provide respective .cfg files. See [1] for more
>>>> details.
>>>>
>>>> Hope this helps.
>>>>
>>>> Regards
>>>> Felix
>>>>
>>>> [1] http://felix.apache.org/site/apache-felix-file-install.html
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
> 

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


Re: ConfigAdmin change the files location

Posted by LongkerDandy <lo...@gmail.com>.
Hi

Try to using FileInstall and ConfigAdmin together.
I can read the config properties from ConfigAdmin,
But I have problem to write it back.
Both FileInstall .cfg file and ConfigAdmin cache .config filw won't update.
My code is like:

            Configuration config =
configAdmin.getConfiguration("xxx.xxx.xxx.xxx");
            props = config.getProperties();
            props = new Hashtable();
            props.put("xxx", "xxx");
            config.update(props);

Any clue?

Thanks
LongkerDandy


On Wed, Oct 13, 2010 at 3:21 PM, Felix Meschberger <fm...@gmail.com>wrote:

> Hi,
>
> Just to clarify what the OSGi Configuration Admin Service is all about:
>
>  - Allows Management Agents (administrators, tools, whatever) to manage
>    configuration
>  - Delivers configuration to interested parties
>  - Persistently stores configuration
>
> A Configuration basically is just a Dictionary whose keys are strings
> (case-insensitive) and whose values are of a limited set of types,
> basically primitive types, their wrappers plus Collections or Arrays
> thereof. (For the OSGi R 4.3 release it is planed to have more
> interesting ways to describe configuration....)
>
> Back to your question: Yes you can use Configuration Admin for your
> configuration and yes you can put into the configuration whatever you want.
>
> To manage configuration you have a number of tools at your disposal:
>
>  - Use the Web Console allowing for a simple GUI to configure values
>     (makes use of the Metatype Service to describe configurations)
>  - Use File Install to provide preconfigured configuration files to
>     be loaded into the Configuration Admin service automatically.
>     This tool also recognizes changes to files and thus updates
>     configuration.
>  - Do it yourself coding an application using the Configuration Admin
>     Service API...
>
> IIRC the configuration files processed by File Install are more or less
> pure property files.
>
> Regards
> Felix
>
> On 13.10.2010 09:05, Christian Schneider wrote:
> >  Hi,
> >
> > I am currently also evaluating the config admin service. I ported a
> > spring application to osgi and now have the problem where to put the
> > properties files. The property files contain db and jms connection infos.
> > Is config admin service the right tool for this job?
> >
> > I already succeeded in creating the config programmatically and using it
> > in spring with help of the spring osgi config admin support. As
> > implementation I used the felix cm bundle. What I do not like is that
> > the persisted files contain additional information compared to the
> > normal property files. So it is quite difficult to create and change
> > them by hand. If I only put the original properties into the file I even
> > get a nullpointer exception.
> > Is it possible to conffigure felix cm to work with pure propety files
> > that do not contain additional information or would you recommand
> > another aproach?
> >
> > Thanks
> >
> > Christian
> >
> >
> > Am 13.10.2010 08:14, schrieb Felix Meschberger:
> >> Hi,
> >>
> >> On 13.10.2010 05:55, LongkerDandy wrote:
> >>> Hi
> >>>
> >>> I'm try to use ConfigAdmin to save and load configurations.
> >>> The default place of the configurations is under the cache folder and
> >>> deep
> >>> into the ConfigAdmin bundle.
> >>>
> >>> I don't know it is designed like this.
> >> Yes, the default location is the bundle private data area provided by
> >> the framework through the BundleContext.getDataFile(String) method.
> >>
> >>> I should suppose to have some pre-defined configuration values,
> >>> And when I deliver my software there is no cache folder, how can I put
> i
> >>> into this.
> >>>
> >>> I try to change the configuration location to the felix/conf folder
> like
> >>> this:
> >>> felix.cm.dir=../../../conf
> >>>
> >>> But it complains about ".." reference.
> >>>
> >>> I also wondered if I can use the default "config.properties" with
> >>> ConfigAdmin
> >> You can use and you can change the setup.
> >>
> >> BUT: This is not to inject default configuration. This data area must be
> >> configured private to the Configuration Admin service because changes
> >> are expected to only be carried out by the Configuration Admin service.
> >>
> >> If you want to provide "default" configuration you might want to
> >> consider FileInstall and provide respective .cfg files. See [1] for more
> >> details.
> >>
> >> Hope this helps.
> >>
> >> Regards
> >> Felix
> >>
> >> [1] http://felix.apache.org/site/apache-felix-file-install.html
> >>
> >> ---------------------------------------------------------------------
> >> 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: ConfigAdmin change the files location

Posted by Christian Schneider <ch...@die-schneider.net>.
  Thanks to all who responded.

I am now using fileinstall and config admin together like sugested.
The config file is read by fileinstall and put into a managedservice. 
Then I use spring osgi cm support to bring the properties into spring.
For me this works well as I do not need to write back changes at the moment.

Compared to my first solution when I was using config admin directly 
this aproach has the advantage that I can use plain properties files. 
This is much
better than the cache files from config admin service which have a quite 
special syntax.

Thanks

Christian


Am 13.10.2010 09:21, schrieb Felix Meschberger:
> Hi,
>
> Just to clarify what the OSGi Configuration Admin Service is all about:
>
>    - Allows Management Agents (administrators, tools, whatever) to manage
>      configuration
>    - Delivers configuration to interested parties
>    - Persistently stores configuration
>
> A Configuration basically is just a Dictionary whose keys are strings
> (case-insensitive) and whose values are of a limited set of types,
> basically primitive types, their wrappers plus Collections or Arrays
> thereof. (For the OSGi R 4.3 release it is planed to have more
> interesting ways to describe configuration....)
>
> Back to your question: Yes you can use Configuration Admin for your
> configuration and yes you can put into the configuration whatever you want.
>
> To manage configuration you have a number of tools at your disposal:
>
>    - Use the Web Console allowing for a simple GUI to configure values
>       (makes use of the Metatype Service to describe configurations)
>    - Use File Install to provide preconfigured configuration files to
>       be loaded into the Configuration Admin service automatically.
>       This tool also recognizes changes to files and thus updates
>       configuration.
>    - Do it yourself coding an application using the Configuration Admin
>       Service API...
>
> IIRC the configuration files processed by File Install are more or less
> pure property files.
>
> Regards
> Felix
>
> On 13.10.2010 09:05, Christian Schneider wrote:
>>   Hi,
>>
>> I am currently also evaluating the config admin service. I ported a
>> spring application to osgi and now have the problem where to put the
>> properties files. The property files contain db and jms connection infos.
>> Is config admin service the right tool for this job?
>>
>> I already succeeded in creating the config programmatically and using it
>> in spring with help of the spring osgi config admin support. As
>> implementation I used the felix cm bundle. What I do not like is that
>> the persisted files contain additional information compared to the
>> normal property files. So it is quite difficult to create and change
>> them by hand. If I only put the original properties into the file I even
>> get a nullpointer exception.
>> Is it possible to conffigure felix cm to work with pure propety files
>> that do not contain additional information or would you recommand
>> another aproach?
>>
>> Thanks
>>
>> Christian
>>
>>
>> Am 13.10.2010 08:14, schrieb Felix Meschberger:
>>> Hi,
>>>
>>> On 13.10.2010 05:55, LongkerDandy wrote:
>>>> Hi
>>>>
>>>> I'm try to use ConfigAdmin to save and load configurations.
>>>> The default place of the configurations is under the cache folder and
>>>> deep
>>>> into the ConfigAdmin bundle.
>>>>
>>>> I don't know it is designed like this.
>>> Yes, the default location is the bundle private data area provided by
>>> the framework through the BundleContext.getDataFile(String) method.
>>>
>>>> I should suppose to have some pre-defined configuration values,
>>>> And when I deliver my software there is no cache folder, how can I put i
>>>> into this.
>>>>
>>>> I try to change the configuration location to the felix/conf folder like
>>>> this:
>>>> felix.cm.dir=../../../conf
>>>>
>>>> But it complains about ".." reference.
>>>>
>>>> I also wondered if I can use the default "config.properties" with
>>>> ConfigAdmin
>>> You can use and you can change the setup.
>>>
>>> BUT: This is not to inject default configuration. This data area must be
>>> configured private to the Configuration Admin service because changes
>>> are expected to only be carried out by the Configuration Admin service.
>>>
>>> If you want to provide "default" configuration you might want to
>>> consider FileInstall and provide respective .cfg files. See [1] for more
>>> details.
>>>
>>> Hope this helps.
>>>
>>> Regards
>>> Felix
>>>
>>> [1] http://felix.apache.org/site/apache-felix-file-install.html
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>

-- 
----
http://www.liquid-reality.de


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


Re: ConfigAdmin change the files location

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

Just to clarify what the OSGi Configuration Admin Service is all about:

  - Allows Management Agents (administrators, tools, whatever) to manage
    configuration
  - Delivers configuration to interested parties
  - Persistently stores configuration

A Configuration basically is just a Dictionary whose keys are strings
(case-insensitive) and whose values are of a limited set of types,
basically primitive types, their wrappers plus Collections or Arrays
thereof. (For the OSGi R 4.3 release it is planed to have more
interesting ways to describe configuration....)

Back to your question: Yes you can use Configuration Admin for your
configuration and yes you can put into the configuration whatever you want.

To manage configuration you have a number of tools at your disposal:

  - Use the Web Console allowing for a simple GUI to configure values
     (makes use of the Metatype Service to describe configurations)
  - Use File Install to provide preconfigured configuration files to
     be loaded into the Configuration Admin service automatically.
     This tool also recognizes changes to files and thus updates
     configuration.
  - Do it yourself coding an application using the Configuration Admin
     Service API...

IIRC the configuration files processed by File Install are more or less
pure property files.

Regards
Felix

On 13.10.2010 09:05, Christian Schneider wrote:
>  Hi,
> 
> I am currently also evaluating the config admin service. I ported a
> spring application to osgi and now have the problem where to put the
> properties files. The property files contain db and jms connection infos.
> Is config admin service the right tool for this job?
> 
> I already succeeded in creating the config programmatically and using it
> in spring with help of the spring osgi config admin support. As
> implementation I used the felix cm bundle. What I do not like is that
> the persisted files contain additional information compared to the
> normal property files. So it is quite difficult to create and change
> them by hand. If I only put the original properties into the file I even
> get a nullpointer exception.
> Is it possible to conffigure felix cm to work with pure propety files
> that do not contain additional information or would you recommand
> another aproach?
> 
> Thanks
> 
> Christian
> 
> 
> Am 13.10.2010 08:14, schrieb Felix Meschberger:
>> Hi,
>>
>> On 13.10.2010 05:55, LongkerDandy wrote:
>>> Hi
>>>
>>> I'm try to use ConfigAdmin to save and load configurations.
>>> The default place of the configurations is under the cache folder and
>>> deep
>>> into the ConfigAdmin bundle.
>>>
>>> I don't know it is designed like this.
>> Yes, the default location is the bundle private data area provided by
>> the framework through the BundleContext.getDataFile(String) method.
>>
>>> I should suppose to have some pre-defined configuration values,
>>> And when I deliver my software there is no cache folder, how can I put i
>>> into this.
>>>
>>> I try to change the configuration location to the felix/conf folder like
>>> this:
>>> felix.cm.dir=../../../conf
>>>
>>> But it complains about ".." reference.
>>>
>>> I also wondered if I can use the default "config.properties" with
>>> ConfigAdmin
>> You can use and you can change the setup.
>>
>> BUT: This is not to inject default configuration. This data area must be
>> configured private to the Configuration Admin service because changes
>> are expected to only be carried out by the Configuration Admin service.
>>
>> If you want to provide "default" configuration you might want to
>> consider FileInstall and provide respective .cfg files. See [1] for more
>> details.
>>
>> Hope this helps.
>>
>> Regards
>> Felix
>>
>> [1] http://felix.apache.org/site/apache-felix-file-install.html
>>
>> ---------------------------------------------------------------------
>> 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: ConfigAdmin change the files location

Posted by Martin Ždila <m....@mwaysolutions.com>.
On Wed, Oct 13, 2010 at 9:05 AM, Christian Schneider
<ch...@die-schneider.net> wrote:
> I am currently also evaluating the config admin service. I ported a spring
> application to osgi and now have the problem where to put the properties
> files. The property files contain db and jms connection infos.
> Is config admin service the right tool for this job?

IMHO yes. We are using this approach too.

> I already succeeded in creating the config programmatically and using it in
> spring with help of the spring osgi config admin support. As implementation
> I used the felix cm bundle. What I do not like is that the persisted files
> contain additional information compared to the normal property files. So it
> is quite difficult to create and change them by hand. If I only put the
> original properties into the file I even get a nullpointer exception.
> Is it possible to conffigure felix cm to work with pure propety files that
> do not contain additional information or would you recommand another
> aproach?

AFAIK the specification doesn't tell about the persistence format.
Felix config admin implementation uses *.config and they are not meant
to be edited by hand althought we also do this :-). But the change is
not dynamic - if you edit the config file during runtime, bundle will
not see the changes until config admin bundle restarts.

Other config admin implementations can store data to database or
binary formats....

For managing the configuration you can use Felix Web Console,
http://opensource.luminis.net/wiki/display/SITE/OSGi+Configuration+Admin+command+line+client
or other/your impementation.

BR
-- 
Ing. Martin Ždila
CTO

M-Way Solutions Slovakia s.r.o.
Letná 27, 040 01 Košice
Slovakia

tel:+421-908-363-848
mailto:m.zdila@mwaysolutions.com
http://www.mwaysolutions.com

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


Re: ConfigAdmin change the files location

Posted by Christian Schneider <ch...@die-schneider.net>.
  Hi,

I am currently also evaluating the config admin service. I ported a 
spring application to osgi and now have the problem where to put the 
properties files. The property files contain db and jms connection infos.
Is config admin service the right tool for this job?

I already succeeded in creating the config programmatically and using it 
in spring with help of the spring osgi config admin support. As 
implementation I used the felix cm bundle. What I do not like is that 
the persisted files contain additional information compared to the 
normal property files. So it is quite difficult to create and change 
them by hand. If I only put the original properties into the file I even 
get a nullpointer exception.
Is it possible to conffigure felix cm to work with pure propety files 
that do not contain additional information or would you recommand 
another aproach?

Thanks

Christian


Am 13.10.2010 08:14, schrieb Felix Meschberger:
> Hi,
>
> On 13.10.2010 05:55, LongkerDandy wrote:
>> Hi
>>
>> I'm try to use ConfigAdmin to save and load configurations.
>> The default place of the configurations is under the cache folder and deep
>> into the ConfigAdmin bundle.
>>
>> I don't know it is designed like this.
> Yes, the default location is the bundle private data area provided by
> the framework through the BundleContext.getDataFile(String) method.
>
>> I should suppose to have some pre-defined configuration values,
>> And when I deliver my software there is no cache folder, how can I put i
>> into this.
>>
>> I try to change the configuration location to the felix/conf folder like
>> this:
>> felix.cm.dir=../../../conf
>>
>> But it complains about ".." reference.
>>
>> I also wondered if I can use the default "config.properties" with
>> ConfigAdmin
> You can use and you can change the setup.
>
> BUT: This is not to inject default configuration. This data area must be
> configured private to the Configuration Admin service because changes
> are expected to only be carried out by the Configuration Admin service.
>
> If you want to provide "default" configuration you might want to
> consider FileInstall and provide respective .cfg files. See [1] for more
> details.
>
> Hope this helps.
>
> Regards
> Felix
>
> [1] http://felix.apache.org/site/apache-felix-file-install.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

-- 
----
http://www.liquid-reality.de


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


Re: ConfigAdmin change the files location

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

On 13.10.2010 05:55, LongkerDandy wrote:
> Hi
> 
> I'm try to use ConfigAdmin to save and load configurations.
> The default place of the configurations is under the cache folder and deep
> into the ConfigAdmin bundle.
> 
> I don't know it is designed like this.

Yes, the default location is the bundle private data area provided by
the framework through the BundleContext.getDataFile(String) method.

> I should suppose to have some pre-defined configuration values,
> And when I deliver my software there is no cache folder, how can I put i
> into this.
> 
> I try to change the configuration location to the felix/conf folder like
> this:
> felix.cm.dir=../../../conf
> 
> But it complains about ".." reference.
> 
> I also wondered if I can use the default "config.properties" with
> ConfigAdmin

You can use and you can change the setup.

BUT: This is not to inject default configuration. This data area must be
configured private to the Configuration Admin service because changes
are expected to only be carried out by the Configuration Admin service.

If you want to provide "default" configuration you might want to
consider FileInstall and provide respective .cfg files. See [1] for more
details.

Hope this helps.

Regards
Felix

[1] http://felix.apache.org/site/apache-felix-file-install.html

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