From: Scott M S. <st...@us...> - 2004-12-04 07:26:12
|
User: starksm Date: 04/12/03 23:25:58 Modified: src/main/org/jboss/proxy/ejb ProxyFactory.java Log: Extend the ClientContainer to provide access to the interceptors and invocation context so that clients can customize the proxy outside of the server. Revision Changes Path 1.40 +17 -14 jboss/src/main/org/jboss/proxy/ejb/ProxyFactory.java Index: ProxyFactory.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/proxy/ejb/ProxyFactory.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- ProxyFactory.java 11 Aug 2004 03:54:13 -0000 1.39 +++ ProxyFactory.java 4 Dec 2004 07:25:57 -0000 1.40 @@ -40,6 +40,7 @@ import org.jboss.naming.Util; import org.jboss.proxy.Interceptor; import org.jboss.proxy.ClientContainer; +import org.jboss.proxy.IClientContainer; import org.jboss.proxy.ejb.handle.HomeHandleImpl; import org.jboss.system.Registry; import org.jboss.util.NestedRuntimeException; @@ -67,7 +68,7 @@ * @author <a href="mailto:mar...@jb...">Marc Fleury</a> * @author <a href="mailto:sco...@jb...">Scott Stark/a> * @author <a href="mailto:tho...@jb...">Thomas Diesler/a> - * @version $Revision: 1.39 $ + * @version $Revision: 1.40 $ */ public class ProxyFactory implements EJBProxyFactory @@ -303,7 +304,6 @@ { Iterator interceptorElements = MetaData.getChildrenByTagName(interceptors, "interceptor"); ClassLoader loader = container.getClassLoader(); - BeanMetaData beanMetaData = container.getBeanMetaData(); while(interceptorElements != null && interceptorElements.hasNext()) { Element ielement = (Element) interceptorElements.next(); @@ -381,14 +381,15 @@ EJBProxyFactoryContainer pfc = (EJBProxyFactoryContainer) container; // Create the EJBHome + Class[] ifaces = {IClientContainer.class, pfc.getHomeClass(), + Class.forName("javax.ejb.Handle")}; this.home = (EJBHome) Proxy.newProxyInstance( - // Class loader pointing to the right classes from deployment - pfc.getHomeClass().getClassLoader(), - // The classes we want to implement home and handle - new Class[]{pfc.getHomeClass(), Class.forName("javax.ejb.Handle")}, - // The home proxy as invocation handler - client - ); + // Class loader pointing to the right classes from deployment + pfc.getHomeClass().getClassLoader(), + // The classes we want to implement home and handle + ifaces, + // The home proxy as invocation handler + client); // Create stateless session object // Same instance is used for all objects @@ -408,12 +409,14 @@ loadInterceptorChain(beanInterceptorClasses, client); - this.statelessObject = - (EJBObject) Proxy.newProxyInstance( + Class[] ssifaces = {IClientContainer.class, pfc.getRemoteClass()}; + + this.statelessObject = + (EJBObject)Proxy.newProxyInstance( // Correct CL pfc.getRemoteClass().getClassLoader(), - // Interfaces - new Class[]{pfc.getRemoteClass()}, + // Interfaces + ssifaces, // SLSB proxy as invocation handler client ); @@ -421,7 +424,7 @@ else { // this is faster than newProxyInstance - Class[] intfs = {pfc.getRemoteClass()}; + Class[] intfs = {IClientContainer.class, pfc.getRemoteClass()}; Class proxyClass = Proxy.getProxyClass(pfc.getRemoteClass().getClassLoader(), intfs); final Class[] constructorParams = {InvocationHandler.class}; |