You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by DonLuigi <lu...@gmail.com> on 2011/12/22 14:36:52 UTC

Blueprint and service factory configuration

I am having great dificulty getting ConfigurationAdmin factory properties to
work with blueprint. I use webconsole to create configurations for service
factory.

Here is my blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"> 
<blueprint>
	<cm:managed-service-factory factory-pid="flow"
		interface="org.test.common.api.flow.IFlowPeer">
		<cm:managed-component
			class=" org.test.mockoperation1.flow.FlowPeerImpl">
		</cm:managed-component>
	</cm:managed-service-factory>
</blueprint>

My metatype.xml:
<?xml version="1.0" encoding="UTF-8"?>
<MetaData xmlns="http://www.osgi.org/xmlns/metatype/v1.1.0">
  <OCD name=" Mock Operation 1 :: Flow 1.0.0"
id="org.testmockoperation1.flow.1.0.0">
    <AD name="Channel name" id="configChannelName" type="String"
description="Unique channel name"/>
  </OCD>
  <Designate pid="org.testmockoperation1.flow.1.0.0"
factoryPid="org.testmockoperation1.flow.1.0.0">
    
  </Designate>
</MetaData>

FlowPeerImpl bean contains configChannelName property.

Problems:
1)	Even if I do not have any factory configuration, I get one instance of
FlowPeerImpl
2)	When I add factory configuration, I get two instances.
3)	In webadmin I see that configuration is consumed, but configChannelName
is not set from blueprint container
4)	Looking at http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
schema I can’t for the life of me figure out:
	a.	Where do I specify container-managed or component-managed properties
type
	b.	Where do I specify update method for component-managed type
5)	If I look at Spring schema, things are quite different. Following is
valid in Spring-DM but not Aries (update-strategy and update-method are not
allowed):
	<osgix:managed-service-factory id="data-msf"
	factory-pid="org.xyz.labX"
	update-strategy="bean-managed"
	update-method="refresh">

I have to say configuration is poorly handled in blueprint. Another example:
component-managed behaves as container-managed on initial construction
(meaning bean properties have to be defined) while update method is called
on subsequent config changes.

This means that I have to implement properties while also handle them in
updated method as a Dictionary.

This behavious is due to following line of code in
org.apache.aries.blueprint.compendium.cm.CmManagedProperties.inject(Object
bean, boolean initial):
if(initial || "container-managed".equals(updateStrategy))

Maybe it's me but I really don’t understand any of this.

Any help appreciated.

Ludvik

--
View this message in context: http://karaf.922171.n3.nabble.com/Blueprint-and-service-factory-configuration-tp3606588p3606588.html
Sent from the Karaf - User mailing list archive at Nabble.com.