org.jboss.security.xacml.sunxacml.cond
Interface Function

All Superinterfaces:
Expression
All Known Implementing Classes:
AbsFunction, AddFunction, BagFunction, ComparisonFunction, ConditionBagFunction, ConditionSetFunction, DateMathFunction, DivideFunction, EqualFunction, FloorFunction, FunctionBase, GeneralBagFunction, GeneralSetFunction, HigherOrderFunction, LogicalFunction, MatchFunction, ModFunction, MultiplyFunction, NOfFunction, NotFunction, NumericConvertFunction, RoundFunction, SetFunction, StringFunction, StringNormalizeFunction, SubtractFunction, TimeInRangeFunction, URLStringCatFunction

public interface Function
extends Expression

Interface that all functions in the system must implement.

Since:
1.0
Author:
Seth Proctor

Method Summary
 void checkInputs(List inputs)
          Checks that the given inputs are of the right types, in the right order, and are the right number for this function to evaluate.
 void checkInputsNoBag(List inputs)
          Checks that the given inputs are of the right types, in the right order, and are the right number for this function to evaluate.
 void encode(OutputStream output)
          Encodes this Function into its XML representation and writes this encoding to the given OutputStream with no indentation.
 void encode(OutputStream output, Indenter indenter)
          Encodes this Function into its XML representation and writes this encoding to the given OutputStream with indentation.
 EvaluationResult evaluate(List inputs, EvaluationCtx context)
          Evaluates the Function using the given inputs.
 URI getIdentifier()
          Returns the identifier of this function as known by the factories.
 URI getReturnType()
          Provides the type of AttributeValue that this function returns from evaluate in a successful evaluation.
 boolean returnsBag()
          Tells whether this function will return a bag of values or just a single value.
 
Methods inherited from interface org.jboss.security.xacml.sunxacml.cond.Expression
getType
 

Method Detail

evaluate

EvaluationResult evaluate(List inputs,
                          EvaluationCtx context)
Evaluates the Function using the given inputs. The List contains Evaluatables which are all of the correct type if the Function has been created as part of an Apply or TargetMatch, but which may otherwise be invalid. Each parameter should be evaluated by the Function, unless the Function doesn't need to evaluate all inputs to determine a result (as in the case of the or function). The order of the List is significant, so a Function should have a very good reason if it wants to evaluate the inputs in a different order.

Note that if this is a higher-order function, like any-of, then some argument (typically the first) in the List will actually be a Function object representing the function to apply to some bag. A function needs to know if it's a higher-order function, and therefore whether or not to look for this case. Also, a higher-order function is responsible for checking that the inputs that it will pass to the Function provided as the first parameter are valid, ie. it must do a checkInputs on its sub-function when checkInputs is called on the higher-order function.

Parameters:
inputs - the List of inputs for the function
context - the representation of the request
Returns:
a result containing the AttributeValue computed when evaluating the function, or Status specifying some error condition

getIdentifier

URI getIdentifier()
Returns the identifier of this function as known by the factories. In the case of the standard XACML functions, this will be one of the URIs defined in the standard namespace. This function must always return the complete namespace and identifier of this function.

Returns:
the function's identifier

getReturnType

URI getReturnType()
Provides the type of AttributeValue that this function returns from evaluate in a successful evaluation.

Returns:
the type returned by this function

returnsBag

boolean returnsBag()
Tells whether this function will return a bag of values or just a single value.

Specified by:
returnsBag in interface Expression
Returns:
true if evaluation will return a bag, false otherwise

checkInputs

void checkInputs(List inputs)
                 throws IllegalArgumentException
Checks that the given inputs are of the right types, in the right order, and are the right number for this function to evaluate. If the function cannot accept the inputs for evaluation, an IllegalArgumentException is thrown.

Parameters:
inputs - a List of Evaluatables, with the first argument being a Function if this is a higher-order function
Throws:
IllegalArgumentException - if the inputs do match what the function accepts for evaluation

checkInputsNoBag

void checkInputsNoBag(List inputs)
                      throws IllegalArgumentException
Checks that the given inputs are of the right types, in the right order, and are the right number for this function to evaluate. If the function cannot accept the inputs for evaluation, an IllegalArgumentException is thrown. Unlike the other checkInput method in this interface, this assumes that the parameters will never provide bags of values. This is useful if you're considering a target function which has a designator or selector in its input list, but which passes the values from the derived bags one at a time to the function, so the function doesn't have to deal with the bags that the selector or designator generates.

Parameters:
inputs - a List of Evaluatables, with the first argument being a Function if this is a higher-order function
Throws:
IllegalArgumentException - if the inputs do match what the function accepts for evaluation

encode

void encode(OutputStream output)
Encodes this Function into its XML representation and writes this encoding to the given OutputStream with no indentation.

Specified by:
encode in interface Expression
Parameters:
output - a stream into which the XML-encoded data is written

encode

void encode(OutputStream output,
            Indenter indenter)
Encodes this Function into its XML representation and writes this encoding to the given OutputStream with indentation.

Specified by:
encode in interface Expression
Parameters:
output - a stream into which the XML-encoded data is written
indenter - an object that creates indentation strings


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.