Interface AttributeValueFactoryRegistry
-
- All Superinterfaces:
PdpExtensionRegistry<AttributeValueFactory<?>>
- All Known Implementing Classes:
ImmutableAttributeValueFactoryRegistry
public interface AttributeValueFactoryRegistry extends PdpExtensionRegistry<AttributeValueFactory<?>>
Registry of AttributeValue Factories supporting multiple datatypes. Any implementation of this must guarantee that there is a one-to-one relationship between AttributeValue (sub)classes and datatype URIs (AttributeValueType DataType field).A valid key in this registry, i.e. valid argument for
PdpExtensionRegistry.getExtension(String)
, is an identifier of a datatype corresponding to the value factory, as returned byPdpExtension.getId()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ow2.authzforce.core.pdp.api.PdpExtensionRegistry
PdpExtensionRegistry.PdpExtensionComparator<E extends PdpExtension>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AttributeValueFactory<?>
getCompatibleFactory(Class<? extends Serializable> rawValueClass)
Get value factory that can handle a given class of Java valuesAttributeBag<?>
newAttributeBag(Collection<? extends Serializable> rawValues)
Same asnewAttributeBag(Collection, AttributeSource)
but withattributeValueSource
set toAttributeSources.REQUEST
AttributeBag<?>
newAttributeBag(Collection<? extends Serializable> rawValues, AttributeSource attributeValueSource)
Creates anAttributeBag
(bag ofAttributeValue
s) from collection of raw values using best compatibleAttributeValueFactory
available in this registry; compatible means that it supports the raw value types as input types.AttributeValue
newAttributeValue(Serializable rawValue)
Creates anAttributeValue
from raw value using best compatibleAttributeValueFactory
available in this registry; compatible means that it supportsrawValue.getClass()
as input typeConstantExpression<? extends AttributeValue>
newExpression(String datatypeId, List<Serializable> content, Map<QName,String> otherAttributes, Optional<XPathCompilerProxy> xPathCompiler)
Create internal model's AttributeValue expression-
Methods inherited from interface org.ow2.authzforce.core.pdp.api.PdpExtensionRegistry
getExtension, getExtensions
-
-
-
-
Method Detail
-
newExpression
ConstantExpression<? extends AttributeValue> newExpression(String datatypeId, List<Serializable> content, Map<QName,String> otherAttributes, Optional<XPathCompilerProxy> xPathCompiler) throws IllegalArgumentException
Create internal model's AttributeValue expression- Parameters:
datatypeId
- attribute datatype IDcontent
- raw value's mixed content, e.g. an element might be aString
for text, orElement
for XML element in the case of core XACML (XML) implemented with JAXB framework; or possiblyNumber
orBoolean
in the case of JSON Profile of XACML implemented with common JSON frameworks. This list is a singleton in most cases.otherAttributes
- (mandatory) other XML attributes of the value node, may be empty if none (but not null)xPathCompiler
- XPath compiler for evaluating/compiling any XPath expression invalue
. Undefined if XPath support disabled.- Returns:
- expression, e.g.
ConstantExpression
for constant AttributeValues, or something like XPathExpression for context-dependent xpathExpression-type of AttributeValues (quite similar to AttributeSelector) - Throws:
IllegalArgumentException
- value datatype unknown/not supported, or if value cannot be parsed into the value's defined datatype
-
getCompatibleFactory
AttributeValueFactory<?> getCompatibleFactory(Class<? extends Serializable> rawValueClass)
Get value factory that can handle a given class of Java values- Parameters:
rawValueClass
- class of the raw value- Returns:
- compatible attribute value factory; null if none
-
newAttributeValue
AttributeValue newAttributeValue(Serializable rawValue) throws IllegalArgumentException, UnsupportedOperationException
Creates anAttributeValue
from raw value using best compatibleAttributeValueFactory
available in this registry; compatible means that it supportsrawValue.getClass()
as input type- Parameters:
rawValue
- raw value to be converted toAttributeValue
- Returns:
- corresponding
AttributeValue
in internal model for (XACML) policy evaluation - Throws:
IllegalArgumentException
- ifrawValue
is of the right type but actual value content is not valid for the selected (the best compatible available)AttributeValueFactory
. For example, some factories for numeric (e.g. integer, double) input may not support all kinds of integer (from -Infinity to +Infinity) but only in a limited range.UnsupportedOperationException
- ifrawValue.getClass()
is not an input type supported by anyAttributeValueFactory
in this registry
-
newAttributeBag
AttributeBag<?> newAttributeBag(Collection<? extends Serializable> rawValues, AttributeSource attributeValueSource) throws UnsupportedOperationException, IllegalArgumentException
Creates anAttributeBag
(bag ofAttributeValue
s) from collection of raw values using best compatibleAttributeValueFactory
available in this registry; compatible means that it supports the raw value types as input types. Beware that a bag has a single (XACML) datatype, so all value types must correspond to a single (XACML) datatype. Therefore, to prevent unexpected behavior,rawVals
should all have the same concrete type. In other words, mixing different concrete Java types may causeIllegalArgumentException
. For example, do not mix Integer (likely to be mapped to XACML integer) and Double (likely to be mapped to XACML double).- Parameters:
rawValues
- raw values to be converted toAttributeBag
attributeValueSource
- attribute value source- Returns:
- corresponding
AttributeBag
in internal model for (XACML) policy evaluation - Throws:
IllegalArgumentException
- if one of therawValues
is of the right type but actual value content is not valid for the selected (the best compatible available)AttributeValueFactory
(for example, some factories for numeric input, e.g. integer or double, may not support all kinds of integer (from -Infinity to +Infinity) but only in a limited range); orrawValues
do not have a common type that can be mapped to a common (XACML) AttributeValue datatype, i.e. the input type mixing is not allowed by the factory.UnsupportedOperationException
- if one of therawValues
does not have a type supported by anyAttributeValueFactory
as input type in this registry
-
newAttributeBag
AttributeBag<?> newAttributeBag(Collection<? extends Serializable> rawValues) throws UnsupportedOperationException, IllegalArgumentException
Same asnewAttributeBag(Collection, AttributeSource)
but withattributeValueSource
set toAttributeSources.REQUEST
- Parameters:
rawValues
- raw values to be converted toAttributeBag
- Returns:
- corresponding
AttributeBag
in internal model for (XACML) policy evaluation - Throws:
IllegalArgumentException
- if one of therawValues
is of the right type but actual value content is not valid for the selected (the best compatible available)AttributeValueFactory
(for example, some factories for numeric input, e.g. integer or double, may not support all kinds of integer (from -Infinity to +Infinity) but only in a limited range); orrawValues
do not have a common type that can be mapped to a common (XACML) AttributeValue datatype, i.e. the input type mixing is not allowed by the factory.UnsupportedOperationException
- if one of therawValues
does not have a type supported by anyAttributeValueFactory
as input type in this registry
-
-