jbossas/jboss-remote-naming — pull request #11 by jaikiran (2012-10-31 10:08:28+00:00)
Title: Refactor the EJB client integration in the remote naming project to have a more robust and cleaner integration

The commit here changes the way the remote naming project was integrated with the EJB client project to allow for EJB invocations via remote naming contexts. These changes broadly include:

1) Getting rid of the EJB client context selector switching that was being done by the remote naming APIs. Starting with 1.0.13.Final version of EJB client API, we now have a better way of dealing with scoped EJB client contexts. The commit here scopes the EJB client contexts created for remote naming contexts, by using these new APIs.

2) Introduce an EJBClientHandler interface which allows for the remote naming project to function without having a hard dependency on the EJB client project. The EJBClientHandler interface will have no dependency on the EJB client APIs. An implementation of this interface is allowed to have the hard dependency on those APIs. RemoteNamingStoreEJBClientHandler is one such implementation which is plugged into the remote naming context by using reflection. The failure to load such implementation will still allow the remote naming context to function but the EJB invocations via that context will not be functional.

3) The EJBClientHandler will also provide a hook to allow the EJB proxies returned via JNDI lookup to be handled properly before being returned to the client. For example, if a client application creates a remote naming context and asks that context to create a EJB client context too (by passing the jboss.naming.ejb.context=true property), then subsequent lookups of EJB proxies via that remote naming context will be scoped to that EJB client context. This is done by hooking in the EJBClientHandler implementation to process the object returned by the server, before being sent back to the client. The implementation of this interface will then appropriately associate the EJB client context identifier with that returned proxy so that it gets scoped.

4) Other minor changes which includes closing on EJB client context on closing of the remote naming context