Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gemini-dev] using managed-service-factory inner bean as a reference-listener

Hi Alexander

I'm acting as a "caretaker" project lead for Gemini Blueprint. I've fiddled with the code, but don't profess any significant insights.

I'm confused by the example below. Since the managed-service-factory element can register multiple instances of the myService bean, why would it make sense to reference those instances from the reference-listener which normally expects to drive a single bean?

More generally, it strikes me that this is a bit of an edge case and I'm not convinced that making the Gemini Blueprint externals (even) more complicated would be a wise course of action. I would suggest stepping back and finding some other solution to the real problem. It could even be that Gemini Blueprint is becoming part of the problem here, rather than the solution. ;-)

Regards,
Glyn

On 9 Jul 2012, at 20:16, Alexander Shutyaev wrote:

Hi all!

I've encountered a case which is not yet supported as it seems. Please see the context:

<osgi:list id="extensions" interface="com.foo.MyServiceExtension">
<osgi:reference-listener bind-method="registerExtension" unbind-method="unregisterExtension" ref="???" />
</osgi:list>
<osgix:managed-service-factory id="myServiceFactory" factory-pid="my-service-factory" autowire-on-update="true">
<osgix:interfaces>
<value>com.foo.MyService</value>
</osgix:interfaces>
<bean id="myService" class="com.foo.MyServiceImpl" />
</osgix:managed-service-factory>

where com.foo.Myservice interface has, among others, methods

public void registerExtension(MyServiceExtension extension, Map<?,?> properties);
public void unregisterExtension(MyServiceExtension extension, Map<?,?> properties);

So here's the case. My managed service factory is registering bean instances of MyService, and I need to use these bean instances as reference listeners (so that they can obtain MyServiceExtensions). The problem is what to put in the ref attribute of reference-listener declaraion. There are two possibilities which both turn out wrong:

1. ref="myService" -- fails because myService bean is an inner one, so it's id is not private
2. ref="myServiceFactory" -- fails because myServiceFactory is not a MyService instance and thus doesn't have required bind/unbind methods.

Now, I understand that this is not a minor feature request and I am willing to help and write some code, tests etc. All I need is a starting point in source code and a few words on what is the right way to support this functionality.

My proposal is that we use ref="myServiceFactory" and the handler (or whatever piece of code does this) treats this case (when ref points to a managed service factory) in a specific way: it waits for MyService instances to be constructed and then does to them whatever he would do if MyService was in a ref in the beginning.

Please feel free to correct my view. And thanks in advance.
_______________________________________________
gemini-dev mailing list
gemini-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/gemini-dev


Back to the top