issrg.policytester.testing
Class PolicyTester

java.lang.Object
  extended by issrg.policytester.testing.PolicyTester

public class PolicyTester
extends java.lang.Object

Author:
Christian Azzopardi Adapted from the SampleAEF1.java

Field Summary
 java.util.Vector<java.lang.String> actionResultString
           
static java.lang.String ATTRIBUTE_CERTIFICATE_ATTRIBUTE_NAME
           
 java.lang.String decisionString
           
protected static Logger logger
           
 java.lang.String resultString
           
 
Constructor Summary
PolicyTester(java.util.Vector<java.lang.String> state, java.lang.String xmlPolicyFilePath, java.util.Vector<PTLDAPAC> ACs)
          Creates a new instance of PolicyTester
 
Method Summary
 boolean checkValidPolicy(java.lang.String filePath)
           
 void execute()
          Asks for a decision based on the information available from the latest pass of parseVector.
 java.lang.String execute(java.security.Principal user, Action action, Target target, java.util.Map env)
          The execute method is used to make a pull decision based on the certificate attributes provided
 Action getAction()
          Creates an object of type Action corresponding to the latest pass of parseVector.
static byte[] getBytes(java.lang.Object obj)
           
 java.lang.String getDecisionString()
           
 java.util.Map<java.lang.String,java.lang.Object> getEnvironment()
          Creates a Map representing the environment corresponding to the latest pass of parseVector.
 java.util.Vector<java.lang.String> getExeResult()
           
 java.lang.String getOID()
           
 boolean getParsingResult()
           
 java.security.Principal getPrincipal()
          Creates an object of type Principal corresponding to the latest pass of parseVector.
 java.lang.String getResultString()
           
 Target getTarget()
          Creates a PermisTarget object corresponding to the latest pass of parseVector.
 boolean getTestResult()
           
 void loadATT(VirtualRepository vr, java.lang.String filename)
          The loadATT method is used to load Text Based attributes into the virtual repositry vr as
 void loadPKC(VirtualRepository vr, java.lang.String filename)
          The loadPKC method is used to load the PKC certificate that the filename string points to into the VirtualRepositry vr
 void loadPolicy(java.lang.String filename)
          The loadPolicy method is used to load an XML policy if specified by the user it takes a virtual repositry vr and the filename of the policy to be loaded as its parameters it then creates a Simple permis Policy finder to be used by the system
 java.lang.String makeString(SetOfSubsetsCredentials set)
           
 void parseVectorContents(java.util.Vector<java.lang.String> parseVector)
           
static java.lang.String removeSystemTag(java.lang.String xml)
          This method does simplistic XML policy pre-processing to remove a <!DOCTYPE SYSTEM> tag from it.
 void resetExeResult(java.util.Vector<java.lang.String> v)
           
 void setDecisionString(java.lang.String s)
           
 void setExeResult(java.lang.String actionResult)
           
 void setParsingResult(boolean result)
           
 void setResultString(java.lang.String s)
           
 void setTestResult(boolean result)
           
 void stopAgent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actionResultString

public java.util.Vector<java.lang.String> actionResultString

resultString

public java.lang.String resultString

decisionString

public java.lang.String decisionString

ATTRIBUTE_CERTIFICATE_ATTRIBUTE_NAME

public static final java.lang.String ATTRIBUTE_CERTIFICATE_ATTRIBUTE_NAME
See Also:
Constant Field Values

logger

protected static Logger logger
Constructor Detail

PolicyTester

public PolicyTester(java.util.Vector<java.lang.String> state,
                    java.lang.String xmlPolicyFilePath,
                    java.util.Vector<PTLDAPAC> ACs)
Creates a new instance of PolicyTester

Method Detail

stopAgent

public void stopAgent()

getTarget

public Target getTarget()
                 throws BadURLException,
                        RFC2253ParsingException
Creates a PermisTarget object corresponding to the latest pass of parseVector.

Returns:
Throws:
BadURLException
RFC2253ParsingException

getAction

public Action getAction()
Creates an object of type Action corresponding to the latest pass of parseVector.

Returns:

getPrincipal

public java.security.Principal getPrincipal()
                                     throws RFC2253ParsingException
Creates an object of type Principal corresponding to the latest pass of parseVector.

Returns:
Throws:
RFC2253ParsingException

getEnvironment

public java.util.Map<java.lang.String,java.lang.Object> getEnvironment()
Creates a Map representing the environment corresponding to the latest pass of parseVector.

Returns:

getOID

public java.lang.String getOID()

checkValidPolicy

public boolean checkValidPolicy(java.lang.String filePath)

parseVectorContents

public void parseVectorContents(java.util.Vector<java.lang.String> parseVector)

getBytes

public static byte[] getBytes(java.lang.Object obj)

removeSystemTag

public static java.lang.String removeSystemTag(java.lang.String xml)
This method does simplistic XML policy pre-processing to remove a <!DOCTYPE SYSTEM> tag from it. The tag is intended to point to the DTD location, and the XML parsers attempt to validate the XML policy using it. Note that the location is very often machine-specific and only confuses the XML parser. It is safe to remove the pointer to the DTD, since the XMLPolicyParser validates the semantics of the XML.

Parameters:
xml - - the XML to remove the SYSTEM tag from
Returns:
the XML without the SYSTEM tag in it

loadPolicy

public void loadPolicy(java.lang.String filename)
The loadPolicy method is used to load an XML policy if specified by the user it takes a virtual repositry vr and the filename of the policy to be loaded as its parameters it then creates a Simple permis Policy finder to be used by the system

Parameters:
vr - -
filename -

loadATT

public void loadATT(VirtualRepository vr,
                    java.lang.String filename)
The loadATT method is used to load Text Based attributes into the virtual repositry vr as

Parameters:
vr -
filename -

loadPKC

public void loadPKC(VirtualRepository vr,
                    java.lang.String filename)
The loadPKC method is used to load the PKC certificate that the filename string points to into the VirtualRepositry vr

Parameters:
vr -
filename -

execute

public java.lang.String execute(java.security.Principal user,
                                Action action,
                                Target target,
                                java.util.Map env)
The execute method is used to make a pull decision based on the certificate attributes provided

Parameters:
user -
action -
target -
Returns:

execute

public void execute()
Asks for a decision based on the information available from the latest pass of parseVector. XXX: isn't finished yet!


makeString

public java.lang.String makeString(SetOfSubsetsCredentials set)
Parameters:
set -
Returns:

setParsingResult

public void setParsingResult(boolean result)

getParsingResult

public boolean getParsingResult()

setExeResult

public void setExeResult(java.lang.String actionResult)

getExeResult

public java.util.Vector<java.lang.String> getExeResult()

resetExeResult

public void resetExeResult(java.util.Vector<java.lang.String> v)

setResultString

public void setResultString(java.lang.String s)

getResultString

public java.lang.String getResultString()

setTestResult

public void setTestResult(boolean result)

getTestResult

public boolean getTestResult()

setDecisionString

public void setDecisionString(java.lang.String s)

getDecisionString

public java.lang.String getDecisionString()