/*
 * Created on 2004-6-9
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.huihoo.willow;

import org.huihoo.willow.core.StandardServer;
;
/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class ServerFactory
{
	// ------------------------------------------------------- Static Variables

	/**
	 * The singleton <code>Server</code> instance for this JVM.
	 */
	private static Server server = null;

	// --------------------------------------------------------- Public Methods

	/**
	 * Return the singleton <code>Server</code> instance for this JVM.
	 */
	public static Server getServer()
	{
		if (server == null)
		{
			server = new StandardServer();
		}
		return (server);

	}

	/**
	 * Set the singleton <code>Server</code> instance for this JVM.  This
	 * method must <strong>only</strong> be called from a constructor of
	 * the (singleton) <code>Server</code> instance that is created for
	 * this execution of Willow.
	 *
	 * @param theServer The new singleton instance
	 */
	public static void setServer(Server theServer)
	{

		if (server == null)
		{
			server = theServer;
		}
	}

}
