1 16 17 package org.springframework.ejb.access; 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 49 public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInterceptor 50 implements FactoryBean, BeanClassLoaderAware { 51 52 53 private Class businessInterface; 54 55 private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader(); 56 57 58 private Object proxy; 59 60 61 67 public void setBusinessInterface(Class businessInterface) { 68 this.businessInterface = businessInterface; 69 } 70 71 74 public Class getBusinessInterface() { 75 return this.businessInterface; 76 } 77 78 public void setBeanClassLoader(ClassLoader classLoader) { 79 this.beanClassLoader = classLoader; 80 } 81 82 public void afterPropertiesSet() throws NamingException { 83 super.afterPropertiesSet(); 84 if (this.businessInterface == null) { 85 throw new IllegalArgumentException ("businessInterface is required"); 86 } 87 this.proxy = new ProxyFactory(this.businessInterface, this).getProxy(this.beanClassLoader); 88 } 89 90 91 public Object getObject() { 92 return this.proxy; 93 } 94 95 public Class getObjectType() { 96 return this.businessInterface; 97 } 98 99 public boolean isSingleton() { 100 return true; 101 } 102 103 } 104 | Popular Tags |