/************************************************
* Columbia University CS Department
* Network Security Lab
*
* Open and Survivable Embedded Systems (OASES)
*
* Structured Policy Command Language (SPCL)
*
*
* This software is provided as is without any
* warranty or guarantee of merchantibility
* or fitness for a particular purpose. This
* software is released under the terms of the
* GNU General Public License (GPL).
*
* Last updated: March 26, 2003
*
***********************************************/

package spcl.data;

/** 
 * An interface mechanism for loading new
 * zones and policies.
 *
 * @author locasto@cs.columbia.edu
*/
public interface PolicyLoader{

	public static final int SYSTEM_TIME = 333;

	/**
	 * The primary mechanism for loading a zone in
	 * If the zone does not have an attached policy,
	 * merely creates the namespace.
	*/
	public abstract void load( Zone zone );
	
	/** 
	 * Loads the provided Policy into the indicated zone.
	 *
	 * Basically looks up the zone in the PolicyEngine and calls
	 *  <code>zone.attach( policy );</code>
	 *
	 * @throws PolicyException if the provided policy could not be loaded
	 *   into the indicated zone (the zone or policy doesn't exist, is malformed,etc)
	*/
	public abstract void load( Policy policy, String zoneName ) throws PolicyException;

	/** A policy installer may wish to use this so that it can
	 * get a reference to a zone already present in the PolicyEngine.
	 * This is implemented in the current version, but only used internally by
	 * the policyengine.
	*/
	public abstract Zone lookupZone( String zoneName );

	/**
	 * used to retire the named policy
	 *
	 * @returns false if the policy is not found
	 * @returns true if the policy was found and unloaded
	 * @throws PolicyException if the policy was found, but could not be unloaded
	*/
	public abstract boolean unload( String policyName );

	/**
	 * used to suspend consultation of the named policy
	*/
	public abstract boolean suspend( String policyName );

	/**
	 * used to resume consultation of the named (suspended) policy
	*/
	public abstract boolean resume( String policyName );

	//rc( "system", "time", Variable.DATE,

	//for special case 'system' and 'time'
	public abstract boolean resolveCondition( int sys_var, String relop, String rval );

	//for special case 'system' and 'time'
	public abstract boolean resolveCondition( int sys_var, String relop, boolean rval );

	//for special case boolean
	public abstract boolean resolveCondition( Variable var, String relop, boolean rval );

	//rc( webserver, ip_addr, ,">", "rval", spcl.data.Variable.STRING );
	public abstract boolean resolveCondition( Variable var, String relop, String rval );
}
