eu.xtreemos.xosd.vops.xacml.utils
Class VOPSPolicyFinder

java.lang.Object
  extended by com.sun.xacml.finder.PolicyFinder
      extended by eu.xtreemos.xosd.vops.xacml.utils.VOPSPolicyFinder

public class VOPSPolicyFinder
extends com.sun.xacml.finder.PolicyFinder

This class is used by the PDP to find all policies used in evaluation. A PDP is given a pre-configured PolicyFinder on construction. The PolicyFinder provides the functionality both to find policies based on a request (ie, retrieve policies and match against the target) and based on an idReference (as can be included in a PolicySet).

While this class is typically used by the PDP, it is intentionally designed to support stand-alone use, so it could be the base for a distributed service, or for some application that needs just this functionality. There is nothing in the PolicyFinder Note that it is an error to have more than one top-level policy (as explained in the OnlyOneApplicable combining algorithm), so any module that is added to this finder will be evaluated each time a policy is requested. This means that you should think carefully about how many modules you include, and how they can cache policy data.

Since:
1.0
Author:
Seth Proctor

Field Summary
private  java.util.Set allModules
           
private static java.util.logging.Logger logger
           
private  java.util.Set referenceModules
           
private  java.util.Set requestModules
           
 
Constructor Summary
VOPSPolicyFinder()
           
 
Method Summary
 com.sun.xacml.finder.PolicyFinderResult findPolicy(com.sun.xacml.EvaluationCtx context)
          Finds a policy based on a request's context.
 com.sun.xacml.finder.PolicyFinderResult findPolicy(java.net.URI idReference, int type)
          Finds a policy based on an id reference.
 java.util.Set getModules()
          Returns the unordered Set of modules used by this class to find policies.
 void init()
           
 void setModules(java.util.Set modules)
          Sets the unordered Set of modules used by this class to find policies.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allModules

private java.util.Set allModules

requestModules

private java.util.Set requestModules

referenceModules

private java.util.Set referenceModules

logger

private static final java.util.logging.Logger logger
Constructor Detail

VOPSPolicyFinder

public VOPSPolicyFinder()
Method Detail

getModules

public java.util.Set getModules()
Returns the unordered Set of modules used by this class to find policies.

Overrides:
getModules in class com.sun.xacml.finder.PolicyFinder
Returns:
the set of modules used by this class

setModules

public void setModules(java.util.Set modules)
Sets the unordered Set of modules used by this class to find policies.

Overrides:
setModules in class com.sun.xacml.finder.PolicyFinder
Parameters:
modules - the modules this class will use

init

public void init()
Overrides:
init in class com.sun.xacml.finder.PolicyFinder

findPolicy

public com.sun.xacml.finder.PolicyFinderResult findPolicy(com.sun.xacml.EvaluationCtx context)
Finds a policy based on a request's context. This may involve using the request data as indexing data to lookup a policy. This will always do a Target match to make sure that the given policy applies. If more than one applicable policy is found, this will return an error.

Overrides:
findPolicy in class com.sun.xacml.finder.PolicyFinder
Parameters:
context - the representation of the request data
Returns:
the result of trying to find an applicable policy

findPolicy

public com.sun.xacml.finder.PolicyFinderResult findPolicy(java.net.URI idReference,
                                                          int type)
                                                   throws java.lang.IllegalArgumentException
Finds a policy based on an id reference. This may involve using the reference as indexing data to lookup a policy. This will always do a Target match to make sure that the given policy applies. If more than one applicable policy is found, this will return an error.

Overrides:
findPolicy in class com.sun.xacml.finder.PolicyFinder
Parameters:
idReference - the identifier used to resolve a policy
type - type of reference (policy or policySet) as identified by the fields in PolicyReference
Returns:
the result of trying to find an applicable policy
Throws:
java.lang.IllegalArgumentException - if type is invalid