[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gemini-dev] using managed-service-factory inner bean as a reference-listener
- From: Alexander Shutyaev <shutyaev@xxxxxxxxx>
- Date: Mon, 9 Jul 2012 23:16:10 +0400
- Delivered-to: email@example.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lmi/Uq3OA2Vlqeez5xMQA71svCe4DpIfnjto83Iz5u0=; b=obBV86q8pRhdVCxX575ZaJn8L6X3dtYMwFyznMWX1arcVwUljobTqSb5iS9zwpffMq Hu7LERYNboMaB19GTjhLrbSwxe0Z90czThtAcO1Ped75fWDwxAw5OB8ii/Qqddcumm2n 3ITXeWw7CR0lY7lveQslzhDQS8fQ5QKVhfieLK3bIwbYL6C1DCFDStlH0/XqqArwaSpa nJQaXdye8MLcyAUEWJD/+0AbOTv94Y/x1Y+3pleW4RFoxzeTN0J2mC/n5MwX8edpNq85 CuuzoTPb7nk/RpViQCmINX4ptsVTR0MONKR2K9CdfMvwon4ecB7BL+b+DSj99U4RUk8W C3Dw==
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="???" />
<osgix:managed-service-factory id="myServiceFactory" factory-pid="my-service-factory" autowire-on-update="true">
<bean id="myService" class="com.foo.MyServiceImpl" />
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.