/* 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 java.lang.reflect.Method;

import org.jfox.ejb.deploy.EJBClassLoader;
import org.jfox.ejb.meta.EJBDescriptor;
import org.huihoo.jfox.system.Component;

/**
 * a bulk 容纳一个特定的 bean,保存了这个 bean 的一切资源,bulk 放在 container 中
 *
 * 继承 EJBOperation 是为了强迫实现它的方法,以便在方法调用时可以直接调用
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public interface Bulk extends EJBOperation, Component {

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

  /**
   * 得到该 ejb 的 classLoader
   */
  EJBClassLoader getEJBClassLoader();

  Method getHomeMethod(Invocation invocation) throws NoSuchMethodException;
  Method getBeanMethod(Invocation invocation) throws NoSuchMethodException;

  /**
   * 来自 EJBHome 的方法
   * @param invocation
   * @return Bean 的 ObjectId
   * @throws Exception
   */
  Object invokeHome(Invocation invocation) throws Exception;

  /**
   * 执行 Bean 的方法
   * @param invocation
   * @return
   * @throws Exception
   */
  Object invokeBean(Invocation invocation) throws Exception;

  EJBDescriptor getEJBDescriptor();

}