| EJBObjectFactory.java |
/* JFox, the OpenSource J2EE Application Server
*
* Copyright (C) 2002 huihoo.com
* Distributable under GNU LGPL license
* See the GNU Lesser General Public License for more details.
*/
package org.jfox.ejb;
import javax.ejb.EnterpriseBean;
import org.huihoo.jfox.pool.SimpleObjectFactory;
import org.huihoo.jfox.pool.PoolableObject;
/**
* Éú³É EJBPoolableObject , EJBPoolableObject ·â×°ÁË EJBObject
*
* @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
*/
public class EJBObjectFactory extends SimpleObjectFactory {
// EJB bean class
private Class beanClass = null;
// private Constructor construct = null;
public EJBObjectFactory(Class classType, Class beanClass) throws Exception {
super(classType);
this.beanClass = beanClass;
// this.construct = classType.getConstructor(new Class[]{EnterpriseBean.class});
}
public PoolableObject makeObject() throws Exception {
EJBPoolableObject pobj = (EJBPoolableObject)super.makeObject();
EnterpriseBean bean = (EnterpriseBean)beanClass.newInstance();
pobj.setBeanInstance(bean);
return pobj;
// EJBPoolableObject pobj = (EJBPoolableObject)construct.newInstance(new Object[]{bean});
// return pobj;
}
public static void main(String[] args) {
}
}