Class Policy

java.lang.Object
  |
  +--Policy

public class Policy
extends java.lang.Object

A class that handle ACCEPT/DENY policy for the Proxy


Field Summary
 boolean ACCEPT_NO_MATCH
          specifies if Policy shoud accept hosname that have found no match in rules; default is true;
 java.lang.String ACCEPT_STRING
           
protected  java.util.Vector accepted
           
protected  java.util.Vector denied
           
 java.lang.String DENY_STRING
           
 
Constructor Summary
Policy(java.lang.String sPolicyFile)
          Constructor
Policy(java.lang.String sPolicyFile, boolean acceptNoMatch)
          Constructor
 
Method Summary
 boolean accept(java.lang.String sHostName)
          apply policy to a hostname.
 boolean addRule(java.lang.String sRule)
          add a new rule to policy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPT_NO_MATCH

public boolean ACCEPT_NO_MATCH
specifies if Policy shoud accept hosname that have found no match in rules; default is true;

ACCEPT_STRING

public java.lang.String ACCEPT_STRING

DENY_STRING

public java.lang.String DENY_STRING

accepted

protected java.util.Vector accepted

denied

protected java.util.Vector denied
Constructor Detail

Policy

public Policy(java.lang.String sPolicyFile)
Constructor
Parameters:
sPolicyFile - : the name of the file containing policy rules the syntax to be used is the following:
deny pcguest.univ-mlv.fr accept *.univ-mlv.fr you can use joker '*' to say 'all'

Policy

public Policy(java.lang.String sPolicyFile,
              boolean acceptNoMatch)
       throws java.lang.Exception
Constructor
Parameters:
sPolicyFile - : the name of the file containing policy rules
acceptNoMatch - : says if we should accept hostnames with no rule matching the syntax to be used is the following:
deny pcguest.univ-mlv.fr accept *.univ-mlv.fr you can use joker '*' to say 'all'
Method Detail

addRule

public boolean addRule(java.lang.String sRule)
add a new rule to policy
Parameters:
sRule - a policy rule with the form "ACCEPT|DENY machine.domain.area"
Returns:
 

accept

public boolean accept(java.lang.String sHostName)
apply policy to a hostname. Top when the first rule is found.
Returns:
true if sHostName is allowed, false if not allowed