Package org.jboss.as.controller
Interface ExpressionResolver
- All Known Subinterfaces:
OperationContext
- All Known Implementing Classes:
ExpressionResolverImpl
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Resolves
ModelType.EXPRESSION expressions in a ModelNode.- Author:
- Kabir Khan
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classRuntime exception used to indicate a failure in someresolver extension executionnot due to problems with user input like the expression string being resolved or the configuration of resources backing the resolver extension.static classRuntime exception used to indicate some user-driven problem that prevented expression resolution, for example: A flaw in a user provided expression string that results in aExpressionResolverExtensionnot being able to resolve the expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternAPatternthat can be used to identify strings that include expression syntaxstatic final ExpressionResolverAn expression resolver that throws anExpressionResolver.ExpressionResolutionServerExceptionif anyextension expressionsare found, otherwise providing the same behavior asSIMPLE.static final ExpressionResolverAn expression resolver that throws anOperationFailedExceptionif any expressions are found.static final ExpressionResolverAnExpressionResolverthat can only resolve from system properties and environment variables.static final ExpressionResolverAn expression resolver that will not throw anOperationFailedExceptionwhen it encounters an unresolvable expression, instead simply returning that expression.static final ExpressionResolverAnExpressionResolversuitable for test cases that can only resolve from system properties and environment variables. -
Method Summary
Modifier and TypeMethodDescriptionorg.jboss.dmr.ModelNoderesolveExpressions(org.jboss.dmr.ModelNode node) Resolves any expressions in the passed in ModelNode.default org.jboss.dmr.ModelNoderesolveExpressions(org.jboss.dmr.ModelNode node, OperationContext context) Resolves any expressions in the passed in ModelNode.
-
Field Details
-
EXPRESSION_PATTERN
APatternthat can be used to identify strings that include expression syntax -
SIMPLE
AnExpressionResolverthat can only resolve from system properties and environment variables. Should not be used for most product resolution use cases as it does not support resolution from resolver extensions. -
TEST_RESOLVER
AnExpressionResolversuitable for test cases that can only resolve from system properties and environment variables. Should not be used for production code as it does not support resolution from resolver extensions. -
SIMPLE_LENIENT
An expression resolver that will not throw anOperationFailedExceptionwhen it encounters an unresolvable expression, instead simply returning that expression. Should not be used for most product resolution use cases as it does not support resolution from resolver extensions. -
REJECTING
An expression resolver that throws anOperationFailedExceptionif any expressions are found. Intended for use with APIs where anExpressionResolveris required but the caller requires that all expression have already been resolved. -
EXTENSION_REJECTING
An expression resolver that throws anExpressionResolver.ExpressionResolutionServerExceptionif anyextension expressionsare found, otherwise providing the same behavior asSIMPLE. Intended for use in cases whereExpressionResolverExtensions cannot be available but non-extension expression resolution is wanted.
-
-
Method Details
-
resolveExpressions
org.jboss.dmr.ModelNode resolveExpressions(org.jboss.dmr.ModelNode node) throws OperationFailedException Resolves any expressions in the passed in ModelNode. Expressions may represent system properties, vaulted date, or a custom format to be handled by anExpressionResolverExtensionregistered using theResolverExtensionRegistry.- Parameters:
node- the ModelNode containing expressions.- Returns:
- a copy of the node with expressions resolved
- Throws:
ExpressionResolver.ExpressionResolutionUserException- ifexpressionis a form understood by the resolver but in some way is unacceptable. This should only be thrown due to flaws in the providedexpressionor the configuration of resources used by a resolver extension, which are 'user' problems. It should not be used for internal problems in the resolver or any extension. If a if a security manager exists and itscheckPermissionmethod doesn't allow access to a relevant system property or environment variable, anExpressionResolutionUserExceptionshould be thrown.OperationFailedException- if anExpressionResolverExtensionthrows one from itsExpressionResolverExtension.initialize(OperationContext)method.ExpressionResolver.ExpressionResolutionServerException- if some other internal expression resolution failure occurs.
-
resolveExpressions
default org.jboss.dmr.ModelNode resolveExpressions(org.jboss.dmr.ModelNode node, OperationContext context) throws OperationFailedException Resolves any expressions in the passed in ModelNode. Expressions may represent system properties, vaulted date, or a custom format to be handled by anExpressionResolverExtensionregistered using theResolverExtensionRegistry. For vaulted data the format is ${VAULT::vault_block::attribute_name::sharedKey}- Parameters:
node- the ModelNode containing expressions.context- the currentOperationContextto provide additional contextual information.- Returns:
- a copy of the node with expressions resolved
- Throws:
ExpressionResolver.ExpressionResolutionUserException- ifexpressionis a form understood by the resolver 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. If a if a security manager exists and itscheckPermissionmethod doesn't allow access to a relevant system property or environment variable, anExpressionResolutionUserExceptionshould be thrownOperationFailedException- if anExpressionResolverExtensionthrows one from itsExpressionResolverExtension.initialize(OperationContext)method.ExpressionResolver.ExpressionResolutionServerException- if some other internal expression resolution failure occurs.
-