1 16 17 package org.springframework.remoting.rmi; 18 19 import javax.naming.NamingException ; 20 21 import org.springframework.aop.framework.ProxyFactory; 22 import org.springframework.beans.factory.BeanClassLoaderAware; 23 import org.springframework.beans.factory.FactoryBean; 24 import org.springframework.util.ClassUtils; 25 26 64 public class JndiRmiProxyFactoryBean extends JndiRmiClientInterceptor implements FactoryBean, BeanClassLoaderAware { 65 66 private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); 67 68 private Object serviceProxy; 69 70 71 public void setBeanClassLoader(ClassLoader classLoader) { 72 this.beanClassLoader = classLoader; 73 } 74 75 public void afterPropertiesSet() throws NamingException { 76 super.afterPropertiesSet(); 77 if (getServiceInterface() == null) { 78 throw new IllegalArgumentException ("Property 'serviceInterface' is required"); 79 } 80 this.serviceProxy = new ProxyFactory(getServiceInterface(), this).getProxy(this.beanClassLoader); 81 } 82 83 84 public Object getObject() { 85 return this.serviceProxy; 86 } 87 88 public Class getObjectType() { 89 return getServiceInterface(); 90 } 91 92 public boolean isSingleton() { 93 return true; 94 } 95 96 } 97 | Popular Tags |