Class GenericAttributeProviderBasedAttributeDesignatorExpression<AV extends AttributeValue>

  • Type Parameters:
    AV - AttributeDesignator evaluation result value's primitive datatype
    All Implemented Interfaces:
    AttributeDesignatorExpression<AV>, Expression<Bag<AV>>

    public final class GenericAttributeProviderBasedAttributeDesignatorExpression<AV extends AttributeValue>
    extends Object
    implements AttributeDesignatorExpression<AV>
    AttributeDesignator evaluator initialized with and using an AttributeProvider to retrieve the attribute value not only from the request but also possibly from extra Attribute Provider modules (so-called XACML PIPs) (PDP extensions)
    Version:
    $Id: $
    • Constructor Detail

      • GenericAttributeProviderBasedAttributeDesignatorExpression

        public GenericAttributeProviderBasedAttributeDesignatorExpression​(oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType attrDesignator,
                                                                          BagDatatype<AV> resultDatatype,
                                                                          AttributeProvider attrProvider)
        Return an instance of an AttributeDesignator based on an AttributeDesignatorType
        Parameters:
        attrDesignator - the AttributeDesignatorType we want to convert
        resultDatatype - expected datatype of the result of evaluating this AttributeDesignator ( AV is the expected type of every element in the bag)
        attrProvider - Attribute Provider responsible for finding the attribute designated by this in a given evaluation context at runtime
        Throws:
        IllegalArgumentException - if attrDesignator.getCategory() == null || attrDesignator.getAttributeId() == null
    • Method Detail

      • getValue

        public Optional<Bag<AV>> getValue()
        Get the constant value of this expression if it has a constant value, i.e. independent from the evaluation context (e.g. AttributeValue, VariableReference to AttributeValue...). This is equivalent to call Expression.evaluate(EvaluationContext) with context == null. This enables expression consumers to do optimizations, e.g. functions may pre-compile/pre-evaluate parts of their inputs knowing some are constant values.
        Specified by:
        getValue in interface Expression<AV extends AttributeValue>
        Returns:
        the constant value iff the expression has a static/fixed/constant value, else no present value. NB: Null is not considered/possible as a constant value for expressions.
      • isNonEmptyBagRequired

        public boolean isNonEmptyBagRequired()
        Description copied from interface: AttributeDesignatorExpression
        Indicates whether the attribute's presence is required, i.e. it must have at least one value in this context (non-empty bag). Equivalent of XACML MustBePresent flag.
        Specified by:
        isNonEmptyBagRequired in interface AttributeDesignatorExpression<AV extends AttributeValue>
        Returns:
        true iff the resulting bag must be non-empty, i.e. there must be at least one value for this attribute in the context
      • evaluate

        public Bag<AV> evaluate​(EvaluationContext context)
                         throws IndeterminateEvaluationException
        Evaluates the expression using the given context. Evaluates the pre-assigned meta-data against the given context, trying to find some matching values.
        Specified by:
        evaluate in interface Expression<AV extends AttributeValue>
        Parameters:
        context - the representation of the request
        Returns:
        the result of evaluation that may be a single value T (e.g. function result, AttributeValue, Condition, Match...) or bag of values (e.g. AttributeDesignator, AttributeSelector)
        Throws:
        IndeterminateEvaluationException - if evaluation is "Indeterminate" (see XACML core specification)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object obj)
        Equal iff the Attribute Category/Issuer/Id are equal
        Overrides:
        equals in class Object