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

import javax.naming.Context;

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

public abstract class AbstractEnterpriseContextContainer {

    /**
     * the thread local variable store current thread enc name
     */
    protected ThreadLocal currName = new ThreadLocal();

    /**
     * set the current enc name to a ThreadLocal variable, then can get the enc by the enc name
     *
     * @param encName
     * @return origin ejb name, maybe null;
     */
    public String setCurrentEnterpriseContextName(String encName) {
        String origin = (String) currName.get();
        currName.set(encName);
        return origin;
    }

    public abstract Context getCurrentEnterpriseContext();

    public abstract EnterpriseContextInvocationHandler getEnterpriseContextInvocationHandler();


    public static void main(String[] args) {

    }
}

