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

import java.rmi.RemoteException;
import javax.ejb.EJBException;

import org.jfox.ejb.Invocation;
import org.jfox.ejb.invoker.ContainerRemote;
import org.jfox.ejb.invoker.ContainerServiceSupport;

/**
 * 对于 ejb <-> ejb 的调用,通过该类完成
 *
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class LOCALContainerService extends ContainerServiceSupport implements ContainerRemote {
  private static LOCALContainerService invoker = new LOCALContainerService();

  private LOCALContainerService() {

  }

  public static LOCALContainerService getInstance(){
    return invoker;
  }

  protected void doInit() throws Exception {
    super.doInit();
  }

  protected void doStart() throws Exception {

  }

  protected void doStop() throws Exception {

  }

  protected synchronized void doDestroy() throws Exception {

  }

  public Object invoke(Invocation invocation) throws RemoteException {
    logger.debug("invoke " + invocation.toString());
    try {
      return container.invoke(invocation);
    }
    catch(Exception e){
      logger.error(e.getMessage(),e);
      throw new EJBException(e);
    }

  }

  public static void main(String[] args) {

  }
}