/***********************************************************************

GECCO, a platform for command and control gaming

Copyright (C) 2001 Henrik Bäärnhielm, Andreas Enblom, Niklas
Hallenfur, Karl Hasselström, Henrik Hägerström, Oskar Linde, Jing Fu
Zi and Jon Åslund

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This program 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
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.

***********************************************************************/

package gecco.server.core;

import java.io.*;

import gecco.server.actionprocessor.ActionProcessor;
import gecco.server.automaton.AutomatonMap;
import gecco.server.core.Client;
import gecco.server.core.LogManager;
import gecco.server.core.Server;
import gecco.server.qmanager.QManager;
import gecco.server.unitmanager.UnitManager;
import gecco.server.visibility.VisibilityManager;

/**
 *  This class holds references to all important modules of the server. The
 *  modules can then get references to the other modules via this class.
 *
 * @author     Henrik Bäärnhielm, Karl Hasselström, Henrik Hägerström.
 * @created    April 30, 2001
 */
public class ReferenceHolder {

    /**
     *  Description of the Field
     */
    private static UnitManager unitManager;
    /**
     *  Description of the Field
     */
    private static QManager qManager;
    /**
     *  Description of the Field
     */
    private static VisibilityManager visibilityManager;
    /**
     *  Description of the Field
     */
    private static LogManager logManager;
    /**
     *  Description of the Field
     */
    private static ActionProcessor actionProcessor;
    /**
     *  Description of the Field
     */
    private static AutomatonMap automatonMap;
    /**
     *  Description of the Field
     */
    private static Client comClient;
    /**
     *  Description of the Field
     */
    private static Server comServer;
    /**
     *  This is the ClassLoader that is used to load classes from the
     *  jar file making up a particular game.
     */
    private static ClassLoader gameClassLoader;
    /**
     *  Standard input
     */
    public static BufferedReader in;
    /**
     *  Standard output
     */
    public static PrintWriter out;
    /**
     *  Standard error output
     */
    public static PrintWriter err;


    /**
     *  Sets the AutomatonMap attribute of the ReferenceHolder class
     *
     * @param  map  The new AutomatonMap value
     */
    public static void setAutomatonMap(AutomatonMap map) {
        automatonMap = map;
    }


    /**
     *  Sets the LogManager attribute of the ReferenceHolder class
     *
     * @param  _logManager  The new LogManager value
     */
    public static void setLogManager(LogManager _logManager) {
        logManager = _logManager;
    }


    /**
     *  Sets the ActionProcessor attribute of the ReferenceHolder class
     *
     * @param  _actionProcessor  The new ActionProcessor value
     */
    public static void setActionProcessor(ActionProcessor _actionProcessor) {
        actionProcessor = _actionProcessor;
    }


    /**
     *  Sets the UnitManager attribute of the ReferenceHolder class
     *
     * @param  _unitManager  The new UnitManager value
     */
    public static void setUnitManager(UnitManager _unitManager) {
        unitManager = _unitManager;
    }


    /**
     *  Sets the QManager attribute of the ReferenceHolder class
     *
     * @param  _qManager  The new QManager value
     */
    public static void setQManager(QManager _qManager) {
        qManager = _qManager;
    }


    /**
     *  Sets the ComClient attribute of the ReferenceHolder class
     *
     * @param  _comClient  The new ComClient value
     */
    public static void setComClient(Client _comClient) {
        comClient = _comClient;
    }


    /**
     *  Sets the ComServer attribute of the ReferenceHolder class
     *
     * @param  _comServer  The new ComServer value
     */
    public static void setComServer(Server _comServer) {
        comServer = _comServer;
    }


    /**
     *  Sets the VisibilityManager attribute of the ReferenceHolder class
     *
     * @param  _visibilityManager  The new VisibilityManager value
     */
    public static void setVisibilityManager(VisibilityManager _visibilityManager) {
        visibilityManager = _visibilityManager;
    }

    public static void setGameClassLoader(ClassLoader loader) {
	gameClassLoader = loader;
    }


    /**
     *  Gets the AutomatonMap attribute of the ReferenceHolder class
     *
     * @return    The AutomatonMap value
     */
    public static AutomatonMap getAutomatonMap() {
        return automatonMap;
    }


    /**
     *  Gets the LogManager attribute of the ReferenceHolder class
     *
     * @return    The LogManager value
     */
    public static LogManager getLogManager() {
        return logManager;
    }


    /**
     *  Gets the ActionProcessor attribute of the ReferenceHolder class
     *
     * @return    The ActionProcessor value
     */
    public static ActionProcessor getActionProcessor() {
        return actionProcessor;
    }


    /**
     *  Gets the UnitManager attribute of the ReferenceHolder class
     *
     * @return    The UnitManager value
     */
    public static UnitManager getUnitManager() {
        return unitManager;
    }


    /**
     *  Gets the QManager attribute of the ReferenceHolder class
     *
     * @return    The QManager value
     */
    public static QManager getQManager() {
        return qManager;
    }


    /**
     *  Gets the ComClient attribute of the ReferenceHolder class
     *
     * @return    The ComClient value
     */
    public static Client getComClient() {
        return comClient;
    }


    /**
     *  Gets the ComServer attribute of the ReferenceHolder class
     *
     * @return    The ComServer value
     */
    public static Server getComServer() {
        return comServer;
    }


    /**
     *  Gets the VisibilityManager attribute of the ReferenceHolder class
     *
     * @return    The VisibilityManager value
     */
    public static VisibilityManager getVisibilityManager() {
        return visibilityManager;
    }

    public static ClassLoader getGameClassLoader() {
	return gameClassLoader;
    }

}
