1 16 17 package org.springframework.remoting.jaxrpc; 18 19 import javax.xml.rpc.ServiceException ; 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 49 public class JaxRpcPortProxyFactoryBean extends JaxRpcPortClientInterceptor 50 implements FactoryBean, BeanClassLoaderAware { 51 52 private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); 53 54 private Object serviceProxy; 55 56 57 public void setBeanClassLoader(ClassLoader classLoader) { 58 this.beanClassLoader = classLoader; 59 } 60 61 public void afterPropertiesSet() throws ServiceException { 62 if (getServiceInterface() == null) { 63 if (getPortInterface() != null) { 66 setServiceInterface(getPortInterface()); 67 } 68 else { 69 throw new IllegalArgumentException ("Property 'serviceInterface' is required"); 70 } 71 } 72 super.afterPropertiesSet(); 73 this.serviceProxy = new ProxyFactory(getServiceInterface(), this).getProxy(this.beanClassLoader); 74 } 75 76 77 public Object getObject() { 78 return this.serviceProxy; 79 } 80 81 public Class getObjectType() { 82 return getServiceInterface(); 83 } 84 85 public boolean isSingleton() { 86 return true; 87 } 88 89 } 90 | Popular Tags |