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

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

import org.jfox.ejb.Invocation;
import org.jfox.ejb.connector.ContainerRemote;
import org.jfox.ejb.connector.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();

    public 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) {

    }
}