Class ImmutableAttributeValueFactoryRegistry
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.BasePdpExtensionRegistry<AttributeValueFactory<?>>
-
- org.ow2.authzforce.core.pdp.api.value.ImmutableAttributeValueFactoryRegistry
-
- All Implemented Interfaces:
PdpExtensionRegistry<AttributeValueFactory<?>>
,AttributeValueFactoryRegistry
public final class ImmutableAttributeValueFactoryRegistry extends BasePdpExtensionRegistry<AttributeValueFactory<?>> implements AttributeValueFactoryRegistry
ImmutableAttributeValueFactoryRegistry
.- Version:
- $Id: $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ow2.authzforce.core.pdp.api.PdpExtensionRegistry
PdpExtensionRegistry.PdpExtensionComparator<E extends PdpExtension>
-
-
Constructor Summary
Constructors Constructor Description ImmutableAttributeValueFactoryRegistry(Collection<? extends AttributeValueFactory<?>> attributeValueFactories)
Constructor for BaseDatatypeFactoryRegistry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringParseableValue.Factory<?>
getCompatibleFactory(Class<? extends Serializable> rawValueClass)
Get value factory that can handle a given class of Java valuesAttributeBag<?>
newAttributeBag(Collection<? extends Serializable> rawVals)
Same asAttributeValueFactoryRegistry.newAttributeBag(Collection, AttributeSource)
but withattributeValueSource
set toAttributeSources.REQUEST
AttributeBag<?>
newAttributeBag(Collection<? extends Serializable> rawVals, 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 class org.ow2.authzforce.core.pdp.api.BasePdpExtensionRegistry
getExtension, getExtensions, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ow2.authzforce.core.pdp.api.PdpExtensionRegistry
getExtension, getExtensions
-
-
-
-
Constructor Detail
-
ImmutableAttributeValueFactoryRegistry
public ImmutableAttributeValueFactoryRegistry(Collection<? extends AttributeValueFactory<?>> attributeValueFactories)
Constructor for BaseDatatypeFactoryRegistry.
- Parameters:
attributeValueFactories
- attribute value factories
-
-
Method Detail
-
newExpression
public ConstantExpression<? extends AttributeValue> newExpression(String datatypeId, List<Serializable> content, Map<QName,String> otherAttributes, Optional<XPathCompilerProxy> xPathCompiler) throws IllegalArgumentException
Create internal model's AttributeValue expression- Specified by:
newExpression
in interfaceAttributeValueFactoryRegistry
- 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
public StringParseableValue.Factory<?> getCompatibleFactory(Class<? extends Serializable> rawValueClass)
Description copied from interface:AttributeValueFactoryRegistry
Get value factory that can handle a given class of Java values- Specified by:
getCompatibleFactory
in interfaceAttributeValueFactoryRegistry
- Parameters:
rawValueClass
- class of the raw value- Returns:
- compatible attribute value factory; null if none
-
newAttributeValue
public AttributeValue newAttributeValue(Serializable rawValue) throws IllegalArgumentException, UnsupportedOperationException
Description copied from interface:AttributeValueFactoryRegistry
Creates anAttributeValue
from raw value using best compatibleAttributeValueFactory
available in this registry; compatible means that it supportsrawValue.getClass()
as input type- Specified by:
newAttributeValue
in interfaceAttributeValueFactoryRegistry
- 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
public AttributeBag<?> newAttributeBag(Collection<? extends Serializable> rawVals, AttributeSource attributeValueSource) throws UnsupportedOperationException, IllegalArgumentException
Description copied from interface:AttributeValueFactoryRegistry
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).- Specified by:
newAttributeBag
in interfaceAttributeValueFactoryRegistry
- Parameters:
rawVals
- raw values to be converted toAttributeBag
attributeValueSource
- attribute value source- Returns:
- corresponding
AttributeBag
in internal model for (XACML) policy evaluation - Throws:
UnsupportedOperationException
- if one of therawValues
does not have a type supported by anyAttributeValueFactory
as input type in this registryIllegalArgumentException
- 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.
-
newAttributeBag
public AttributeBag<?> newAttributeBag(Collection<? extends Serializable> rawVals) throws UnsupportedOperationException, IllegalArgumentException
Description copied from interface:AttributeValueFactoryRegistry
Same asAttributeValueFactoryRegistry.newAttributeBag(Collection, AttributeSource)
but withattributeValueSource
set toAttributeSources.REQUEST
- Specified by:
newAttributeBag
in interfaceAttributeValueFactoryRegistry
- Parameters:
rawVals
- raw values to be converted toAttributeBag
- Returns:
- corresponding
AttributeBag
in internal model for (XACML) policy evaluation - Throws:
UnsupportedOperationException
- if one of therawValues
does not have a type supported by anyAttributeValueFactory
as input type in this registryIllegalArgumentException
- 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.
-
-