Hi XiLai,

${karaf.home} is a System property. To be able to replace System properties in Blueprint, you have to use blueprint-ext.

So something like:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";

xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";>

    <ext:property-placeholder />

    <bean id="myBean" class="...">
       <property name="home" value="${karaf.home}"/>
    </bean>

</blueprint>

You can mix cm and ext together to use both System properties and ConfigAdmin properties.

Regards
JB

On 07/30/2012 08:16 AM, XiLai Dai wrote:
Hi,

In the blueprint xml of the bundle we have <cm:property-placeholder> and
<bean> configuration like this:

     <cm:property-placeholder persistent-id="x.y.z"
update-strategy="reload">

         <cm:default-properties>

             <cm:property name="myapp.home" value="${karaf.home}/myapp" />

         </cm:default-properties>

</cm:property-placeholder>

     <bean id="myServer" class="x.y.zImpl">

         <property name="myHome" value="${myapp.home}" />

</bean>

And we have a <feature> definition like this:

     <feature name='my-feature' version='0.1-SNAPSHOT'>

         <configfile
finalname="/etc/x.y.z.cfg">mvn:x.y.z/myapp/0.1-SNAPSHOT/cfg/x.y.z</configfile>

         <bundle>mvn:x.y.z/myapp/0.1-SNAPSHOT</bundle>

</feature>

When installed this feature into karaf container at first time,
${karaf.home} will not be replaced with the actual path like :
/home/karaf2.2.8. Then, after execute refresh <bundle_id> or restart
container, ${karaf.home} will be raplaced correctly. Does anyone know
possible solution/workaround how to make this happen at the first time
of feature installation?

Thanks in advance!

Xilai


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to