Interface ExpressionFactory
-
- All Superinterfaces:
AutoCloseable
,Closeable
public interface ExpressionFactory extends Closeable
Expression factory for parsing XACMLExpressionType
s in policies: AttributeDesignator, AttributeSelector, Apply, etc.Extends
Closeable
because it may useNamedAttributeProvider
s (implementCloseable
) to resolve AttributeDesignators for attributes not provided in the request.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VariableReference<?>
addVariable(oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableDefinition varDef, net.sf.saxon.s9api.XPathCompiler xPathCompiler, Deque<String> longestVarRefChain)
Add VariableDefinition (variable assignment expression)FunctionExpression
getFunction(String functionId)
Gets a non-generic function instanceFunctionExpression
getFunction(String functionId, Datatype<? extends AttributeValue> subFunctionReturnType)
Gets a function instance (generic or non-generic).ConstantExpression<? extends AttributeValue>
getInstance(oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType jaxbAttrVal, net.sf.saxon.s9api.XPathCompiler xPathCompiler)
Parse/create an attribute value expression from XACML-schema-derived JAXB modelExpression<?>
getInstance(oasis.names.tc.xacml._3_0.core.schema.wd_17.ExpressionType expr, net.sf.saxon.s9api.XPathCompiler xPathCompiler, Deque<String> longestVarRefChain)
Parses an XACML Expression into internal model of expression (evaluable).VariableReference<?>
getVariableExpression(String varId)
Get a given variable's assignment expression (definition)VariableReference<?>
removeVariable(String varId)
Removes the VariableReference(Definition) from the manager
-
-
-
Method Detail
-
getInstance
Expression<?> getInstance(oasis.names.tc.xacml._3_0.core.schema.wd_17.ExpressionType expr, net.sf.saxon.s9api.XPathCompiler xPathCompiler, Deque<String> longestVarRefChain) throws IllegalArgumentException
Parses an XACML Expression into internal model of expression (evaluable).- Parameters:
expr
- the JAXB ExpressionType derived from XACML modelxPathCompiler
- Policy(Set) default XPath compiler, corresponding to the Policy(Set)'s default XPath version specified inDefaultsType
element; null if none specifiedlongestVarRefChain
- Longest chain of VariableReference references in the VariableDefinition's expression that isexpr
or containsexpr
, or null ifexpr
is not in a VariableDefinition. A VariableReference reference chain is a list of VariableIds, such that V1-> V2 ->... -> Vn ->expr
, where "V1 -> V2" means: the expression in VariableDefinition of V1 has a VariableReference to V2. This is used to detect exceeding depth of VariableReference reference in VariableDefinitions' expressions. Again,longestVarRefChain
may be null, if this expression is not used in a VariableDefinition.- Returns:
- an
Expression
or null if the root node cannot be parsed as a valid Expression - Throws:
IllegalArgumentException
- invalid ExpressionType
-
getInstance
ConstantExpression<? extends AttributeValue> getInstance(oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType jaxbAttrVal, net.sf.saxon.s9api.XPathCompiler xPathCompiler) throws IllegalArgumentException
Parse/create an attribute value expression from XACML-schema-derived JAXB model- Parameters:
jaxbAttrVal
- XACML-schema-derived JAXB AttributeValuexPathCompiler
- Policy(Set) default XPath compiler, corresponding to the Policy(Set)'s default XPath version specified inDefaultsType
element; null if none specified- Returns:
- attribute value Expression
- Throws:
IllegalArgumentException
- if value cannot be parsed into the value's defined datatype
-
addVariable
VariableReference<?> addVariable(oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableDefinition varDef, net.sf.saxon.s9api.XPathCompiler xPathCompiler, Deque<String> longestVarRefChain) throws IllegalArgumentException
Add VariableDefinition (variable assignment expression)- Parameters:
varDef
- VariableDefinitionxPathCompiler
- Policy(Set) default XPath compiler, corresponding to the Policy(Set)'s default XPath version specified inDefaultsType
element.longestVarRefChain
- Ignored if null else used as inout parameter to be filled by this method with the longest chain of VariableReference references invarDef
. A VariableReference reference chain is a list of VariableIds, such that V1-> V2 ->... -> Vn ->expr
, where "V1 -> V2" means: the expression in VariableDefinition of V1 has a VariableReference to V2. This is used to detect exceeding depth of VariableReference reference in VariableDefinitions' expressions. Again,longestVarRefChain
may be null, if this expression is not used in a VariableDefinition.- Returns:
- The previous VariableReference if VariableId already used
- Throws:
IllegalArgumentException
- invalid expression invarDef
-
getVariableExpression
VariableReference<?> getVariableExpression(String varId)
Get a given variable's assignment expression (definition)- Parameters:
varId
- variable identifier- Returns:
- the VariableReference identified by
varId
, or null if there is no such variable.
-
removeVariable
VariableReference<?> removeVariable(String varId)
Removes the VariableReference(Definition) from the manager- Parameters:
varId
- variable identifier- Returns:
- the VariableReference previously identified by
varId
, or null if there was no such variable.
-
getFunction
FunctionExpression getFunction(String functionId)
Gets a non-generic function instance- Parameters:
functionId
- function ID (XACML URI)- Returns:
- function instance; or null if no such function with ID
functionId
-
getFunction
FunctionExpression getFunction(String functionId, Datatype<? extends AttributeValue> subFunctionReturnType) throws IllegalArgumentException
Gets a function instance (generic or non-generic).- Parameters:
functionId
- function ID (XACML URI)subFunctionReturnType
- optional sub-function's return type required only if a generic higher-order function is expected as the result, of which the sub-function is expected to be the first parameter; otherwise null (for first-order function). A generic higher-order function is a function whose return type depends on the sub-function ('s return type). Note: we only support sub-functions with primitive return type here, for simplicity (seeHigherOrderBagFunction
for more info).- Returns:
- function instance; or null if no such function with ID
functionId
, or if non-nullsubFunctionReturnTypeId
specified and no higher-order function compatible with sub-function's return typesubFunctionReturnTypeId
- Throws:
IllegalArgumentException
- if datatypesubFunctionReturnType
is not supported
-
-