| Gemini Blueprint and optional services [message #872236] |
Tue, 15 May 2012 14:23  |
Mastah Naleh Messages: 32 Registered: April 2012 |
Member |
|
|
Hi. Is it possible using the attribute availability to make so a service become optional ?
I did try using availability="optional" but when the service is not present, I still have to catch an exception (org.eclipse.gemini.blueprint.service.ServiceUnavailableException)
Here is my bean config:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="wwwspringframework.org/schema/beans"
xmlns:aop="wwwspringframework.org/schema/aop"
xmlns:xsi="wwww3.org/2001/XMLSchema-instance"
xmlns:osgi="wwweclipse.org/gemini/blueprint/schema/blueprint"
xmlns:osgix="wwweclipse.org/gemini/blueprint/schema/blueprint-compendium"
xsi:schemaLocation="wwwspringframework.org/schema/aop wwwspringframework.org/schema/aop/spring-aop.xsd
wwwspringframework.org/schema/beans wwwspringframework.org/schema/beans/spring-beans.xsd
wwweclipse.org/gemini/blueprint/schema/blueprint wwweclipse.org/gemini/blueprint/schema/blueprint/gemini-blueprint.xsd
wwweclipse.org/gemini/blueprint/schema/blueprint-compendium wwweclipse.org/gemini/blueprint/schema/blueprint-compendium/gemini-blueprint-compendium.xsd">
<osgi:service ref="logFacade" interface="org.mastah.sdm.logger.facade.ILogFacade" />
<osgi:reference id="logEngine" interface="org.mastah.sdm.logger.engine.ILogEngine" availability="optional" timeout="10" />
</beans>
The proxy are created under JdkDynamicAopProxy, not idea if that could be a problem.
Is there a way to create them using CGLIB instead ?
Thanks.
[Updated on: Tue, 15 May 2012 14:25] Report message to a moderator
|
|
|
| Re: Gemini Blueprint and optional services [message #881012 is a reply to message #872236] |
Sun, 03 June 2012 12:48  |
Mastah Naleh Messages: 32 Registered: April 2012 |
Member |
|
|
Anyone that could have a clue of what I could do ?
So far I though that availability="optional" mean the service to be really optional (ie: possibility of no service). But when the service reference is flagged as optional and if no service is found when calling the service, an exception is still throw.
Wouldn't it be better to return null on returning method and do nothing on void method for true optional service ?
Or could it be possible to add an option to ask for an exception to be thrown or not if the service can't be found ?
Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.01420 seconds