/* 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.naming;

import java.lang.reflect.Proxy;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.spi.ObjectFactory;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class EJBEnterpriseContextFactory implements ObjectFactory {
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
        return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
                new Class[]{Context.class},
                EJBEnterpriseContextContainer.getInstance().getEnterpriseContextInvocationHandler());

    }

    public static void main(String[] args) {

    }
}
