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

Quick Search    Search Deep

com.sun.xacml.attr
Class AttributeSelector  view AttributeSelector download AttributeSelector.java

java.lang.Object
  extended bycom.sun.xacml.attr.AttributeSelector
All Implemented Interfaces:
com.sun.xacml.cond.Evaluatable

public class AttributeSelector
extends java.lang.Object
implements com.sun.xacml.cond.Evaluatable

Supports the standard selector functionality in XACML, which uses XPath expressions to resolve values from the Request or elsewhere. All selector queries are done by AttributeFinderModules so that it's easy to plugin different XPath implementations.

Since:
1.0

Field Summary
private  java.lang.String contextPath
           
private static java.util.logging.Logger logger
           
private  boolean mustBePresent
           
private  org.w3c.dom.Node policyRoot
           
private  java.net.URI type
           
private  java.lang.String xpathVersion
           
 
Constructor Summary
AttributeSelector(java.net.URI type, java.lang.String contextPath, boolean mustBePresent, java.lang.String xpathVersion)
          Creates a new AttributeSelector with no policy root.
AttributeSelector(java.net.URI type, java.lang.String contextPath, org.w3c.dom.Node policyRoot, boolean mustBePresent, java.lang.String xpathVersion)
          Creates a new AttributeSelector.
 
Method Summary
 void encode(java.io.OutputStream output)
          Encodes this selector into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(java.io.OutputStream output, com.sun.xacml.Indenter indenter)
          Encodes this selector into its XML representation and writes this encoding to the given OutputStream with indentation.
 com.sun.xacml.cond.EvaluationResult evaluate(com.sun.xacml.EvaluationCtx context)
          Invokes the AttributeFinder used by the given EvaluationCtx to try to resolve an attribute value.
 boolean evaluatesToBag()
          Always returns true, since a selector always returns a bag of attribute values.
 java.util.List getChildren()
          Always returns an empty list since selectors never have children.
 java.lang.String getContextPath()
          Returns the XPath query used to resolve attribute values.
static AttributeSelector getInstance(org.w3c.dom.Node root, java.lang.String xpathVersion)
          Creates a new AttributeSelector based on the DOM root of the XML type.
 java.net.URI getType()
          Returns the data type of the attribute values that this selector will resolve
 java.lang.String getXPathVersion()
          Returns the XPath version this selector is supposed to use.
 boolean mustBePresent()
          Returns whether or not a value is required to be resolved by this selector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

private java.net.URI type

contextPath

private java.lang.String contextPath

mustBePresent

private boolean mustBePresent

xpathVersion

private java.lang.String xpathVersion

policyRoot

private org.w3c.dom.Node policyRoot

logger

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

AttributeSelector

public AttributeSelector(java.net.URI type,
                         java.lang.String contextPath,
                         boolean mustBePresent,
                         java.lang.String xpathVersion)
Creates a new AttributeSelector with no policy root.


AttributeSelector

public AttributeSelector(java.net.URI type,
                         java.lang.String contextPath,
                         org.w3c.dom.Node policyRoot,
                         boolean mustBePresent,
                         java.lang.String xpathVersion)
Creates a new AttributeSelector.

Method Detail

getInstance

public static AttributeSelector getInstance(org.w3c.dom.Node root,
                                            java.lang.String xpathVersion)
                                     throws com.sun.xacml.ParsingException
Creates a new AttributeSelector based on the DOM root of the XML type. Note that as of XACML 1.1 the XPathVersion element is required in any policy that uses a selector, so if the xpathVersion string is null, then this will throw an exception.


getType

public java.net.URI getType()
Returns the data type of the attribute values that this selector will resolve

Specified by:
getType in interface com.sun.xacml.cond.Evaluatable

getContextPath

public java.lang.String getContextPath()
Returns the XPath query used to resolve attribute values.


mustBePresent

public boolean mustBePresent()
Returns whether or not a value is required to be resolved by this selector.


evaluatesToBag

public boolean evaluatesToBag()
Always returns true, since a selector always returns a bag of attribute values.

Specified by:
evaluatesToBag in interface com.sun.xacml.cond.Evaluatable

getChildren

public java.util.List getChildren()
Always returns an empty list since selectors never have children.

Specified by:
getChildren in interface com.sun.xacml.cond.Evaluatable

getXPathVersion

public java.lang.String getXPathVersion()
Returns the XPath version this selector is supposed to use. This is typically provided by the defaults section of the policy containing this selector.


evaluate

public com.sun.xacml.cond.EvaluationResult evaluate(com.sun.xacml.EvaluationCtx context)
Invokes the AttributeFinder used by the given EvaluationCtx to try to resolve an attribute value. If the selector is defined with MustBePresent as true, then failure to find a matching value will result in Indeterminate, otherwise it will result in an empty bag. To support the basic selector functionality defined in the XACML specification, use a finder that has only the SelectorModule as a module that supports selector finding.

Specified by:
evaluate in interface com.sun.xacml.cond.Evaluatable

encode

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

Specified by:
encode in interface com.sun.xacml.cond.Evaluatable

encode

public void encode(java.io.OutputStream output,
                   com.sun.xacml.Indenter indenter)
Encodes this selector into its XML representation and writes this encoding to the given OutputStream with indentation.

Specified by:
encode in interface com.sun.xacml.cond.Evaluatable