/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.ejb3.stateless;

import java.util.Hashtable;
import javax.ejb.TimerService;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.Context;
import org.jboss.ejb3.Container;
import org.jboss.ejb3.EjbLinkResolver;
import org.jboss.ejb3.Pool;
import org.jboss.ejb3.entity.ManagedEntityManagerFactory;
import org.jboss.ejb3.security.JaccHelper;
import org.jboss.system.ServiceMBeanSupport;

/**
 * Comment
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 * @version $Revision: 1.11.2.4 $
 */
public class StatelessManager extends ServiceMBeanSupport implements StatelessManagerMBean, Container
{
   private StatelessContainer container;
   private String jaccContextId;

   public Container getInstance()
   {
      return container;
   }

   public StatelessManager(StatelessContainer container, String jaccContextId)
   {
      this.container = container;
      this.jaccContextId = jaccContextId;
   }


   public InitialContext getInitialContext()
   {
      return container.getInitialContext();
   }

   public Hashtable getInitialContextProperties()
   {
      return container.getInitialContextProperties();
   }

   public Context getEnc()
   {
      return container.getEnc();
   }


   public EjbLinkResolver getEjbLinkResolver()
   {
      return container.getEjbLinkResolver();
   }

   public void setEjbLinkResolver(EjbLinkResolver ejbLinkResolver)
   {
      container.setEjbLinkResolver(ejbLinkResolver);
   }

   public ManagedEntityManagerFactory getManagedEntityManagerFactory()
   {
      return container.getManagedEntityManagerFactory();
   }

   public void setManagedEntityManagerFactory(ManagedEntityManagerFactory factory)
   {
      container.setManagedEntityManagerFactory(factory);
   }

   public StatelessContainer getStatelessContainer()
   {
      return container;
   }

   public void createService() throws Exception
   {
      container.create();
      JaccHelper.configureContainer(jaccContextId, container);
   }

   public void startService() throws Exception
   {
      container.start();
   }

   public void stopService() throws Exception
   {
      container.stop();
   }

   public void destroyService() throws Exception
   {
      container.destroy();
   }

   public Class getBeanClass()
   {
      return container.getBeanClass();
   }

   public String getEjbName()
   {
      return container.getEjbName();
   }

   public ObjectName getObjectName()
   {
      return container.getObjectName();
   }

   public TimerService getTimerService()
   {
      return container.getTimerService();
   }

   public Pool getPool()
   {
      return container.getPool();
   }

   public Object construct()
   {
      return container.construct();
   }

   public void invokePostConstruct(Object bean)
   {
      container.invokePostConstruct(bean);
   }

   public void invokePreDestroy(Object bean)
   {
      container.invokePreDestroy(bean);
   }

   public void invokePostActivate(Object bean)
   {
      container.invokePostActivate(bean);
   }

   public void invokePrePassivate(Object bean)
   {
      container.invokePrePassivate(bean);
   }

   public void invokeInit(Object bean)
   {
      //Ignore
   }

   public void invokeInit(Object bean, Class[] initParameterTypes, Object[] initParameterValues)
   {
      //Ignore
   }
}
