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