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