/**
 * 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): Florent BENOIT & Ludovic BERT
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.objectweb.jonas.mail;

//import java
import java.util.Properties;
import java.util.List;

/**
 * This interface provides a description for the mail service management.
 * @author Ludovic Bert
 * @author Florent Benoit
 */
public interface MailServiceImplMBean {

    /**
     * Create a mail factory with the specified properties and register it into
     * the registry.
     * @param name the name of the mail factory
     * @param props the properties used to configure the mail factory.
     * @param loadFromFile true if the mail factory is loaded from a .properties
     *        file
     * @throws MailServiceException if the creation or the registration of the
     *         factory failed.
     */
    void createMailFactoryMBean(String name, Properties props, Boolean loadFromFile) throws MailServiceException;

    /**
     * @return Integer Total number of mail factories available in JOnAS
     */
    Integer getCurrentNumberOfMailFactories();

    /**
     * @return Integer Number of internet.MimePartDataSource mail factories
     *         available in JOnAS
     */
    Integer getCurrentNumberOfMimeMailFactories();

    /**
     * @return Integer Number of mail Session mail factories available in JOnAS
     */
    Integer getCurrentNumberOfSessionMailFactories();

    /**
     * Gets the mail factory configuration properties from a local file
     * @param configFile configuration to use
     * @return mail factory configuration properties from a local file
     * @throws Exception if it fails
     */
    Properties getMailFactoryPropertiesFile(String configFile) throws Exception;

    /**
     * @return the list of properties files describeing mail factories found in
     *         JONAS_BASE/conf
     * @throws Exception if the list can't be returned
     */
    List getMailFactoryPropertiesFiles() throws Exception;

    /**
     * @return the list of properties files describeing MimePartDataSource mail
     *         factories found in JONAS_BASE/conf
     * @throws Exception if the list can't be returned
     */
    List getMimePartMailFactoryPropertiesFiles() throws Exception;

    /**
     * @return the list of properties files describeing Session mail factories
     *         found in JONAS_BASE/conf
     * @throws Exception if the list can't be returned
     */
    List getSessionMailFactoryPropertiesFiles() throws Exception;

    /**
     * Unregister the factory binded with the given name.
     * @param name the name of the factory.
     * @throws MailServiceException if the unregistration of the factory failed.
     */
    void unbindMailFactoryMBean(String name) throws MailServiceException;

}