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

public interface Service extends Container
{

	// ------------------------------------------------------------- Properties

	/**
	 * Return the application root for this Service.  This can be an absolute
	 * pathname, a relative pathname  
	 */
	public String getAppBase();

	/**
	 * Return the default session timeout (in minutes) for this
	 * workflow desktop.
	 */
	public int getSessionTimeout();

	/**
	 * Set the default session timeout (in minutes) for this
	 * workflow desktop.
	 *
	 * @param timeout The new default session timeout
	 */
	public void setSessionTimeout(int timeout);

	/**
	 * Set the application root for this Service. This can be an absolute
	 * pathname, a relative pathname 
	 *
	 * @param appBase The new application root
	 */
	public void setAppBase(String engineBase);

	/**
	 * Return the value of the auto deploy flag.  If true, it indicates that 
	 * this engine's child webapps should be discovred and automatically 
	 * deployed dynamically.
	 */
	public boolean getAutoDeploy();

	/**
	 * Set the auto deploy flag value for this engine.
	 * 
	 * @param autoDeploy The new auto deploy flag
	 */
	public void setAutoDeploy(boolean autoDeploy);

	/**
	 * Return the value of the deploy on startup flag.  If true, it indicates 
	 * that this host's child webapps should be discovred and automatically 
	 * deployed.
	 */
	public boolean getDeployOnStartup();

	/**
	 * Set the deploy on startup flag value for this host.
	 * 
	 * @param deployOnStartup The new deploy on startup flag
	 */
	public void setDeployOnStartup(boolean deployOnStartup);

	/**
	 * Get the server.xml <host> attribute's xmlNamespaceAware.
	 * @return true if namespace awarenes is enabled.
	 *
	 */
	public boolean getXmlNamespaceAware();

	/**
	 * Get the server.xml <host> attribute's xmlValidation.
	 * @return true if validation is enabled.
	 *
	 */
	public boolean getXmlValidation();

	/**
	 * Set the validation feature of the XML parser used when
	 * parsing xml instances.
	 * @param xmlValidation true to enable xml instance validation
	 */
	public void setXmlValidation(boolean xmlValidation);

	/**
		 * Set the namespace aware feature of the XML parser used when
		 * parsing xml instances.
		 * @param xmlNamespaceAware true to enable namespace awareness
		 */
	public void setXmlNamespaceAware(boolean xmlNamespaceAware);

	// --------------------------------------------------------- Public Methods
	
	/**
	 * Return the <code>Server</code> with which we are associated (if any).
	 */
	public Server getServer();

	/**
	 * Set the <code>Server</code> with which we are associated (if any).
	 *
	 * @param server The server that owns this Service
	 */
	public void setServer(Server server);

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

	/**
	 * Add a new Connector to the set of defined Connectors, and associate it
	 * with this Service's Service.
	 *
	 * @param connector The Connector to be added
	 */
	public void addConnector(Connector connector);

	/**
	 * Find and return the set of Connector associated with this Service.
	 */
	public Connector[] findConnectors();

	/**
	 * Remove the specified Connector from the set associated from this
	 * Service.  The removed Connector will also be disassociated from our
	 * Service.
	 *
	 * @param connector The Connector to be removed
	 */
	public void removeConnector(Connector connector);

	/**
	 * Return the RealmDatabase with which this ServiceProviderProvider is associated.  If there is
	 * no associated RealmDatabase return <code>null</code>.
	 */
	public RealmDatabase getRealmDatabase();

	/**
	 * Set the Realm with which this ServiceProviderProvider is associated.
	 *
	 * @param realmDatabase The newly associated Realm
	 */
	public void setRealmDatabase(RealmDatabase realmDatabase);

	/**
	 * Return the Manager with which this Service is associated. 
	 */
	public Manager getManager();

	/**
	 * Set the Manager with which this Service is associated.
	 *
	 * @param Manager The newly associated Manager
	 */
	public void setManager(Manager manager);
	

	/**
	 * Set the DefaultContext
	 * for new workflow applications.
	 *
	 * @param defaultContext The new DefaultContext
	 */
	public void addDefaultContext(DefaultContext defaultContext);


	/**
	 * Retrieve the DefaultContext for new workflow applications.
	 */
	public DefaultContext getDefaultContext();

	/**
	 * Import the DefaultContext config into a workflow application context.
	 *
	 * @param context workflow application context to import default context
	 */
	public void importDefaultContext(Context context);
	
	
	/**
	 * Invoke a pre-startup initialization. This is used to allow connectors
	 * to bind to restricted ports under Unix operating environments.
	 *
	 * @exception LifecycleException If this server was already initialized.
	 */
	public void initialize() throws LifecycleException;
}
