Skip to main content

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

Hi Alexander

I think this is working as designed, so the behaviour you would like to see is an enhancement rather than a bug fix. Feel free to raise an enhancement bugzilla, although I can't commit to it being implemented unless someone has some spare cycles to investigate a patch (including the additional tests that would be needed).

Regards,
Glyn

On 19 Jun 2012, at 20:51, Alexander Shutyaev wrote:

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
_______________________________________________
gemini-dev mailing list
gemini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gemini-dev


Back to the top