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)
<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:xsi="http://www.w3.org/2001/XMLSchema-instance" ><!--this did
not help, it creates a global PID and all component instances have the same
configured value <cm:property-placeholder
persistent-id="com.apogado.osgi.sf1" update-strategy="reload">
<cm:default-properties> <cm:property name="sf1name"
value="noname" /> </cm:default-properties>
</cm:property-placeholder>--><cm:managed-service-factory
id="sf1-msf" factory-pid="com.apogado.osgi.sf1"
interface="com.apogado.osgi.sf1.Sf1Interface" >
<service-properties> <entry key="service.pid"
value="com.apogado.osgi.sf1"/> </service-properties>
<cm:managed-component class="com.apogado.osgi.sf1.Sf1Impl" >
<property name="name" value="${sf1name}" />
</cm:managed-component>
</cm:managed-service-factory></blueprint>
Thanks for any hint in advanceCarpe diem Gabriel----Gabriel VinceSenior
consultanthttp://www.apogado.com
--
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.