public abstract class FunctionBase extends Object implements Function
Function. You can
extend this class or implement Function directly, depending
on your needs.| Modifier and Type | Field and Description |
|---|---|
static String |
FUNCTION_NS
The standard namespace where all XACML 1.0 spec-defined functions live
|
static String |
FUNCTION_NS_2
The standard namespace where all XACML 2.0 spec-defined functions live
|
| Constructor and Description |
|---|
FunctionBase(String functionName,
int functionId,
String[] paramTypes,
boolean[] paramIsBag,
String returnType,
boolean returnsBag)
Constructor that sets up the function as having different types for
each given parameter.
|
FunctionBase(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.
|
FunctionBase(String functionName,
int functionId,
String paramType,
boolean paramIsBag,
int numParams,
int minParams,
String returnType,
boolean returnsBag)
Constructor that sets up the function as having some number of
parameters all of the same given type.
|
FunctionBase(String functionName,
int functionId,
String paramType,
boolean paramIsBag,
int numParams,
String returnType,
boolean returnsBag)
Constructor that sets up the function as having some number of
parameters all of the same given type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkInputs(List inputs)
Default handling of input checking.
|
void |
checkInputsNoBag(List inputs)
Default handling of input checking.
|
void |
encode(OutputStream output)
Encodes this
FunctionBase into its XML representation and
writes this encoding to the given OutputStream with no
indentation. |
void |
encode(OutputStream output,
Indenter indenter)
Encodes this
FunctionBase into its XML representation and
writes this encoding to the given OutputStream with
indentation. |
protected EvaluationResult |
evalArgs(List params,
EvaluationCtx context,
AttributeValue[] args)
Evaluates each of the parameters, in order, filling in the argument
array with the resulting values.
|
int |
getFunctionId()
Returns the Identifier of the function to be handled by this
particular object.
|
String |
getFunctionName()
Returns the name of the function to be handled by this particular
object.
|
URI |
getIdentifier()
Returns the full identifier of this function, as known by the factories.
|
URI |
getReturnType()
Get the attribute type returned by this function.
|
String |
getReturnTypeAsString()
Returns the return type for this particular object.
|
URI |
getType()
Returns the same value as
getReturnType. |
protected static EvaluationResult |
makeProcessingError(String message)
Create an
EvaluationResult that indicates a
processing error with the specified message. |
boolean |
returnsBag()
Returns true if this function returns a bag of values.
|
public static final String FUNCTION_NS
public static final String FUNCTION_NS_2
public FunctionBase(String functionName, int functionId, String paramType, boolean paramIsBag, int numParams, String returnType, boolean returnsBag)
numParams is
-1, then the length is variablefunctionName - 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 convenienceparamType - the type of all parameters to this function, as used
by the factory and any XACML documentsparamIsBag - whether or not every parameter is actually a bag
of valuesnumParams - the number of parameters 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 valuespublic FunctionBase(String functionName, int functionId, String paramType, boolean paramIsBag, int numParams, int minParams, String returnType, boolean returnsBag)
numParams is
-1, then the length is variable, and then minParams may
be used to specify a minimum number of parameters. If
numParams is not -1, then minParams 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 convenienceparamType - the type of all parameters to this function, as used
by the factory and any XACML documentsparamIsBag - whether or not every parameter is actually a bag
of valuesnumParams - the number of parameters required by this function,
or -1 if any number are allowedminParams - the minimum number of parameters required if
numParams 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 valuespublic FunctionBase(String functionName, int functionId, String[] paramTypes, boolean[] paramIsBag, String returnType, boolean returnsBag)
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 convenienceparamTypes - the type of each parameter, in order, required by
this function, as used by the factory and any XACML
documentsparamIsBag - 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 valuespublic FunctionBase(String functionName, int functionId, String returnType, boolean returnsBag)
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 valuespublic URI getIdentifier()
getIdentifier in interface FunctionIllegalArgumentException - if the identifier isn't a valid URIpublic String getFunctionName()
public int getFunctionId()
public URI getType()
getReturnType. This is here
to support the Expression interface.getType in interface Expressionpublic URI getReturnType()
getReturnType in interface FunctionURI indicating the attribute type
returned by this functionpublic boolean returnsBag()
returnsBag in interface ExpressionreturnsBag in interface Functionpublic String getReturnTypeAsString()
protected static EvaluationResult makeProcessingError(String message)
EvaluationResult that indicates a
processing error with the specified message. This method
may be useful to subclasses.message - a description of the error
(null if none)EvaluationResultprotected EvaluationResult evalArgs(List params, EvaluationCtx context, AttributeValue[] args)
params - a List of Evaluatable
objects representing the parameters to evaluatecontext - the representation of the requestargs - an array as long as the params List that
will, on return, contain the AttributeValues
generated from evaluating all parametersnull if no errors were encountered, otherwise
an EvaluationResult representing the errorpublic void checkInputs(List inputs) throws IllegalArgumentException
checkInputs in interface Functioninputs - a List> of EvaluatablesIllegalArgumentException - if the inputs won't workpublic void checkInputsNoBag(List inputs) throws IllegalArgumentException
checkInputsNoBag in interface Functioninputs - a List> of EvaluatablesIllegalArgumentException - if the inputs won't workpublic void encode(OutputStream output)
FunctionBase into its XML representation and
writes this encoding to the given OutputStream with no
indentation.encode in interface Expressionencode in interface Functionoutput - a stream into which the XML-encoded data is writtenpublic void encode(OutputStream output, Indenter indenter)
FunctionBase into its XML representation and
writes this encoding to the given OutputStream with
indentation.encode in interface Expressionencode in interface Functionoutput - a stream into which the XML-encoded data is writtenindenter - an object that creates indentation stringsCopyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.