JBoss port of sunxacml 2.0.8.Final-redhat-1

org.jboss.security.xacml.sunxacml.support.finder
Class FilePolicyModule

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.finder.PolicyFinderModule
      extended by org.jboss.security.xacml.sunxacml.support.finder.FilePolicyModule

public class FilePolicyModule
extends PolicyFinderModule

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. It does not support policy references.

Note that this class used to be provided in the com.sun.xacml.finder.impl package with a warning that it would move out of the core packages eventually. This is partly because this class doesn't represent standard functionality, and partly because it isn't designed to be generally useful as anything more than an example. Because so many people have used this class, however, it stayed in place until the 2.0 release.

As of the 2.0 release, you may still use this class (in its new location), but you are encouraged to migrate to the new support modules that are much richer and designed for general-purpose use. Also, note that the loadPolicy methods that used to be available from this class have been removed. That functionality has been replaced by the much more useful PolicyReader class. If you need to load policies directly, you should consider that new class.

Since:
1.0
Author:
Seth Proctor

Constructor Summary
FilePolicyModule()
          Constructor which retrieves the schema file to validate policies against from the PolicyReader.POLICY_SCHEMA_PROPERTY.
FilePolicyModule(File schemaFile)
          Constructor that uses the specified File as the schema file for XML validation.
FilePolicyModule(List fileNames)
          Constructor that specifies a set of initial policy files to use.
FilePolicyModule(List fileNames, String schemaFile)
          Constructor that specifies a set of initial policy files to use and the schema file used to validate the policies.
FilePolicyModule(String schemaFile)
          Constructor that uses the specified String as the schema file for XML validation.
 
Method Summary
 boolean addPolicy(String filename)
          Adds a file (containing a policy) to the collection of filenames associated with this module.
 PolicyFinderResult findPolicy(EvaluationCtx context)
          Finds a policy based on a request's context.
 void init(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).
 
Methods inherited from class org.jboss.security.xacml.sunxacml.finder.PolicyFinderModule
findPolicy, getIdentifier, invalidateCache, isIdReferenceSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePolicyModule

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


FilePolicyModule

public FilePolicyModule(File schemaFile)
Constructor that uses the specified File as the schema file for XML validation. If schema validation is not desired, a null value should be used.

Parameters:
schemaFile - the schema file to validate policies against, or null if schema validation is not desired.

FilePolicyModule

public FilePolicyModule(String schemaFile)
Constructor that uses the specified String as the schema file for XML validation. If schema validation is not desired, a null value should be used.

Parameters:
schemaFile - the schema file to validate policies against, or null if schema validation is not desired.

FilePolicyModule

public FilePolicyModule(List fileNames)
Constructor that specifies a set of initial policy files to use. This retrieves the schema file to validate policies against from the PolicyReader.POLICY_SCHEMA_PROPERTY. If the retrieved property is null, then no schema validation will occur.

Parameters:
fileNames - a List of Strings that identify policy files

FilePolicyModule

public FilePolicyModule(List fileNames,
                        String schemaFile)
Constructor that specifies a set of initial policy files to use and the schema file used to validate the policies. If schema validation is not desired, a null value should be used.

Parameters:
fileNames - a List of Strings that identify policy files
schemaFile - the schema file to validate policies against, or null if schema validation is not desired.
Method Detail

addPolicy

public boolean addPolicy(String filename)
Adds a file (containing a policy) to the collection of filenames associated with this module. Note that this doesn't actually load the policy file. Policies aren't loaded from their files until the module is initialized through the init method (which is called automatically by the PolicyFinder when the system comes up).

Parameters:
filename - the file to add to this module's collection of files

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.

Overrides:
isRequestSupported in class PolicyFinderModule
Returns:
true, since finding policies based on requests is supported

init

public void init(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.

Specified by:
init in class PolicyFinderModule
Parameters:
finder - a PolicyFinder used to help in instantiating PolicySets

findPolicy

public PolicyFinderResult findPolicy(EvaluationCtx context)
Finds a policy based on a request's context. If more than one applicable policy is found, this will return an error. Note that 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.

Overrides:
findPolicy in class PolicyFinderModule
Parameters:
context - the representation of the request data
Returns:
the result of trying to find an applicable policy

JBoss port of sunxacml 2.0.8.Final-redhat-1

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.