public class AttributeSelector extends Object implements Evaluatable
AttributeFinderModule
s so that it's easy
to plugin different XPath implementations.Constructor and Description |
---|
AttributeSelector(URI type,
String contextPath,
boolean mustBePresent,
String xpathVersion)
Creates a new
AttributeSelector with no policy root. |
AttributeSelector(URI type,
String contextPath,
Node policyRoot,
boolean mustBePresent,
String xpathVersion)
Creates a new
AttributeSelector . |
Modifier and Type | Method and Description |
---|---|
void |
encode(OutputStream output)
Encodes this selector into its XML representation and
writes this encoding to the given
OutputStream with no
indentation. |
void |
encode(OutputStream output,
Indenter indenter)
Encodes this selector into its XML representation and
writes this encoding to the given
OutputStream with
indentation. |
EvaluationResult |
evaluate(EvaluationCtx context)
Invokes the
AttributeFinder used by the given
EvaluationCtx to try to resolve an attribute value. |
boolean |
evaluatesToBag()
Deprecated.
As of 2.0, you should use the
returnsBag
method from the super-interface Expression . |
List |
getChildren()
Always returns an empty list since selectors never have children.
|
String |
getContextPath()
Returns the XPath query used to resolve attribute values.
|
static AttributeSelector |
getInstance(Node root,
PolicyMetaData metaData)
Creates a new
AttributeSelector based on the DOM root
of the XML type. |
static AttributeSelector |
getInstance(Node root,
String xpathVersion)
Deprecated.
As of 2.0 you should avoid using this method and should
instead use the version that takes a
PolicyMetaData instance. This method will
only work for XACML 1.x policies. |
URI |
getType()
Returns the data type of the attribute values that this selector
will resolve
|
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.
|
boolean |
returnsBag()
Always returns true, since a selector always returns a bag of
attribute values.
|
public AttributeSelector(URI type, String contextPath, boolean mustBePresent, String xpathVersion)
AttributeSelector
with no policy root.type
- the data type of the attribute values this selector
looks forcontextPath
- the XPath to querymustBePresent
- 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 AttributeSelector(URI type, String contextPath, Node policyRoot, boolean mustBePresent, String xpathVersion)
AttributeSelector
.type
- the data type of the attribute values this selector
looks forcontextPath
- the XPath to querypolicyRoot
- the root DOM Element for the policy containing this
selector, which defines namespace mappingsmustBePresent
- 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, String xpathVersion) throws ParsingException
PolicyMetaData
instance. This method will
only work for XACML 1.x policies.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 typexpathVersion
- the XPath version to use, or null if this is
unspecified (ie, not supplied in the defaults
section of the policy)AttributeSelector
ParsingException
- if the AttributeSelectorType was invalidpublic 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 URI getType()
getType
in interface Expression
public String getContextPath()
public boolean mustBePresent()
public boolean returnsBag()
returnsBag
in interface Expression
public boolean evaluatesToBag()
returnsBag
method from the super-interface Expression
.evaluatesToBag
in interface Evaluatable
public List getChildren()
getChildren
in interface Evaluatable
List
public String getXPathVersion()
public 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.evaluate
in interface Evaluatable
context
- representation of the request to searchpublic void encode(OutputStream output)
OutputStream
with no
indentation.encode
in interface Expression
output
- a stream into which the XML-encoded data is writtenpublic void encode(OutputStream output, Indenter indenter)
OutputStream
with
indentation.encode
in interface Expression
output
- a stream into which the XML-encoded data is writtenindenter
- an object that creates indentation stringsCopyright © 2023 JBoss by Red Hat. All rights reserved.