//----------------------------BEGIN LICENSE----------------------------
/* 
 * Willow : the Open Source WorkFlow Project
 * Distributable under GNU LGPL license by gun.org
 *
 * Copyright (C) 2004-2010  huihoo.org 
 * Copyright (C) 2004-2010  ZosaTapo <dertyang@hotmail.com> 
 * 
 * ====================================================================
 * Project Homepage : http://www.huihoo.org/willow
 * Source Forge     : http://sourceforge.net/projects/huihoo
 * Mailing list     : willow@lists.sourceforge.net 
 */
//----------------------------END  LICENSE-----------------------------
package org.huihoo.willow;

import org.huihoo.willow.core.StandardServer;


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;
		}
	}

}
