public class AttributeSelector extends AbstractAttributeSelector
AttributeFinderModule
s so that it's easy to plugin different XPath implementations.mustBePresent, type, xpathVersion
Constructor and Description |
---|
AttributeSelector(URI category,
URI type,
URI contextSelectorId,
String path,
boolean mustBePresent,
String xpathVersion)
Creates a new
AttributeSelector . |
Modifier and Type | Method and Description |
---|---|
void |
encode(StringBuilder builder)
Encodes this
AttributeValue into its XML representation and writes this encoding
to the given StringBuilder This will always produce the version
used in a policy rather than that used in a request, so this is equivalent to calling
encodeWithTags(true) and then stuffing that into a stream. |
EvaluationResult |
evaluate(EvaluationCtx context)
Invokes the
AttributeFinder used by the given EvaluationCtx to try
to resolve an attribute value. |
boolean |
evaluatesToBag()
Tells whether evaluation will return a bag or a single value.
|
List |
getChildren()
Returns all children, in order, of this element in the Condition tree, or en empty set if
this element has no children.
|
static AttributeSelector |
getInstance(Node root,
PolicyMetaData metaData)
Creates a new
AttributeSelector based on the DOM root of the XML type. |
boolean |
returnsBag()
Returns whether or not this expression returns, or evaluates to a Bag.
|
getType, getXPathVersion, isMustBePresent
public AttributeSelector(URI category, URI type, URI contextSelectorId, String path, boolean mustBePresent, String xpathVersion)
AttributeSelector
.category
- category of the attribute selecttype
- the data type of the attribute values this selector looks forcontextSelectorId
- XPath search for context nodepath
- the XPath to query attributemustBePresent
- must resolution find a matchxpathVersion
- the XPath version to use, which must be a valid XPath version string (the
identifier for XPath 1.0 is provided in PolicyMetaData
)public static AttributeSelector getInstance(Node root, PolicyMetaData metaData) throws ParsingException
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.root
- the root of the DOM tree for the XML AttributeSelectorType XML typemetaData
- the meta-data associated with the containing policyAttributeSelector
ParsingException
- if the AttributeSelectorType was invalidpublic EvaluationResult evaluate(EvaluationCtx context)
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.context
- representation of the request to searchpublic boolean evaluatesToBag()
Evaluatable
public List getChildren()
Evaluatable
List
of Evaluatable
spublic boolean returnsBag()
Expression
Evaluatable
, which extends this interface, defines evaluatesToBag
which is essentially the same function. This method has been deprecated, and
returnsBag
is now the preferred way to query all Expression
s.public void encode(StringBuilder builder)
Expression
AttributeValue
into its XML representation and writes this encoding
to the given StringBuilder
This will always produce the version
used in a policy rather than that used in a request, so this is equivalent to calling
encodeWithTags(true)
and then stuffing that into a stream.builder
- string stream into which the XML-encoded data is writtenCopyright © 2016 WSO2. All rights reserved.