karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Leung" <tom.le...@netage.com.hk>
Subject RE: which API to edit .cfg in Karaf at runtime?
Date Sat, 08 Mar 2014 00:23:05 GMT
I think you want set up a configuration file.  Anytime, the user edit this
file, the value can be reflected in the application.

Why not using Blueprint placeholder and include a blueprint configuration
file as below:

<blueprint default-activation="eager"

    <cm:property-placeholder persistent-id="your.sample.config"
update-strategy="reload" >
			<cm:property name="property1" value="foo"/>
	<bean class="sample.YourClassImpl " id="beanDao">
	    	    <property name=" property1" value="${ property1}"/>

After the bundle has been started, you may create a cfg file named "
your.sample.config.cfg" under Karaf/etc folder.
This cfg file contains the property value as below:


If the property value has been changed, the new property value will be
reloaded and reflected in the blueprint bean property.

-----Original Message-----
From: Brock Samson [mailto:brock.samson_@hotmail.com] 
Sent: Saturday, March 08, 2014 8:10 AM
To: user@karaf.apache.org
Subject: which API to edit .cfg in Karaf at runtime?

i have a bundle deployed in Karaf 3.2.1, which references a .cfg file in its
blueprint bundle-context.xml. i also have a javasript-based ui which allows
for such .cfg files to be edited at runtime. up to this point, i have been
using FileOutputStream("etc/my-bundle-PID.cfg") to perform the actual
editing. however, i am wondering if there is an official set of APIs to
accomplish such task.

thank you for your time!

View this message in context:
Sent from the Karaf - User mailing list archive at Nabble.com.

View raw message