Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.xacml.test
Class TestPolicyFinderModule  view TestPolicyFinderModule download TestPolicyFinderModule.java

java.lang.Object
  extended bycom.sun.xacml.finder.PolicyFinderModule
      extended bycom.sun.xacml.test.TestPolicyFinderModule

public class TestPolicyFinderModule
extends com.sun.xacml.finder.PolicyFinderModule

A PolicyFinderModule used to handle all policies in the conformance tests. It supports retrevial for requests and for references, but is tightly coupled with the structure of the conformance tests, and is definately not thread-safe.


Field Summary
private  com.sun.xacml.finder.PolicyFinder finder
           
private  java.util.Set policies
           
private  java.lang.String policyRefPrefix
           
private  java.util.Map policyRefs
           
private  java.lang.String policySetRefPrefix
           
private  java.util.Map policySetRefs
           
 
Constructor Summary
TestPolicyFinderModule()
          Default constructor.
 
Method Summary
 com.sun.xacml.finder.PolicyFinderResult findPolicy(com.sun.xacml.EvaluationCtx context)
          Finds the applicable policy (if there is one) for the given context.
 com.sun.xacml.finder.PolicyFinderResult findPolicy(java.net.URI idReference, int type)
          Resolves the reference to a policy or policy set, if possible.
 void init(com.sun.xacml.finder.PolicyFinder finder)
          Initializes this module with the given finder.
 boolean isIdReferenceSupported()
          Always returns true, since reference-based retrieval is supported.
 boolean isRequestSupported()
          Always returns true, since request-based retrieval is supported.
private  com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String filename, com.sun.xacml.finder.PolicyFinder finder)
          Private helper that tries to load the given file-based policy, and returns null if any error occurs.
 void setPolicies(java.util.Set policyFiles)
          Re-sets the policies known to this module to those contained in the given files.
 void setPolicies(java.lang.String policyFile)
          Re-sets the policies known to this module to the single policy provided in the given file.
 void setPolicyRefs(java.util.Map policyRefs, java.lang.String prefix)
          Re-sets the policy reference mapping used for policies.
 void setPolicySetRefs(java.util.Map policySetRefs, java.lang.String prefix)
          Re-sets the policy reference mapping used for policy sets.
 
Methods inherited from class com.sun.xacml.finder.PolicyFinderModule
getIdentifier, invalidateCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

finder

private com.sun.xacml.finder.PolicyFinder finder

policies

private java.util.Set policies

policyRefs

private java.util.Map policyRefs

policyRefPrefix

private java.lang.String policyRefPrefix

policySetRefs

private java.util.Map policySetRefs

policySetRefPrefix

private java.lang.String policySetRefPrefix
Constructor Detail

TestPolicyFinderModule

public TestPolicyFinderModule()
Default constructor.

Method Detail

init

public void init(com.sun.xacml.finder.PolicyFinder finder)
Initializes this module with the given finder.


isRequestSupported

public boolean isRequestSupported()
Always returns true, since request-based retrieval is supported.


isIdReferenceSupported

public boolean isIdReferenceSupported()
Always returns true, since reference-based retrieval is supported.


setPolicies

public void setPolicies(java.lang.String policyFile)
                 throws java.lang.Exception
Re-sets the policies known to this module to the single policy provided in the given file.


setPolicies

public void setPolicies(java.util.Set policyFiles)
                 throws java.lang.Exception
Re-sets the policies known to this module to those contained in the given files.


setPolicyRefs

public void setPolicyRefs(java.util.Map policyRefs,
                          java.lang.String prefix)
Re-sets the policy reference mapping used for policies.


setPolicySetRefs

public void setPolicySetRefs(java.util.Map policySetRefs,
                             java.lang.String prefix)
Re-sets the policy reference mapping used for policy sets.


findPolicy

public com.sun.xacml.finder.PolicyFinderResult findPolicy(com.sun.xacml.EvaluationCtx context)
Finds the applicable policy (if there is one) for the given context.


findPolicy

public com.sun.xacml.finder.PolicyFinderResult findPolicy(java.net.URI idReference,
                                                          int type)
Resolves the reference to a policy or policy set, if possible.


loadPolicy

private com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String filename,
                                                com.sun.xacml.finder.PolicyFinder finder)
Private helper that tries to load the given file-based policy, and returns null if any error occurs.