Interface ExpressionResolverExtension
-
public interface ExpressionResolverExtension
Object that can be used to extend the functionality of anExpressionResolver
by handling expression strings in formats not understood by the expression resolver.Extension expressions must be of the form
${extensionidentifier::someextensionspecificdetails}
, whereextensionidentifier
is some string that identifies the desired extension. All resolver extensions in a process must have unique identifiers. Best practice is for subsystems that register extensions to allow end user configuration control over the identifier so they can provide non-conflicting identifiers. Thesomeextensionspecificdetails
part of the expression is an opaque string understood by the relevant resolver extension.
-
-
Field Summary
Fields Modifier and Type Field Description static Pattern
EXTENSION_EXPRESSION_PATTERN
APattern
that strings must match for any ExpressionResolverExtension to handle them.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
initialize(OperationContext context)
Initialize the extension using the givenOperationContext
.String
resolveExpression(String expression, OperationContext context)
Resolve a given simple expression string, returningnull
if the string is not of a form recognizable to the plugin.
-
-
-
Method Detail
-
initialize
void initialize(OperationContext context) throws OperationFailedException
Initialize the extension using the givenOperationContext
. May be called multiple times for a given extension, so extensions should handle that appropriately. Note that this method may be invoked inOperationContext.Stage.MODEL
. Implementations are not required to support initialization in [@code OperationContext.Stage.MODEL} but should throwExpressionResolver.ExpressionResolutionServerException
if they do not.- Parameters:
context
- theOperationContext
. Will not benull
- Throws:
OperationFailedException
- if a problem initializing occurs that indicates a user mistake (e.g. an improper configuration of a resource used by the extension.) Do not use for non-user-driven problems; use runtime exceptions for those. Throwing a runtime exception that implementsOperationClientException
is also a valid way to handle user mistakes.ExpressionResolver.ExpressionResolutionServerException
- if a non-user-driven problem occurs, including an invocation duringOperationContext.Stage.MODEL
if that is not supported.
-
resolveExpression
String resolveExpression(String expression, OperationContext context)
Resolve a given simple expression string, returningnull
if the string is not of a form recognizable to the plugin.Note: A thread invoking this method must immediately precede the invocation with a call to
initialize(OperationContext)
.- Parameters:
expression
- a string that matchesEXTENSION_EXPRESSION_PATTERN
and that does not have any substrings that match that pattern.context
- the currentOperationContext
to provide additional contextual information.- Returns:
- a string representing the resolve expression, or
null
ifexpression
is not of a form understood by the plugin. - Throws:
ExpressionResolver.ExpressionResolutionUserException
- ifexpression
is a form understood by the plugin but in some way is unacceptable. This should only be thrown due to flaws in the providedexpression
or the configuration of resources used by the resolver extension, which are 'user' problems. It should not be used for internal problems in the resolver extension.ExpressionResolver.ExpressionResolutionServerException
- if some other internal expression resolution failure occurs.
-
-