6
6
7
7
import java .util .regex .Pattern ;
8
8
9
+ import org .jboss .as .controller .capability .CapabilityServiceSupport ;
9
10
import org .jboss .as .controller .extension .ExpressionResolverExtension ;
10
11
import org .jboss .as .controller .extension .ResolverExtensionRegistry ;
11
12
import org .jboss .as .controller .logging .ControllerLogger ;
@@ -23,9 +24,9 @@ public interface ExpressionResolver {
23
24
Pattern EXPRESSION_PATTERN = Pattern .compile (".*\\ $\\ {.*}.*" );
24
25
25
26
/**
26
- * Resolves any expressions in the passed in ModelNode.
27
- *
28
- * Expressions may represent system properties, vaulted date, or a custom format to be handled by an
27
+ * Resolves any expressions in the passed- in ModelNode.
28
+ * <p/>
29
+ * Expressions may represent system properties, environment variables or a custom format to be handled by an
29
30
* {@link ExpressionResolverExtension} registered using the {@link ResolverExtensionRegistry}.
30
31
*
31
32
* @param node the ModelNode containing expressions.
@@ -47,13 +48,11 @@ public interface ExpressionResolver {
47
48
ModelNode resolveExpressions (ModelNode node ) throws OperationFailedException ;
48
49
49
50
/**
50
- * Resolves any expressions in the passed in ModelNode.
51
- *
52
- * Expressions may represent system properties, vaulted date, or a custom format to be handled by an
51
+ * Resolves any expressions in the passed- in ModelNode.
52
+ * <p/>
53
+ * Expressions may represent system properties, environment variables or a custom format to be handled by an
53
54
* {@link ExpressionResolverExtension} registered using the {@link ResolverExtensionRegistry}.
54
55
*
55
- * For vaulted data the format is ${VAULT::vault_block::attribute_name::sharedKey}
56
- *
57
56
* @param node the ModelNode containing expressions.
58
57
* @param context the current {@code OperationContext} to provide additional contextual information.
59
58
* @return a copy of the node with expressions resolved
@@ -75,6 +74,41 @@ default ModelNode resolveExpressions(ModelNode node, OperationContext context) t
75
74
return resolveExpressions (node );
76
75
}
77
76
77
+ /**
78
+ * Resolves any expressions in the passed-in ModelNode.
79
+ * <p/>
80
+ * Expressions may represent system properties, environment variables or a custom format to be handled by an
81
+ * {@link ExpressionResolverExtension} registered using the {@link ResolverExtensionRegistry}.
82
+ *
83
+ * @param node the ModelNode containing expressions.
84
+ * @param capabilitySupport support object for accessing capability-backed APIs.
85
+ * @return a copy of the node with expressions resolved
86
+ *
87
+ * @throws ExpressionResolutionUserException if {@code expression} is a form understood by the resolver but in some
88
+ * way is unacceptable. This should only be thrown due to flaws in the
89
+ * provided {@code expression} or the configuration of resources used by
90
+ * the resolver extension, which are 'user' problems>. It should not
91
+ * be used for internal problems in the resolver extension. If a
92
+ * if a security manager exists and its
93
+ * {@link SecurityManager#checkPermission checkPermission} method doesn't
94
+ * allow access to a relevant system property or environment variable,
95
+ * an {@code ExpressionResolutionUserException} should be thrown
96
+ * @throws ExpressionResolver.ExpressionResolutionServerException if some other internal expression resolution failure occurs.
97
+ */
98
+ default ModelNode resolveExpressions (ModelNode node , CapabilityServiceSupport capabilitySupport ) {
99
+ try {
100
+ return resolveExpressions (node );
101
+ } catch (OperationFailedException e ) {
102
+ // This can be thrown because supposedly an ExpressionResolverExtension could throw
103
+ // it from ExpressionResolverExtension.initialize(OperationContext). But per the initialize()
104
+ // javadoc it should only do that in response to a user problem determined by using the OperationContext.
105
+ // But there is no OperationContext passed in a call to resolveExpressions(ModelNode)!
106
+ // That method should remove 'throws OperationFailedException', but that would be a breaking API change.
107
+ // So this shouldn't happen and if it does something has gone wrong
108
+ throw new IllegalStateException (e );
109
+ }
110
+ }
111
+
78
112
/**
79
113
* An {@code ExpressionResolver} that can only resolve from system properties
80
114
* and environment variables. Should not be used for most product resolution use cases as it does
0 commit comments