Interface ExpressionResolverExtension
-
public interface ExpressionResolverExtensionObject that can be used to extend the functionality of anExpressionResolverby handling expression strings in formats not understood by the expression resolver.Extension expressions must be of the form
${extensionidentifier::someextensionspecificdetails}, whereextensionidentifieris 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. Thesomeextensionspecificdetailspart of the expression is an opaque string understood by the relevant resolver extension.
-
-
Field Summary
Fields Modifier and Type Field Description static PatternEXTENSION_EXPRESSION_PATTERNAPatternthat strings must match for any ExpressionResolverExtension to handle them.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidinitialize(OperationContext context)Initialize the extension using the givenOperationContext.StringresolveExpression(String expression, OperationContext context)Resolve a given simple expression string, returningnullif 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.ExpressionResolutionServerExceptionif 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 implementsOperationClientExceptionis also a valid way to handle user mistakes.ExpressionResolver.ExpressionResolutionServerException- if a non-user-driven problem occurs, including an invocation duringOperationContext.Stage.MODELif that is not supported.
-
resolveExpression
String resolveExpression(String expression, OperationContext context)
Resolve a given simple expression string, returningnullif 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_PATTERNand that does not have any substrings that match that pattern.context- the currentOperationContextto provide additional contextual information.- Returns:
- a string representing the resolve expression, or
nullifexpressionis not of a form understood by the plugin. - Throws:
ExpressionResolver.ExpressionResolutionUserException- ifexpressionis a form understood by the plugin but in some way is unacceptable. This should only be thrown due to flaws in the providedexpressionor 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.
-
-