JBoss port of sunxacml 2.0.5

org.jboss.security.xacml.sunxacml
Class PolicySet

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.AbstractPolicy
      extended by org.jboss.security.xacml.sunxacml.PolicySet
All Implemented Interfaces:
PolicyTreeElement

public class PolicySet
extends AbstractPolicy

Represents one of the two top-level constructs in XACML, the PolicySetType. This can contain other policies and policy sets, and can also contain URIs that point to policies and policy sets.

Since:
1.0
Author:
Seth Proctor

Constructor Summary
PolicySet(URI id, PolicyCombiningAlgorithm combiningAlg, Target target)
          Creates a new PolicySet with only the required elements.
PolicySet(URI id, PolicyCombiningAlgorithm combiningAlg, Target target, List policies)
          Creates a new PolicySet with only the required elements, plus some policies.
PolicySet(URI id, String version, PolicyCombiningAlgorithm combiningAlg, String description, Target target, List policies)
          Creates a new PolicySet with the required elements plus some policies and a String description.
PolicySet(URI id, String version, PolicyCombiningAlgorithm combiningAlg, String description, Target target, List policies, String defaultVersion)
          Creates a new PolicySet with the required elements plus some policies, a String description, and policy defaults.
PolicySet(URI id, String version, PolicyCombiningAlgorithm combiningAlg, String description, Target target, List policies, String defaultVersion, Set obligations)
          Creates a new PolicySet with the required elements plus some policies, a String description, policy defaults, and obligations.
PolicySet(URI id, String version, PolicyCombiningAlgorithm combiningAlg, String description, Target target, List policyElements, String defaultVersion, Set obligations, List parameters)
          Creates a new PolicySet with the required and optional elements.
 
Method Summary
 void encode(OutputStream output)
          Encodes this PolicySet into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(OutputStream output, Indenter indenter)
          Encodes this PolicySet into its XML representation and writes this encoding to the given OutputStream with indentation.
static PolicySet getInstance(Node root)
          Creates an instance of a PolicySet object based on a DOM node.
static PolicySet getInstance(Node root, PolicyFinder finder)
          Creates an instance of a PolicySet object based on a DOM node.
 
Methods inherited from class org.jboss.security.xacml.sunxacml.AbstractPolicy
encodeCommonElements, evaluate, getChildElements, getChildren, getCombiningAlg, getCombiningParameters, getDefaultVersion, getDescription, getId, getMetaData, getObligations, getTarget, getVersion, match, setChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicySet

public PolicySet(URI id,
                 PolicyCombiningAlgorithm combiningAlg,
                 Target target)
Creates a new PolicySet with only the required elements.

Parameters:
id - the policy set identifier
combiningAlg - the CombiningAlgorithm used on the policies in this set
target - the Target for this set

PolicySet

public PolicySet(URI id,
                 PolicyCombiningAlgorithm combiningAlg,
                 Target target,
                 List policies)
Creates a new PolicySet with only the required elements, plus some policies.

Parameters:
id - the policy set identifier
combiningAlg - the CombiningAlgorithm used on the policies in this set
target - the Target for this set
policies - a list of AbstractPolicy objects
Throws:
IllegalArgumentException - if the List of policies contains an object that is not an AbstractPolicy

PolicySet

public PolicySet(URI id,
                 String version,
                 PolicyCombiningAlgorithm combiningAlg,
                 String description,
                 Target target,
                 List policies)
Creates a new PolicySet with the required elements plus some policies and a String description.

Parameters:
id - the policy set identifier
version - the policy version or null for the default (this is always null for pre-2.0 policies)
combiningAlg - the CombiningAlgorithm used on the policies in this set
description - a String describing the policy
target - the Target for this set
policies - a list of AbstractPolicy objects
Throws:
IllegalArgumentException - if the List of policies contains an object that is not an AbstractPolicy

PolicySet

public PolicySet(URI id,
                 String version,
                 PolicyCombiningAlgorithm combiningAlg,
                 String description,
                 Target target,
                 List policies,
                 String defaultVersion)
Creates a new PolicySet with the required elements plus some policies, a String description, and policy defaults.

Parameters:
id - the policy set identifier
version - the policy version or null for the default (this is always null for pre-2.0 policies)
combiningAlg - the CombiningAlgorithm used on the policies in this set
description - a String describing the policy
target - the Target for this set
policies - a list of AbstractPolicy objects
defaultVersion - the XPath version to use
Throws:
IllegalArgumentException - if the List of policies contains an object that is not an AbstractPolicy

PolicySet

public PolicySet(URI id,
                 String version,
                 PolicyCombiningAlgorithm combiningAlg,
                 String description,
                 Target target,
                 List policies,
                 String defaultVersion,
                 Set obligations)
Creates a new PolicySet with the required elements plus some policies, a String description, policy defaults, and obligations.

Parameters:
id - the policy set identifier
version - the policy version or null for the default (this is always null for pre-2.0 policies)
combiningAlg - the CombiningAlgorithm used on the policies in this set
description - a String describing the policy
target - the Target for this set
policies - a list of AbstractPolicy objects
defaultVersion - the XPath version to use
obligations - a set of Obligation objects
Throws:
IllegalArgumentException - if the List of policies contains an object that is not an AbstractPolicy

PolicySet

public PolicySet(URI id,
                 String version,
                 PolicyCombiningAlgorithm combiningAlg,
                 String description,
                 Target target,
                 List policyElements,
                 String defaultVersion,
                 Set obligations,
                 List parameters)
Creates a new PolicySet with the required and optional elements. If you need to provide combining algorithm parameters, you need to use this constructor. Note that unlike the other constructors in this class, the policies list is actually a list of CombinerElements used to match a policy with any combiner parameters it may have.

Parameters:
id - the policy set identifier
version - the policy version or null for the default (this is always null for pre-2.0 policies)
combiningAlg - the CombiningAlgorithm used on the rules in this set
description - a String describing the policy or null if there is no description
target - the Target for this policy
policyElements - a list of CombinerElement objects or null if there are no policies
defaultVersion - the XPath version to use or null if there is no default version
obligations - a set of Obligations objects or null if there are no obligations
parameters - the List of CombinerParameters provided for general use by the combining algorithm
Throws:
IllegalArgumentException - if the List of rules contains an object that is not a Rule
Method Detail

getInstance

public static PolicySet getInstance(Node root)
                             throws ParsingException
Creates an instance of a PolicySet object based on a DOM node. The node must be the root of PolicySetType XML object, otherwise an exception is thrown. This PolicySet will not support references because it has no PolicyFinder.

Parameters:
root - the DOM root of a PolicySetType XML type
Throws:
ParsingException - if the PolicySetType is invalid

getInstance

public static PolicySet getInstance(Node root,
                                    PolicyFinder finder)
                             throws ParsingException
Creates an instance of a PolicySet object based on a DOM node. The node must be the root of PolicySetType XML object, otherwise an exception is thrown. The finder is used to handle policy references.

Parameters:
root - the DOM root of a PolicySetType XML type
finder - the PolicyFinder used to handle references
Throws:
ParsingException - if the PolicySetType is invalid

encode

public void encode(OutputStream output)
Encodes this PolicySet into its XML representation and writes this encoding to the given OutputStream with no indentation.

Parameters:
output - a stream into which the XML-encoded data is written

encode

public void encode(OutputStream output,
                   Indenter indenter)
Encodes this PolicySet into its XML representation and writes this encoding to the given OutputStream with indentation.

Parameters:
output - a stream into which the XML-encoded data is written
indenter - an object that creates indentation strings

JBoss port of sunxacml 2.0.5

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.