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

Quick Search    Search Deep

com.sun.xacml.finder.impl
Class FilePolicyModule  view FilePolicyModule download FilePolicyModule.java

java.lang.Object
  extended bycom.sun.xacml.finder.PolicyFinderModule
      extended bycom.sun.xacml.finder.impl.FilePolicyModule
All Implemented Interfaces:
org.xml.sax.ErrorHandler

public class FilePolicyModule
extends com.sun.xacml.finder.PolicyFinderModule
implements org.xml.sax.ErrorHandler

This module represents a collection of files containing polices, each of which will be searched through when trying to find a policy that is applicable to a specific request.

Note: this module is provided only as an example and for testing purposes. It is not part of the standard, and it should not be relied upon for production systems. In the future, this will likely be moved into a package with other similar example and testing code.

Since:
1.0

Field Summary
private  java.util.Set fileNames
           
private  com.sun.xacml.finder.PolicyFinder finder
           
static java.lang.String JAXP_SCHEMA_LANGUAGE
           
static java.lang.String JAXP_SCHEMA_SOURCE
           
private static java.util.logging.Logger logger
           
private  java.util.Set policies
           
static java.lang.String POLICY_SCHEMA_PROPERTY
          The property which is used to specify the schema file to validate against (if any)
private  java.io.File schemaFile
           
static java.lang.String W3C_XML_SCHEMA
           
 
Constructor Summary
FilePolicyModule()
          Constructor which retrieves the schema file to validate policies against from the POLICY_SCHEMA_PROPERTY.
FilePolicyModule(java.io.File schemaFile)
          Constructor that uses the specified input as the schema file to validate policies against.
FilePolicyModule(java.util.List fileNames)
          Constructor that specifies a set of initial policy files to use.
 
Method Summary
 boolean addPolicy(java.lang.String filename)
          Adds a file (containing a policy) to the collection of filenames associated with this module.
 void error(org.xml.sax.SAXParseException exception)
          Standard handler routine for the XML parsing.
 void fatalError(org.xml.sax.SAXParseException exception)
          Standard handler routine for the XML parsing.
 com.sun.xacml.finder.PolicyFinderResult findPolicy(com.sun.xacml.EvaluationCtx context)
          Finds a policy based on a request's context.
 void init(com.sun.xacml.finder.PolicyFinder finder)
          Initializes the FilePolicyModule by loading the policies contained in the collection of files associated with this module.
 boolean isRequestSupported()
          Indicates whether this module supports finding policies based on a request (target matching).
static com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String filename, com.sun.xacml.finder.PolicyFinder finder)
          Loads a policy from the specified filename and uses the specified PolicyFinder to help with instantiating PolicySets.
static com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String filename, com.sun.xacml.finder.PolicyFinder finder, java.io.File schemaFile, org.xml.sax.ErrorHandler handler)
          Loads a policy from the specified filename, using the specified PolicyFinder to help with instantiating PolicySets, and using the specified input as the schema file to validate policies against.
 void warning(org.xml.sax.SAXParseException exception)
          Standard handler routine for the XML parsing.
 
Methods inherited from class com.sun.xacml.finder.PolicyFinderModule
findPolicy, getIdentifier, invalidateCache, isIdReferenceSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLICY_SCHEMA_PROPERTY

public static final java.lang.String POLICY_SCHEMA_PROPERTY
The property which is used to specify the schema file to validate against (if any)

See Also:
Constant Field Values

JAXP_SCHEMA_LANGUAGE

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

W3C_XML_SCHEMA

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

JAXP_SCHEMA_SOURCE

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

finder

private com.sun.xacml.finder.PolicyFinder finder

schemaFile

private java.io.File schemaFile

fileNames

private java.util.Set fileNames

policies

private java.util.Set policies

logger

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

FilePolicyModule

public FilePolicyModule()
Constructor which retrieves the schema file to validate policies against from the POLICY_SCHEMA_PROPERTY. If the retrieved property is null, then no schema validation will occur.


FilePolicyModule

public FilePolicyModule(java.io.File schemaFile)
Constructor that uses the specified input as the schema file to validate policies against. If schema validation is not desired, a null value should be used.


FilePolicyModule

public FilePolicyModule(java.util.List fileNames)
Constructor that specifies a set of initial policy files to use. No schema validation is performed.

Method Detail

isRequestSupported

public boolean isRequestSupported()
Indicates whether this module supports finding policies based on a request (target matching). Since this module does support finding policies based on requests, it returns true.


init

public void init(com.sun.xacml.finder.PolicyFinder finder)
Initializes the FilePolicyModule by loading the policies contained in the collection of files associated with this module. This method also uses the specified PolicyFinder to help in instantiating PolicySets.


addPolicy

public boolean addPolicy(java.lang.String filename)
Adds a file (containing a policy) to the collection of filenames associated with this module.


loadPolicy

public static com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String filename,
                                                      com.sun.xacml.finder.PolicyFinder finder)
Loads a policy from the specified filename and uses the specified PolicyFinder to help with instantiating PolicySets.


loadPolicy

public static com.sun.xacml.AbstractPolicy loadPolicy(java.lang.String filename,
                                                      com.sun.xacml.finder.PolicyFinder finder,
                                                      java.io.File schemaFile,
                                                      org.xml.sax.ErrorHandler handler)
Loads a policy from the specified filename, using the specified PolicyFinder to help with instantiating PolicySets, and using the specified input as the schema file to validate policies against. If schema validation is not desired, a null value should be used for schemaFile


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. NOTE: this is basically just a subset of the OnlyOneApplicable Policy Combining Alg that skips the evaluation step. See comments in there for details on this algorithm.


warning

public void warning(org.xml.sax.SAXParseException exception)
             throws org.xml.sax.SAXException
Standard handler routine for the XML parsing.

Specified by:
warning in interface org.xml.sax.ErrorHandler

error

public void error(org.xml.sax.SAXParseException exception)
           throws org.xml.sax.SAXException
Standard handler routine for the XML parsing.

Specified by:
error in interface org.xml.sax.ErrorHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
Standard handler routine for the XML parsing.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler