|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.cams.attr.func.AbstractFunction
AbstractFunction is a superclass containing common
implementation code for Functions.
| Field Summary | |
static String |
FUNCTION_NS
The standard namespace where all the spec-defined functions live |
| Constructor Summary | |
|
AbstractFunction(String functionName,
int functionId,
String[] argTypes,
boolean[] argIsBag,
String returnType,
boolean returnsBag)
Constructor that sets up the function as having different types for each given parameter. |
|
AbstractFunction(String functionName,
int functionId,
String returnType,
boolean returnsBag)
Constructor that sets up some basic values for functions that will take care of parameter checking on their own. |
|
AbstractFunction(String functionName,
int functionId,
String argType,
boolean argIsBag,
int numArgs,
int minArgs,
String returnType,
boolean returnsBag)
Constructor that sets up the function as having some number of arguments all of the same given type. |
protected |
AbstractFunction(String functionName,
int functionId,
String argType,
boolean argIsBag,
int numArgs,
String returnType,
boolean returnsBag)
Constructor for use with functions having any number of arguments, but all of the same type. |
| Method Summary | |
void |
checkArgList(List argList)
Checks that the given argList contains Evaluatables of the right types, in the right order, and are the right number for this function to evaluate. |
void |
checkArgListAllowBags(List argList)
Checks that the given argList contains Evaluatables of the right types, in the right order, and are the right number for this function to evaluate. |
protected EvaluationResult |
evalArgs(List argList,
EvaluationContext evalContext,
AttributeValue[] args)
Evaluates each argument, filling in the argument array with the resulting values. |
abstract EvaluationResult |
evaluate(List argList,
EvaluationContext evalContext)
Evaluates the Function using the given list of arguments.
|
int |
getFunctionId()
Get the integer function identifier for this particular object. |
String |
getFunctionName()
Get the name of the function for this particular object. |
URI |
getIdentifier()
Get the identifier of this function. |
URI |
getReturnType()
Get the type of AttributeValue that this function
returns from a successful evaluate invocation. |
boolean |
returnsBag()
Indicate whether this function will return a bag of values or just a single value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String FUNCTION_NS
| Constructor Detail |
protected AbstractFunction(String functionName,
int functionId,
String argType,
boolean argIsBag,
int numArgs,
String returnType,
boolean returnsBag)
throws IllegalArgumentException
numArgs is -1, then the
argment list length is variable
functionName - the name of this function as used by the factory
and any XACML policiesfunctionId - an optional identifier that can be used by your
code for convenienceargType - the type of all arguments to this function, as used
by the factory and any XACML documentsargIsBag - whether or not every parameter is actually a bag
of valuesnumArgs - the number of arguments required by this function,
or -1 if any number are allowedreturnType - the type returned by this function, as used by
the factory and any XACML documentsreturnsBag - whether or not this function returns a bag of values
IllegalArgumentException - if the function name is not
a valid URI.
public AbstractFunction(String functionName,
int functionId,
String argType,
boolean argIsBag,
int numArgs,
int minArgs,
String returnType,
boolean returnsBag)
throws IllegalArgumentException
numArgs is
-1, then the length is variable, and then minArgs may
be used to specify a minimum number of arguments. If
numArgs is not -1, then minArgs is
ignored.
functionName - the name of this function as used by the factory
and any XACML policiesfunctionId - an optional identifier that can be used by your
code for convenienceargType - the type of all arguments to this function, as used
by the factory and any XACML documentsargIsBag - whether or not every parameter is actually a bag
of valuesnumArgs - the number of arguments required by this function,
or -1 if any number are allowedminArgs - the minimum number of arguments required if
numArgs is -1returnType - the type returned by this function, as used by
the factory and any XACML documentsreturnsBag - whether or not this function returns a bag of values
IllegalArgumentException - if the function name is not
a valid URI.
public AbstractFunction(String functionName,
int functionId,
String[] argTypes,
boolean[] argIsBag,
String returnType,
boolean returnsBag)
throws IllegalArgumentException
functionName - the name of this function as used by the factory
and any XACML policiesfunctionId - an optional identifier that can be used by your
code for convenienceargTypes - the type of each parameter, in order, required by
this function, as used by the factory and any XACML
documentsargIsBag - whether or not each parameter is actually a bag
of valuesreturnType - the type returned by this function, as used by
the factory and any XACML documentsreturnsBag - whether or not this function returns a bag of values
IllegalArgumentException - if the function name is not
a valid URI.
public AbstractFunction(String functionName,
int functionId,
String returnType,
boolean returnsBag)
throws IllegalArgumentException
functionName - the name of this function as used by the factory
and any XACML policiesfunctionId - an optional identifier that can be used by your
code for conveniencereturnType - the type returned by this function, as used by
the factory and any XACML documentsreturnsBag - whether or not this function returns a bag of values
IllegalArgumentException - if the function name and/or the
return type is not a valid URI.| Method Detail |
public abstract EvaluationResult evaluate(List argList,
EvaluationContext evalContext)
Function using the given list of arguments.
The List contains Evaluatables which must be
of the correct type. Each parameter should be evaluated by the
Function, unless it does not need to evaluate all inputs
to determine a result.
- Specified by:
evaluate in interface Function
- Parameters:
argList - the List of arguments for the function,
which must be the appropriate number of Evaluatables
of the correct type.evalContext - the representation of the request
- Returns:
- a result containing the
AttributeValue computed
when evaluating the function, or Status
specifying some error condition
public URI getIdentifier()
getIdentifier in interface Functionpublic String getFunctionName()
getFunctionName in interface Functionpublic int getFunctionId()
getFunctionId in interface Functionpublic URI getReturnType()
AttributeValue that this function
returns from a successful evaluate invocation.
getReturnType in interface Functionpublic boolean returnsBag()
returnsBag in interface Function
public void checkArgList(List argList)
throws IllegalArgumentException
IllegalArgumentException is thrown.
checkArgList in interface FunctionargList - a List of Evaluatables
IllegalArgumentException - if the arguments do match what the
function accepts for evaluation
public void checkArgListAllowBags(List argList)
throws IllegalArgumentException
IllegalArgumentException is thrown. This check allows
arguments that evaluate to a bag and must be invoked by callers that
invoke the function over a bag of arguments.
checkArgListAllowBags in interface FunctionargList - a List of Evaluatables
IllegalArgumentException - if the arguments do match what the
function accepts for evaluation
protected EvaluationResult evalArgs(List argList,
EvaluationContext evalContext,
AttributeValue[] args)
argList - a List of Evaluatable
objects representing the parameters to evaluateevalContext - the representation of the requestargs - an array as long as the argument List that
will, on return, contain the AttributeValues generated
from evaluating all arguments.
null if no errors were encountered, otherwise
an EvaluationResult representing the error
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||