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

import java.util.Map;
import javax.management.ObjectName;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.system.ServiceMBeanSupport;

/**
 * An EjbModule represents a collection of beans that are deployed as a unit.
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 * @version $Revision: 1.15.2.4 $
 */
public class Ejb3Module extends ServiceMBeanSupport implements Ejb3ModuleMBean
{
   public final static String BASE_EJB3_JMX_NAME = "jboss.j2ee:service=EJB3";

   private Ejb3JmxDeployment deployment;

   public Ejb3Module(DeploymentInfo di)
   {
      deployment = new Ejb3JmxDeployment(di);
   }

   protected void createService() throws Exception
   {
      super.createService();
      deployment.create();
   }

   protected void startService() throws Exception
   {
      deployment.start();
      super.startService();

   }

   protected void stopService() throws Exception
   {
      deployment.stop();
      super.stopService();
   }

   protected void destroyService() throws Exception
   {
      deployment.destroy();
      super.destroyService();
   }

   public Container getContainer(ObjectName name)
   {
      return deployment.getContainer(name);
   }

   public Map getContainers()
   {
      return deployment.getContainers();
   }
}
