SunTM's XACML Implementation for JavaTM

com.sun.xacml
Class Policy

java.lang.Object
  extended bycom.sun.xacml.AbstractPolicy
      extended bycom.sun.xacml.Policy
All Implemented Interfaces:
PolicyTreeElement

public class Policy
extends AbstractPolicy

Represents one of the two top-level constructs in XACML, the PolicyType. This optionally contains rules, which in turn contain most of the logic of a policy.

Since:
1.0

Field Summary
 
Fields inherited from class com.sun.xacml.AbstractPolicy
XPATH_1_0_VERSION
 
Constructor Summary
Policy(URI id, RuleCombiningAlgorithm combiningAlg, String description, Target target, List rules)
          Creates a new Policy with the required elements plus some rules and a String description.
Policy(URI id, RuleCombiningAlgorithm combiningAlg, String description, Target target, String defaultVersion, List rules)
          Creates a new Policy with the required elements plus some rules, a String description and policy defaults.
Policy(URI id, RuleCombiningAlgorithm combiningAlg, String description, Target target, String defaultVersion, List rules, Set obligations)
          Creates a new Policy with the required elements plus some rules, a String description, policy defaults, and obligations.
Policy(URI id, RuleCombiningAlgorithm combiningAlg, Target target)
          Creates a new Policy with only the required elements.
Policy(URI id, RuleCombiningAlgorithm combiningAlg, Target target, List rules)
          Creates a new Policy with only the required elements plus some rules.
Policy(URI id, RuleCombiningAlgorithm combiningAlg, Target target, String defaultVersion, List rules)
          Creates a new Policy with the required elements plus some rules and policy defaults.
 
Method Summary
 void encode(OutputStream output)
          Encodes this Policy into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(OutputStream output, Indenter indenter)
          Encodes this Policy into its XML representation and writes this encoding to the given OutputStream with indentation.
static Policy getInstance(Node root)
          Creates an instance of a Policy object based on a DOM node.
 
Methods inherited from class com.sun.xacml.AbstractPolicy
encodeCommonElements, evaluate, getChildren, getCombiningAlg, getDefaultVersion, getDescription, getId, getObligations, getTarget, match, setChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Policy

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

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

Policy

public Policy(URI id,
              RuleCombiningAlgorithm combiningAlg,
              Target target,
              List rules)
Creates a new Policy with only the required elements plus some rules.

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

Policy

public Policy(URI id,
              RuleCombiningAlgorithm combiningAlg,
              Target target,
              String defaultVersion,
              List rules)
Creates a new Policy with the required elements plus some rules and policy defaults.

Parameters:
id - the policy identifier
combiningAlg - the CombiningAlgorithm used on the rules in this set
target - the Target for this policy
defaultVersion - the XPath version to use
rules - a list of Rule objects
Throws:
IllegalArgumentException - if the List of rules contains an object that is not a Rule

Policy

public Policy(URI id,
              RuleCombiningAlgorithm combiningAlg,
              String description,
              Target target,
              List rules)
Creates a new Policy with the required elements plus some rules and a String description.

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

Policy

public Policy(URI id,
              RuleCombiningAlgorithm combiningAlg,
              String description,
              Target target,
              String defaultVersion,
              List rules)
Creates a new Policy with the required elements plus some rules, a String description and policy defaults.

Parameters:
id - the policy identifier
combiningAlg - the CombiningAlgorithm used on the rules in this set
description - a String describing the policy
target - the Target for this policy
defaultVersion - the XPath version to use
rules - a list of Rule objects
Throws:
IllegalArgumentException - if the List of rules contains an object that is not a Rule

Policy

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

Parameters:
id - the policy identifier
combiningAlg - the CombiningAlgorithm used on the rules in this set
description - a String describing the policy
target - the Target for this policy
defaultVersion - the XPath version to use
rules - a list of Rule objects
obligations - a set of Obligations objects
Throws:
IllegalArgumentException - if the List of rules contains an object that is not a Rule
Method Detail

getInstance

public static Policy getInstance(Node root)
                          throws ParsingException
Creates an instance of a Policy object based on a DOM node. The node must be the root of PolicyType XML object, otherwise an exception is thrown.

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

encode

public void encode(OutputStream output)
Encodes this Policy 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 Policy 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

Sun's XACML Implementation Version 1.2

Copyright 2003-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

Sun, Sun Microsystems, the Sun Logo, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.