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.
@FunctionalInterface public interface ExpressionResolver
ResolvesModelType.EXPRESSION
expressions in aModelNode
.- Author:
- Kabir Khan
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ExpressionResolver.ExpressionResolutionServerException
Runtime exception used to indicate a failure in someresolver extension execution
not due to problems with user input like the expression string being resolved or the configuration of resources backing the resolver extension.static class
ExpressionResolver.ExpressionResolutionUserException
Runtime 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 aExpressionResolverExtension
not being able to resolve the expression.
-
Field Summary
Fields Modifier and Type Field Description static Pattern
EXPRESSION_PATTERN
APattern
that can be used to identify strings that include expression syntaxstatic ExpressionResolver
EXTENSION_REJECTING
An expression resolver that throws anExpressionResolver.ExpressionResolutionServerException
if anyextension expressions
are found, otherwise providing the same behavior asSIMPLE
.static ExpressionResolver
REJECTING
An expression resolver that throws anOperationFailedException
if any expressions are found.static ExpressionResolver
SIMPLE
AnExpressionResolver
that can only resolve from system properties and environment variables.static ExpressionResolver
SIMPLE_LENIENT
An expression resolver that will not throw anOperationFailedException
when it encounters an unresolvable expression, instead simply returning that expression.static ExpressionResolver
TEST_RESOLVER
AnExpressionResolver
suitable for test cases that can only resolve from system properties and environment variables.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description org.jboss.dmr.ModelNode
resolveExpressions(org.jboss.dmr.ModelNode node)
Resolves any expressions in the passed in ModelNode.default org.jboss.dmr.ModelNode
resolveExpressions(org.jboss.dmr.ModelNode node, OperationContext context)
Resolves any expressions in the passed in ModelNode.
-
-
-
Field Detail
-
EXPRESSION_PATTERN
static final Pattern EXPRESSION_PATTERN
APattern
that can be used to identify strings that include expression syntax
-
SIMPLE
static final ExpressionResolver SIMPLE
AnExpressionResolver
that 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
static final ExpressionResolver TEST_RESOLVER
AnExpressionResolver
suitable 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
static final ExpressionResolver SIMPLE_LENIENT
An expression resolver that will not throw anOperationFailedException
when 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
static final ExpressionResolver REJECTING
An expression resolver that throws anOperationFailedException
if any expressions are found. Intended for use with APIs where anExpressionResolver
is required but the caller requires that all expression have already been resolved.
-
EXTENSION_REJECTING
static final ExpressionResolver EXTENSION_REJECTING
An expression resolver that throws anExpressionResolver.ExpressionResolutionServerException
if anyextension expressions
are found, otherwise providing the same behavior asSIMPLE
. Intended for use in cases whereExpressionResolverExtension
s cannot be available but non-extension expression resolution is wanted.
-
-
Method Detail
-
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 anExpressionResolverExtension
registered using theResolverExtensionRegistry
.- Parameters:
node
- the ModelNode containing expressions.- Returns:
- a copy of the node with expressions resolved
- Throws:
ExpressionResolver.ExpressionResolutionUserException
- ifexpression
is a form understood by the resolver but in some way is unacceptable. This should only be thrown due to flaws in the providedexpression
or 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 itscheckPermission
method doesn't allow access to a relevant system property or environment variable, anExpressionResolutionUserException
should be thrown.OperationFailedException
- if anExpressionResolverExtension
throws 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 anExpressionResolverExtension
registered using theResolverExtensionRegistry
. For vaulted data the format is ${VAULT::vault_block::attribute_name::sharedKey}- Parameters:
node
- the ModelNode containing expressions.context
- the currentOperationContext
to provide additional contextual information.- Returns:
- a copy of the node with expressions resolved
- Throws:
ExpressionResolver.ExpressionResolutionUserException
- ifexpression
is a form understood by the resolver 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. If a if a security manager exists and itscheckPermission
method doesn't allow access to a relevant system property or environment variable, anExpressionResolutionUserException
should be thrownOperationFailedException
- if anExpressionResolverExtension
throws one from itsExpressionResolverExtension.initialize(OperationContext)
method.ExpressionResolver.ExpressionResolutionServerException
- if some other internal expression resolution failure occurs.
-
-