/*
 * 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, Philippe Durieux
 * Contributor(s):
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.objectweb.jonas_ejb.container;

import java.util.Hashtable;
import javax.ejb.EJBHome;
import javax.ejb.EJBLocalHome;
import javax.naming.InitialContext;
import javax.transaction.TransactionManager;
import org.objectweb.jonas_ejb.deployment.api.BeanDesc;


/**
 * Interface to the Bean Factories 
 * used by the Container, JMX, or generic parts of this package.
 */
public interface BeanFactory {

    /**
     * get the bean name
     */
    public String getEJBName();

    /**
     * Get the Deployement descriptor of this Ejb
     * @return BeanDesc The bean deployment descriptor
     */
    public BeanDesc getDeploymentDescriptor();

    /**
     * @return the Instance pool size for this Ejb
     */
    public int getPoolSize();

    /**
     * stop this EJB (unregister it in JNDI)
     */
    public void stop();

    /**
     * synchronize bean instances if needed
     */
    public void sync();

    /**
     * reduce cache of instances
     */
    public void reduceCache();

    /**
     * returns the home if exist or null if not
     */
    public JHome getHome();

    /**
     * returns the local home if exist or null if not
     */
    public JLocalHome getLocalHome();

    /**
     * returns the TransactionManager
     */
    public TransactionManager getTransactionManager();

    /**
     * Returns the JContainer
     */
    public JContainer getContainer();

    /**
     * Return the JNDI Environment
     */
    public Hashtable getEnv();

    /**
     * Returns the InitialContext
     */
    public InitialContext getInitialContext();
}
