Package io.joynr.jeeintegration
Class ProviderWrapper
- java.lang.Object
-
- io.joynr.jeeintegration.ProviderWrapper
-
- All Implemented Interfaces:
InvocationHandler
public class ProviderWrapper extends Object implements InvocationHandler
This class wraps an EJB which is decorated withServiceProviderand has a valid service interface specified (that is it extendsJoynrProvider). When the bean is discovered inJoynrIntegrationBean.initialise()an instance of this class is registered as the provider with the joynr runtime. When joynr wants to call a method of the specified service interface, then this instance will obtain a reference to the bean via theJoynrIntegrationBean.beanManagerand will delegate to the corresponding method on that bean (i.e. with the same name and parameters). The result is then wrapped in a deferred / promise and returned.
-
-
Constructor Summary
Constructors Constructor Description ProviderWrapper(javax.enterprise.inject.spi.Bean<?> bean, javax.enterprise.inject.spi.BeanManager beanManager, com.google.inject.Injector injector)Initialises the instance with the service interface which will be exposed and the bean reference it is meant to wrap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectinvoke(Object proxy, Method method, Object[] args)When a method is invoked via a joynr call, then it is delegated to an instance of the bean with which this instance was initialised, if the method is part of the business interface and to this instance if it was part of theJoynrProviderinterface or theObjectclass.
-
-
-
Constructor Detail
-
ProviderWrapper
public ProviderWrapper(javax.enterprise.inject.spi.Bean<?> bean, javax.enterprise.inject.spi.BeanManager beanManager, com.google.inject.Injector injector)Initialises the instance with the service interface which will be exposed and the bean reference it is meant to wrap.- Parameters:
bean- the bean reference to which calls will be delegated.beanManager- the bean manager.injector- the Guice injector.
-
-
Method Detail
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
When a method is invoked via a joynr call, then it is delegated to an instance of the bean with which this instance was initialised, if the method is part of the business interface and to this instance if it was part of theJoynrProviderinterface or theObjectclass.- Specified by:
invokein interfaceInvocationHandler- Parameters:
proxy- the proxy object on which the method was called.method- the specific method which was called.args- the arguments with which the method was called.- Returns:
- the result of the delegate method call on the EJB, but wrapped in a promise, as all the provider methods in joynr are declared that way.
- Throws:
Throwable
-
-