Interface ClientAdapter
-
- All Known Implementing Classes:
ClientAdapterCustomizer
,CompositeClientAdapter
public interface ClientAdapter
Adapter for client-side stubs/proxies.In cases when your client side code depends on finer-grained interaction that would be unsuitable for stateless client invocation (for example JMS resources), ClientAdapter allow you to intercept the lookup process and construct client-side wrappers to return instead of direct remote proxy.
Adapter is registered in RemoteEJBContext via property "fish.payara.clientAdapter". The property should refer to an instance of
.ClientAdapter
. To construct more complex sets of adapters, you can useCompositeClientAdapter
andClientAdapterCustomizer
- See Also:
RemoteEJBContextFactory
,CompositeClientAdapter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<Object>
makeLocalProxy(String jndiName, Context remoteContext)
Construct local (client-side) proxy if name matches.
-
-
-
Method Detail
-
makeLocalProxy
Optional<Object> makeLocalProxy(String jndiName, Context remoteContext) throws NamingException
Construct local (client-side) proxy if name matches. The method is expected to examingjndiName
being looked up and if it matches adapter's adaptation, construct a local proxy and return it wrapped in anOptional<>
. Otherwise it must returnOptional.empty()
.Generated proxy intends calling other remote resources, it may use provided
remoteContext
, which refers to instance ofRemoteEJBContext
. Note that provided instance still applies this ClientAdapter, so it is not possible to wrap a remote object with behavior.- Parameters:
jndiName
- jndi name requested for lookupremoteContext
- naming context for remote EJB invocation- Returns:
- Optional.of(proxy) if adapter provides a proxy for given name, Optional.empty() otherwise
- Throws:
NamingException
- if downstream lookup fails, or other validation doesn't pass
-
-