/* 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 java.util.Iterator;
import javax.naming.Context;
import javax.transaction.TransactionManager;

import org.jfox.ejb.handler.Interceptable;
import org.jfox.ejb.meta.Protocol;
import org.jfox.framework.Component;
import org.jfox.framework.extra.Destroyable;
import org.jfox.framework.extra.Initializable;


/**
 * 容器接口，定义 ejb 容器需要实现的方法，Container 还应该包含所有 ejb bucket 共享的资源，比如：ThreadPool
 *
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public interface Container extends Component, Initializable, Destroyable, Interceptable {

    Context getInitialContext();

    /**
     * @return 所有 bean bucket 的 key 的 iterator
     */
    Iterator listBuckets();

    void dropBucket(String beanClassName) throws Exception;

    /**
     * 根据 deployer 传来的参数，生成一个 bean bucket，并且把其 Home 绑定到 jndi
     */
    void createBucket(BucketMetaData meta) throws Exception;

    /**
     * invoke a method
     *
     * @return
     */
    Object invoke(Invocation invocation) throws Exception;

    TransactionManager getTransactionManager();

    Bucket getBucket(String ejbName);

    Protocol getRemoteProtocol();

    void setRemoteProtocol(Protocol remoteProtocol);

    Protocol getLocalProtocol();

    void setLocalProtocol(Protocol localProtocol);

}