Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gemini-dev] referencing osgi services from within managed-service-factory template bean

Hi all!

Let me give you the example and then explain what I want. Here's a piece of my application context:

<osgix:managed-service-factory factory-pid="servicea-factory-pid" interface="ServiceA">
<bean class="SeviceAImpl">
<property name="someProperty" value="someValue" />
<property name="serviceB">
<osgi:reference availability="mandatory" interface="ServiceB" />
</property>
</bean>
</osgix:managed-service-factory>

Now the story. There is a managed service factory that provides instances of ServiceA. ServiceA requires ServiceB to function (a mandatory dependency). However if we deploy the example above, we will find out that application context is not loaded until ServiceB is available. If I understood the docs well it happens because this reference is treated as a global mandatory dependency and application context is not started until it is available.

I believe this is wrong because the reference I declared is anonymous and private to the bean produced by my managed service factory. I think that in this case the application context should start even if ServiceB is unavailable and ManagedServiceFactory must be registered. Afterwards, when factory configurations are published ServiceA instances should be created, but published only if ServiceB is available (in fact the should be dynamically dependent - registering/unregistering ServiceA whenever ServiceB is registered/unregistered).

Please forgive me (and correct me) if I'm wrong =)

Thanks in advance

Alexander

Back to the top