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

Quick Search    Search Deep

com.sun.xacml
Class AbstractPolicy  view AbstractPolicy download AbstractPolicy.java

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

public abstract class AbstractPolicy
extends java.lang.Object
implements PolicyTreeElement

Represents an instance of an XACML policy.

Since:
1.0

Field Summary
private  java.util.List children
           
private  com.sun.xacml.combine.CombiningAlgorithm combiningAlg
           
private  java.lang.String defaultVersion
           
private  java.lang.String description
           
private  java.net.URI idAttr
           
private static java.util.logging.Logger logger
           
private  java.util.Set obligations
           
private  Target target
           
static java.lang.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(org.w3c.dom.Node root, java.lang.String policyPrefix, java.lang.String combiningName)
          Constructor used by child classes to initialize the shared data from a DOM root node.
protected AbstractPolicy(java.net.URI id, com.sun.xacml.combine.CombiningAlgorithm combiningAlg, java.lang.String description, Target target)
          Constructor used to create a policy from concrete components.
protected AbstractPolicy(java.net.URI id, com.sun.xacml.combine.CombiningAlgorithm combiningAlg, java.lang.String description, Target target, java.lang.String defaultVersion)
          Constructor used to create a policy from concrete components.
protected AbstractPolicy(java.net.URI id, com.sun.xacml.combine.CombiningAlgorithm combiningAlg, java.lang.String description, Target target, java.lang.String defaultVersion, java.util.Set obligations)
          Constructor used to create a policy from concrete components.
 
Method Summary
protected  void encodeCommonElements(java.io.OutputStream output, Indenter indenter)
          Routine used by Policy and PolicySet to encode some common elements.
 com.sun.xacml.ctx.Result evaluate(EvaluationCtx context)
          Tries to evaluate the policy by calling the combining algorithm on the given policies or rules.
 java.util.List getChildren()
          Returns the List of children under this node in the policy tree.
 com.sun.xacml.combine.CombiningAlgorithm getCombiningAlg()
          Returns the combining algorithm used by this policy
 java.lang.String getDefaultVersion()
          Returns the XPath version to use or null if none was specified
 java.lang.String getDescription()
          Returns the given description of this policy or null if there is no description
 java.net.URI getId()
          Returns the id of this policy
 java.util.Set getObligations()
          Returns the Set of obligations for this policy, which may be empty
 Target getTarget()
          Returns the target for this policy
private  void handleDefaults(org.w3c.dom.Node root)
          There used to be multiple things in the defaults type, but now there's just the one string that must be a certain value, so it doesn't seem all that useful to have a class for this...we could always bring it back, however, if it started to do more
 MatchResult match(EvaluationCtx context)
          Given the input context sees whether or not the request matches this policy.
private  void parseObligations(org.w3c.dom.Node root)
          Helper routine to parse the obligation data
protected  void setChildren(java.util.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 java.lang.String XPATH_1_0_VERSION
XPath 1.0 identifier, the only version we support right now

See Also:
Constant Field Values

idAttr

private java.net.URI idAttr

combiningAlg

private com.sun.xacml.combine.CombiningAlgorithm combiningAlg

description

private java.lang.String description

target

private Target target

defaultVersion

private java.lang.String defaultVersion

children

private java.util.List children

obligations

private java.util.Set obligations

logger

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

AbstractPolicy

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


AbstractPolicy

protected AbstractPolicy(java.net.URI id,
                         com.sun.xacml.combine.CombiningAlgorithm combiningAlg,
                         java.lang.String description,
                         Target target)
Constructor used to create a policy from concrete components.


AbstractPolicy

protected AbstractPolicy(java.net.URI id,
                         com.sun.xacml.combine.CombiningAlgorithm combiningAlg,
                         java.lang.String description,
                         Target target,
                         java.lang.String defaultVersion)
Constructor used to create a policy from concrete components.


AbstractPolicy

protected AbstractPolicy(java.net.URI id,
                         com.sun.xacml.combine.CombiningAlgorithm combiningAlg,
                         java.lang.String description,
                         Target target,
                         java.lang.String defaultVersion,
                         java.util.Set obligations)
Constructor used to create a policy from concrete components.


AbstractPolicy

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

Method Detail

parseObligations

private void parseObligations(org.w3c.dom.Node root)
                       throws ParsingException
Helper routine to parse the obligation data


handleDefaults

private void handleDefaults(org.w3c.dom.Node root)
                     throws ParsingException
There used to be multiple things in the defaults type, but now there's just the one string that must be a certain value, so it doesn't seem all that useful to have a class for this...we could always bring it back, however, if it started to do more


getId

public java.net.URI getId()
Returns the id of this policy

Specified by:
getId in interface PolicyTreeElement

getCombiningAlg

public com.sun.xacml.combine.CombiningAlgorithm getCombiningAlg()
Returns the combining algorithm used by this policy


getDescription

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

Specified by:
getDescription in interface PolicyTreeElement

getTarget

public Target getTarget()
Returns the target for this policy

Specified by:
getTarget in interface PolicyTreeElement

getDefaultVersion

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


getChildren

public java.util.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

getObligations

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


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

setChildren

protected void setChildren(java.util.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.


evaluate

public com.sun.xacml.ctx.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

encodeCommonElements

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