1 16 17 package org.springframework.jms.remoting; 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 39 public class JmsInvokerProxyFactoryBean extends JmsInvokerClientInterceptor 40 implements FactoryBean, BeanClassLoaderAware { 41 42 private Class serviceInterface; 43 44 private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); 45 46 private Object serviceProxy; 47 48 49 56 public void setServiceInterface(Class serviceInterface) { 57 if (serviceInterface == null || !serviceInterface.isInterface()) { 58 throw new IllegalArgumentException ("'serviceInterface' must be an interface"); 59 } 60 this.serviceInterface = serviceInterface; 61 } 62 63 public void setBeanClassLoader(ClassLoader classLoader) { 64 this.beanClassLoader = classLoader; 65 } 66 67 public void afterPropertiesSet() { 68 super.afterPropertiesSet(); 69 if (this.serviceInterface == null) { 70 throw new IllegalArgumentException ("Property 'serviceInterface' is required"); 71 } 72 this.serviceProxy = new ProxyFactory(this.serviceInterface, this).getProxy(this.beanClassLoader); 73 } 74 75 76 public Object getObject() { 77 return this.serviceProxy; 78 } 79 80 public Class getObjectType() { 81 return this.serviceInterface; 82 } 83 84 public boolean isSingleton() { 85 return true; 86 } 87 88 } 89 | Popular Tags |