|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.wso2.balana.cond.FunctionBase
public abstract class FunctionBase
An abstract utility superclass for functions. Supplies several useful methods, making it easier
to implement a Function
. You can extend this class or implement
Function
directly, depending on your needs.
Field Summary | |
---|---|
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 |
static String |
FUNCTION_NS_3
The standard namespace where all XACML 3.0 spec-defined functions live |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
checkInputs(List inputs)
Default handling of input checking. |
void |
checkInputsNoBag(List inputs)
Default handling of input checking. |
String |
encode()
Encodes this FunctionBase into its XML form |
void |
encode(StringBuilder builder)
Encodes this FunctionBase into its XML form and writes this out to the provided
StringBuilder |
protected EvaluationResult |
evalArgs(List<Evaluatable> 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.wso2.balana.cond.Function |
---|
evaluate |
Field Detail |
---|
public static final String FUNCTION_NS
public static final String FUNCTION_NS_2
public static final String FUNCTION_NS_3
Constructor Detail |
---|
public FunctionBase(String functionName, int functionId, String paramType, boolean paramIsBag, int numParams, String returnType, boolean returnsBag)
numParams
is -1, then the 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 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 valuesMethod Detail |
---|
public URI getIdentifier()
getIdentifier
in interface Function
IllegalArgumentException
- 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 Expression
public URI getReturnType()
getReturnType
in interface Function
URI
indicating the attribute type returned by this functionpublic boolean returnsBag()
returnsBag
in interface Expression
returnsBag
in interface Function
public 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)
EvaluationResult
protected EvaluationResult evalArgs(List<Evaluatable> 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 AttributeValue
s generated from evaluating all parameters
null
if no errors were encountered, otherwise an
EvaluationResult
representing the errorpublic void checkInputs(List inputs) throws IllegalArgumentException
checkInputs
in interface Function
inputs
- a List>
of Evaluatable
s
IllegalArgumentException
- if the inputs won't workpublic void checkInputsNoBag(List inputs) throws IllegalArgumentException
checkInputsNoBag
in interface Function
inputs
- a List>
of Evaluatable
s
IllegalArgumentException
- if the inputs won't workpublic String encode()
FunctionBase
into its XML form
encode
in interface Function
String
public void encode(StringBuilder builder)
FunctionBase
into its XML form and writes this out to the provided
StringBuilder
- Specified by:
encode
in interface Expression
- Specified by:
encode
in interface Function
- Parameters:
builder
- string stream into which the XML-encoded data is written
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |