/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Initial developer(s): Philippe Coq
 * Contributor(s): 
 * Jeff Mesnil : security
 * Christophe Ney : PrincipalFactory
 * Philippe Durieux : add missing methods
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */


package org.objectweb.jonas_ejb.container;

import java.security.Guard;
import javax.transaction.TransactionManager;
import org.enhydra.naming.ContainerNaming;
import org.objectweb.jonas_jms.api.JmsManager;

/**
 * A Container is what an EJBServer can see of a JOnAS Container.
 * It holds all beans coming from a same ejbjar file.
 * There is no possibility to add or remove dynamically beans in 
 * a Container since it is build with all its beans.
 * JMX can use this interface, but no specific Jmx classes should
 * be inside the Container. Its management is done outside jonas_ejb.
 * @see org.enhydra.naming.ContainerNaming, PrincipalFactory
 */
public interface Container {
    /**
     * Returns a list of beans hosted in the container.
     */
    public String [] listBeanNames();

    /**
     * Return the name of the container
     */
    public String getName();

    /**
     * Return the file name of the container (.xml or .jar)
     */
    public String getFileName();

    /**
     * Set the MethodGuard
     */
    public void setMethodGuard(Guard methodGuard);

    /**
     * Get the MethodGuard
     */
    public Guard getMethodGuard();

    /**
     * Set the RoleGuard
     */
    public void setRoleGuard(Guard roleGuard);

    /**
     * Get the RoleGuard
     */
    public Guard getRoleGuard();

    /**
     * Returns the classloader used for this Container
     */
    public ClassLoader getClassLoader();

    /**
     * Set the PrincipalFactory. This factory can be EJBServer dependant.
     * The Container makes no assumption on how to get the Principal.
     */
    public void setPrincipalFactory(PrincipalFactory pf);

    /**
     * Get the PrincipalFactory
     */
    public PrincipalFactory getPrincipalFactory();

    /**
     * set the ContainerNaming object
     */
    public void setContainerNaming(ContainerNaming naming);

    /**
     * return the ContainerNaming object
     */
    public ContainerNaming getContainerNaming();

    /**
     * Set the thread pool size. This thread pool is currently used
     * only for message driven beans.
     * @param sz number of threads in the pool.
     */
    public void setThreadPoolSize(int sz);

    /**
     * Synchronize all entity beans
     */
    public void syncAll();

    /**
     * set the Transaction Manager.
     */
    public void setTransactionManager(TransactionManager tm);

    /**
     * return the Transaction Manager
     */
    public TransactionManager getTransactionManager();

    /**
     * set the JmsManager object
     */
   public void setJmsManager(JmsManager jms);

    /**
     * return the JmsManager object
     */
    public JmsManager getJmsManager();

    /**
     * Remove the JOnAS container and unregister all beans.
     */
    public void remove();

}
