karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gusto2 <gabec....@yahoo.com>
Subject managed-component properties
Date Wed, 05 Dec 2012 12:01:54 GMT
Hello all, 
I have a question about blueprint configuration of managed components.
what I want to achieve: 
  I have a managed service factory 
 when creating a new configuration in the administrative console, a new
service instance (managed-component) is created
 the managed component has a property/properties with I want to set
according to the created configuration
programatically it is simple, I implemented and registered my own
*ManagedServiceFactory*(/org.osgi.service.cm.ManagedServiceFactory/) for
managing components, in the method *update* I set the component properties
based on the provided configuration.
I'd like to have it as a blueprint XML, but *I didn't find any way to
achieve the 3rd step* (set a managed component property).  In the exmaple
bellow, I'd like to set the ${sf1name} property. Using
/cm:property-placeholder/ didn't help, because all instances of the
component had the same value from the defined placeholder PID.
There are already some questions about this topic, but usually not answered
and I hope there is some solution around. If not, a little coding didn't
kill anybody (well, until you don't mess with life-endangering stuff)
&lt;blueprint     xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"   
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &gt;&lt;!--this did
not help, it creates a global PID and all component instances have the same
configured value &lt;cm:property-placeholder 
persistent-id="com.apogado.osgi.sf1" update-strategy="reload"&gt;       
&lt;cm:default-properties&gt;            &lt;cm:property name="sf1name"
value="noname" /&gt;         &lt;/cm:default-properties&gt;   
id="sf1-msf"         factory-pid="com.apogado.osgi.sf1"        
interface="com.apogado.osgi.sf1.Sf1Interface" &gt;               
&lt;service-properties&gt;            &lt;entry key="service.pid"
value="com.apogado.osgi.sf1"/&gt;        &lt;/service-properties&gt;       
&lt;cm:managed-component class="com.apogado.osgi.sf1.Sf1Impl" &gt;            
&lt;property name="name" value="${sf1name}" /&gt;       
Thanks for any hint in advanceCarpe diem   Gabriel----Gabriel VinceSenior

View this message in context: http://karaf.922171.n3.nabble.com/managed-component-properties-tp4027032.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

View raw message