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

import java.io.File;

import workflow.script.core.ScriptContext;

import com.zosatapo.commons.store.Store;

/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public interface Context extends Container
{
	// ----------------------------------------------------- Manifest TypeConstants

	/**
	 * The LifecycleEvent type sent when a context is reloaded.
	 */
	public static final String RELOAD_EVENT = "reload";

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

	/**
	 * Return the display name of this workflow application.
	 */
	public String getDisplayName();

	/**
	 * Set the display name of this workflow application.
	 *
	 * @param displayName The new display name
	 */
	public void setDisplayName(String displayName);

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

	/**
	 * Return the document root for this workflow Context. 
	 */
	public File getAbsoluteAppBase();
	
	/**
	 * Set the document root for this workflow Context.  This can be an absolute
	 * pathname, a relative pathname
	 *
	 * @param appBase The new document root
	 */
	public void setAppBase(String appBase);

	/**
	 * Return the reloadable flag for this workflow application.
	 */
	public boolean getReloadable();

	/**
	 * Set the reloadable flag for this workflow application.
	 *
	 * @param reloadable The new reloadable flag
	 */
	public void setReloadable(boolean reloadable);
	
	/**
	 * Return the script context for which this Context is a facade.
	 */
	public ScriptContext getScriptContext();
	
	/**
	 * Return the value of the auto deploy flag.  If true, it indicates that 
	 * this xpdl should be discovred and automatically 
	 * deployed dynamically.
	 */
	public boolean getAutoDeploy();


	/**
	 * Set the auto deploy flag value for this context.
	 * 
	 * @param autoDeploy The new auto deploy flag
	 */
	public void setAutoDeploy(boolean autoDeploy);
	// --------------------------------------------------------- Public Methods
	
 /**
	* Add a new context initialization parameter, replacing any existing
	* value for the specified name.
	*
	* @param name Name of the new parameter
	* @param value Value of the new  parameter
	*/
 public void addInitParameter(String name, String value);
		 
 /**
	* Return the value for the specified context initialization
	* parameter name, if any; otherwise return <code>null</code>.
	*
	* @param name Name of the parameter to return
	*/
 public String findInitParameter(String name);
 
 
 /**
	* Return the names of all defined context initialization parameters
	* for this Context.  If no parameters are defined, a zero-length
	* array is returned.
	*/
	public String[] findInitParameters();
 	
 	
	public void removeInitParameter(String name);
	
 	
	/**
	 * Add a new context initialization parameter, replacing any existing
	 * value for the specified name.
	 *
	 * @param name Name of the new parameter
	 * @param value Value of the new  parameter
	 */
	public void addFactoryClass(String name, String value);
		 
	/**
	 * Return the value for the specified context initialization
	 * parameter name, if any; otherwise return <code>null</code>.
	 *
	 * @param name Name of the parameter to return
	 */
	public String findFactoryClass(String name);
 
 
	/**
	 * Return the names of all defined context initialization parameters
	 * for this Context.  If no parameters are defined, a zero-length
	 * array is returned.
	 */
	 public String[] findFactoryClasses();
	 
	 public void removeFactoryClass(String name);
	 
	/**
	 * Add a new store, replacing any existing
	 * value for the specified key.
	 *
	 * @param key Name of the new store
	 * @param store Value of the new  Store
	 */
	public void addStore(String key, Store store);
		 
	/**
	 * Return the store for the specified context initialization
	 * parameter key, if any; otherwise return <code>null</code>.
	 *
	 * @param key Name of the store to return
	 */
	public Store findStore(String key);
 
	/**
	 * Return the keys of all defined context store
	 * for this Context.  If no stores are defined, a zero-length
	 * array is returned.
	 */
	 public String[] findStores();	 
	 public void removeStore(String key);
		 
	/**
	 * Reload this workflow application, if reloading is supported.
	 *
	 * @exception IllegalStateException if the <code>reloadable</code>
	 *  property is set to <code>false</code>.
	 */
	public void reload();
}