[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [virgo-dev] bundle configuration files as JSON or XML

ConfigAdmin can be used for that with ManagedService or ManagedServiceFactory.
Virgo support "config" types that is a java .properties file that is converted into a ConfigurationAdmin Configuration at runtime.
ManagedService or ManagedServiceFactory are notified automatically when configuration changes.
My assumption is that you are already doing something similar.  Where your implementation of MS or MSF does the heavy lifting of parsing your xml file.
Another approach to try is a OSGi support for Java Preferences.  See section 106 of osgi compendium spec.  http://www.osgi.org/javadoc/r4v42/org/osgi/service/prefs/PreferencesService.html

One more approach more to the Virgo/OSGi state of mind is to deploy your xml configuration as a bundle and register ArtifactLifecycleListener or BundleListener that looks for a specific manifest header for example.  Once you see that configuration deployed - deal with it as you do now to configure the service/system.

Dmitry

On Thu, Apr 14, 2011 at 11:32 AM, Joel Rosi-Schwartz <Joel.Rosi-Schwartz@xxxxxxxxx> wrote:
Hi Ovidiu,

Have you considered using osgi compendium Configuration Admin service to manage this? See <http://static.springsource.org/osgi/docs/1.2.x/reference/html/compendium.html>

Cheers,
Joel


On 14 Apr 2011, at 16:14, Ovidiu Deac wrote:

> Thanks for replying.
>
> The actual problem is this. We need some complex configuration which
> is hard to write in a .properties file so we have two files: one
> .properties file which points to an .xml file containing the full
> configuration.
>
> When somebody changes the xml he will also "touch" the properties file
> such that the configuration change is loaded by the bundle.
>
> This pretty ugly.
>
> Now I was thinking that it would be nice to have only the .xml file
> and be notified by Virgo when the file is changed.
>
> This xml file could have any structure the bundle needs.
>
> ovidiu
>
> On Thu, Apr 14, 2011 at 6:04 PM, Dmitry Sklyut <dmitry@xxxxxxxxxxx> wrote:
>> Hi Ovidiu,
>>
>> What is the format of XML file are you looking for?  XML as in
>> java.util.Properities xml format or some custom mechanism?
>>
>> If Properties - it will be very simple to do.  Virgo just needs a very minor
>> code change to support it.
>> Otherwise - you are looking at the custom deployment type.  This is not
>> documented well, but I will be happy to lend a hand if you decide to go down
>> that route.
>>
>> Regards,
>> Dmitry
>>
>> On Thu, Apr 14, 2011 at 10:50 AM, Ovidiu Deac <ovidiudeac@xxxxxxxxx> wrote:
>>>
>>> I am familiar with the bundle configuration mechanism but the
>>> properties files don't give us enough flexibility so I wonder if it is
>>> possible to configure the bundle using an XML file which deployed in
>>> the pickup dir.
>>>
>>> thanks,
>>> ovidiu
>>> _______________________________________________
>>> virgo-dev mailing list
>>> virgo-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/virgo-dev
>>
>>
>> _______________________________________________
>> virgo-dev mailing list
>> virgo-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/virgo-dev
>>
>>
> _______________________________________________
> virgo-dev mailing list
> virgo-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/virgo-dev
>

_______________________________________________
virgo-dev mailing list
virgo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/virgo-dev