/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */

package org.jfox.ejb;

import javax.ejb.EnterpriseBean;

import org.jfox.pool.PoolableObject;
import org.jfox.pool.SimpleObjectFactory;


/**
 * Éú³É 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) {

    }
}
