SunTM's XACML Implementation for JavaTM

com.sun.xacml
Class AbstractPolicy

java.lang.Object
  extended bycom.sun.xacml.AbstractPolicy
All Implemented Interfaces:
PolicyTreeElement
Direct Known Subclasses:
Policy, PolicyReference, PolicySet

public abstract class AbstractPolicy
extends Object
implements PolicyTreeElement

Represents an instance of an XACML policy.

Since:
1.0

Field Summary
static String XPATH_1_0_VERSION
          XPath 1.0 identifier, the only version we support right now
 
Constructor Summary
protected AbstractPolicy()
          Constructor used by PolicyReference, which supplies its own values for the methods in this class.
protected AbstractPolicy(Node root, String policyPrefix, String combiningName)
          Constructor used by child classes to initialize the shared data from a DOM root node.
protected AbstractPolicy(URI id, CombiningAlgorithm combiningAlg, String description, Target target)
          Constructor used to create a policy from concrete components.
protected AbstractPolicy(URI id, CombiningAlgorithm combiningAlg, String description, Target target, String defaultVersion)
          Constructor used to create a policy from concrete components.
protected AbstractPolicy(URI id, CombiningAlgorithm combiningAlg, String description, Target target, String defaultVersion, Set obligations)
          Constructor used to create a policy from concrete components.
 
Method Summary
protected  void encodeCommonElements(OutputStream output, Indenter indenter)
          Routine used by Policy and PolicySet to encode some common elements.
 Result evaluate(EvaluationCtx context)
          Tries to evaluate the policy by calling the combining algorithm on the given policies or rules.
 List getChildren()
          Returns the List of children under this node in the policy tree.
 CombiningAlgorithm getCombiningAlg()
          Returns the combining algorithm used by this policy
 String getDefaultVersion()
          Returns the XPath version to use or null if none was specified
 String getDescription()
          Returns the given description of this policy or null if there is no description
 URI getId()
          Returns the id of this policy
 Set getObligations()
          Returns the Set of obligations for this policy, which may be empty
 Target getTarget()
          Returns the target for this policy
 MatchResult match(EvaluationCtx context)
          Given the input context sees whether or not the request matches this policy.
protected  void setChildren(List children)
          Sets the child policy tree elements for this node, which are passed to the combining algorithm on evaluation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xacml.PolicyTreeElement
encode, encode
 

Field Detail

XPATH_1_0_VERSION

public static final String XPATH_1_0_VERSION
XPath 1.0 identifier, the only version we support right now

See Also:
Constant Field Values
Constructor Detail

AbstractPolicy

protected AbstractPolicy()
Constructor used by PolicyReference, which supplies its own values for the methods in this class.


AbstractPolicy

protected AbstractPolicy(URI id,
                         CombiningAlgorithm combiningAlg,
                         String description,
                         Target target)
Constructor used to create a policy from concrete components.

Parameters:
id - the policy id
combiningAlg - the combining algorithm to use
description - describes the policy or null if there is none
target - the policy's target

AbstractPolicy

protected AbstractPolicy(URI id,
                         CombiningAlgorithm combiningAlg,
                         String description,
                         Target target,
                         String defaultVersion)
Constructor used to create a policy from concrete components.

Parameters:
id - the policy id
combiningAlg - the combining algorithm to use
description - describes the policy or null if there is none
target - the policy's target
defaultVersion - the XPath version to use for selectors

AbstractPolicy

protected AbstractPolicy(URI id,
                         CombiningAlgorithm combiningAlg,
                         String description,
                         Target target,
                         String defaultVersion,
                         Set obligations)
Constructor used to create a policy from concrete components.

Parameters:
id - the policy id
combiningAlg - the combining algorithm to use
description - describes the policy or null if there is none
target - the policy's target
defaultVersion - the XPath version to use for selectors
obligations - the policy's obligations

AbstractPolicy

protected AbstractPolicy(Node root,
                         String policyPrefix,
                         String combiningName)
                  throws ParsingException
Constructor used by child classes to initialize the shared data from a DOM root node.

Parameters:
root - the DOM root of the policy
policyPrefix - either "Policy" or "PolicySet"
combiningName - name of the field naming the combining alg
Throws:
ParsingException - if the policy is invalid
Method Detail

getId

public URI getId()
Returns the id of this policy

Specified by:
getId in interface PolicyTreeElement
Returns:
the policy id

getCombiningAlg

public CombiningAlgorithm getCombiningAlg()
Returns the combining algorithm used by this policy

Returns:
the combining algorithm

getDescription

public String getDescription()
Returns the given description of this policy or null if there is no description

Specified by:
getDescription in interface PolicyTreeElement
Returns:
the description or null

getTarget

public Target getTarget()
Returns the target for this policy

Specified by:
getTarget in interface PolicyTreeElement
Returns:
the policy's target

getDefaultVersion

public String getDefaultVersion()
Returns the XPath version to use or null if none was specified

Returns:
XPath version or null

getChildren

public List getChildren()
Returns the List of children under this node in the policy tree. Depending on what kind of policy this node represents the children will either be AbstractPolicy objects or Rules.

Specified by:
getChildren in interface PolicyTreeElement
Returns:
a List of child nodes

getObligations

public Set getObligations()
Returns the Set of obligations for this policy, which may be empty

Returns:
the policy's obligations

match

public MatchResult match(EvaluationCtx context)
Given the input context sees whether or not the request matches this policy. This must be called by combining algorithms before they evaluate a policy. This is also used in the initial policy finding operation to determine which top-level policies might apply to the request.

Specified by:
match in interface PolicyTreeElement
Parameters:
context - the representation of the request
Returns:
the result of trying to match the policy and the request

setChildren

protected void setChildren(List children)
Sets the child policy tree elements for this node, which are passed to the combining algorithm on evaluation. The List must contain Rules or AbstractPolicys, but may not contain both types of elements.

Parameters:
children - the child elements used by the combining algorithm

evaluate

public Result evaluate(EvaluationCtx context)
Tries to evaluate the policy by calling the combining algorithm on the given policies or rules. The match method must always be called first, and must always return MATCH, before this method is called.

Specified by:
evaluate in interface PolicyTreeElement
Parameters:
context - the representation of the request
Returns:
the result of evaluation

encodeCommonElements

protected void encodeCommonElements(OutputStream output,
                                    Indenter indenter)
Routine used by Policy and PolicySet to encode some common elements.

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.