I did look through the tests and tried to copy some parts of the
blueprint.xml there but still couldn't get it too work. I might try that
again since I assume that the Aries tests work and that I'm therefore doing
something wrong. Meanwhile I'll stick with iPOJO.

/Bengt


2013/10/14 Graham Charters <[email protected]>

> Hi Bengt,
>
> I'm afraid I can't be much help as I haven't used this Blueprint
> namespace.  The managed-properties element is defined in the cm schema.
>  Have you tried looking for any tests in aries that use this namespace?
>
> Regard, Graham.
>
>
> On 7 October 2013 08:18, Bengt Rodehav <[email protected]> wrote:
>
>> I've also tried adding the following to my blueprint.xml:
>>
>>   <cm:managed-properties persistent-id="orchestration.processor.xslt"
>> update-strategy="container-managed"/>
>>
>> According to the schema I think this should be valid but I get the
>> following exception:
>>
>> 2013-10-07 09:01:25,436 | ERROR | rint Extender: 3 |
>> BlueprintContainerImpl           | container.BlueprintContainerImpl  393 |
>> Unable to start blueprint container for bundle
>> se.digia.connect-sts.orchestration.xslt-processor
>> org.osgi.service.blueprint.container.ComponentDefinitionException:
>> Unsupported element: cm:managed-properties
>> at
>> org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler.parse(CmNamespaceHandler.java:182)[8:org.apache.aries.blueprint.cm:1
>> .0.1]
>> ....
>>
>> It seems like I'm doing something seriously wrong. Can anyone direct me
>> to a working example using managed service factories? Blueprint works fine
>> for me otherwise but not with managed service factories.
>>
>> /Bengt
>>
>>
>> 2013/10/4 Bengt Rodehav <[email protected]>
>>
>>> I'm using Karaf.2.3.1 and thus Aries Blueprint 1.1.0.
>>>
>>> I use both iPOJO and Blueprint in different circumstances. So far I've
>>> always used iPOJO concerning managed service factories and Blueprint for
>>> the rest.
>>>
>>> I'm now trying to use Blueprint for managed service factories but I
>>> can't get it to work.
>>>
>>> My blueprint.xml looks as follows (I removed the real class names):
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>   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";
>>>   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>>> default-activation="lazy">
>>>
>>>   <cm:property-placeholder persistent-id="myPersistentId"
>>> update-strategy="reload">
>>>     <cm:default-properties>
>>>       <cm:property name="myProp" value="myValue"/>
>>>     </cm:default-properties>
>>>   </cm:property-placeholder>
>>>
>>>   <cm:managed-service-factory id="managed-service-factory"
>>> factory-pid="myPersistentId" interface="myQualifiedInterfaceName">
>>>     <service-properties>
>>>       <entry key="myProp" value="${myProp}"/>
>>>     </service-properties>
>>>     <cm:managed-component class="myQualifiedClassName">
>>>        <property name="myProp" value="${myProp}"/>
>>>     </cm:managed-component>
>>>   </cm:managed-service-factory>
>>>
>>> </blueprint>
>>>
>>> I create a configuration file called "myPersistentId-1.cfg" (I use
>>> fileinstall). It contains the following:
>>>
>>> myProp=value
>>>
>>> Using Felix Webconsole I can see that the configuration is picked up. I
>>> can also see that my bundle publishes three services with the following
>>> types:
>>>
>>> - org.osgi.service.blueprint.container.BlueprintContainer
>>> - org.osgi.service.cm.ManagedService
>>> - org.osgi.service.cm.ManagedServiceFactory
>>>
>>> But I can't see any published service for my type
>>> (myQualifiedInterfaceName above).
>>>
>>> By logging in the constructor of "myQualifiedClassName" I can see that a
>>> Java object is instantiated. I can also see that the "setMyProp" method is
>>> being called. However, the property value that I specify in the
>>> configuration file (myPersistentId-1.cfg) is never picked up, only the
>>> default value is ever used.
>>>
>>> In summary I have two serious problems:
>>>
>>> 1. No service is registered
>>> 2. The configuration properties are not used - only the default values
>>> are used
>>>
>>> Am I doing something wrong or should this work?
>>>
>>> /Bengt
>>>
>>>
>>>
>>
>

Reply via email to