//----------------------------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.workflow.script.runtime;

import java.io.IOException;

import org.huihoo.workflow.selector.GenericSelector;
import org.huihoo.workflow.selector.SelectorContext;
import org.huihoo.workflow.selector.SelectorException;
import org.huihoo.workflow.selector.SelectorScript;
import org.huihoo.workflow.server.WorkflowConfig;
import org.huihoo.workflow.server.WorkflowWork;
import org.huihoo.workflow.xpdl.WorkflowTransition;

public abstract class SelectorScriptBase extends GenericSelector implements SelectorScript
{
	protected SelectorScriptBase()
	{
	}

	public void init(WorkflowConfig config) throws SelectorException
	{
		super.init(config);
		scriptInit();
		__scriptInit();
	}

	public void destroy()
	{
		scriptDestroy();
		__scriptDestroy();
	}

	public boolean evalute(WorkflowWork workflowWork, WorkflowTransition workflowTransition, SelectorContext context)
		throws SelectorException, IOException
	{
		return __scriptEvalute(workflowWork, workflowTransition, context);
	}

	public void scriptInit()
	{
	}

	public void __scriptInit()
	{
	}

	public void scriptDestroy()
	{
	}

	protected void __scriptDestroy()
	{
	}

	public abstract boolean __scriptEvalute(
		WorkflowWork workflowWork,
		WorkflowTransition workflowTransition,
		SelectorContext context)
		throws SelectorException, IOException;
}
