You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Ivan Op de Beeck (JIRA)" <ji...@apache.org> on 2015/08/21 07:09:45 UTC

[jira] [Created] (ARIES-1384) Using a ManagedServiceFactory with a ManagedComponent factory-ref

Ivan Op de Beeck created ARIES-1384:
---------------------------------------

             Summary: Using a ManagedServiceFactory with a ManagedComponent factory-ref
                 Key: ARIES-1384
                 URL: https://issues.apache.org/jira/browse/ARIES-1384
             Project: Aries
          Issue Type: Question
          Components: Blueprint
            Reporter: Ivan Op de Beeck
            Priority: Minor


I have some blueprint setup like the following:

public class MyComponentFactory {
    public MyParentClass create(org.osgi.service.cm.Configuration configuration) {
        // return different subclass of MyParentClass based on configuration
    }
}

<bean id="myComponentFactory" class="com.mycompany.MyComponentFactory" />

<cm:managed-service-factory factory-pid="com.mycompany.factory" auto-export="interfaces">
    <service-properties>
        <cm:cm-properties persistent-id="" update="true" />
    </service-properties>
    <cm:managed-component  factory-ref="myComponentFactory" factory-method="create">
        <argument ref="<REFERENCE TO CONFIGURATION?>" />
        <cm:managed-properties persistent-id="" update-strategy="container-managed" />
    </cm:managed-component>
</cm:managed-service-factory>

The intent is to have the 'MyComponentFactory' instantiate a different subclass based on information in the Configuration triggering the ManagedServiceFactory.
However I do not know how to get hold of this configuration in my factory.
I've noticed the <argument> tag will pass parameters to the create method, but as the Configuration is not a bean, I can't get a reference to it.

Anybody has any idea how to make this work?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)