[jboss-jira] [JBoss JIRA] (WFCORE-835) Investigate appearance of 'allowed' in ObjectListAttributeDefinition
Kabir Khan (JIRA)
issues at jboss.org
Wed Jul 22 05:33:02 EDT 2015
Kabir Khan created WFCORE-835:
---------------------------------
Summary: Investigate appearance of 'allowed' in ObjectListAttributeDefinition
Key: WFCORE-835
URL: https://issues.jboss.org/browse/WFCORE-835
Project: WildFly Core
Issue Type: Feature Request
Components: Domain Management
Affects Versions: 2.0.0.Alpha10
Reporter: Kabir Khan
Assignee: Brian Stansberry
When doing the work for https://github.com/wildfly/wildfly/pull/7757 / https://issues.jboss.org/browse/WFLY-4880, which contains an ObjectListTypeAttributeDefinition, Brian picked up on that there is an
{code}
"allowed" => [
"class",
"name",
"actions",
"module"
],
{code}
in the resource description. The output is shown in the PR description, and can also be found in other places using ObjectListTypeAttributeDefinition. Digging in a bit, the issue appears to happen at https://github.com/wildfly/wildfly-core/blob/master/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L933, or if this class changes, it is here:
{code}
protected void addAllowedValuesToDescription(ModelNode result, ParameterValidator validator) {
if (allowedValues != null) {
for (ModelNode allowedValue : allowedValues) {
result.get(ModelDescriptionConstants.ALLOWED).add(allowedValue);
}
} else if (validator instanceof AllowedValuesValidator) {
//IT ENTERS THIS
AllowedValuesValidator avv = (AllowedValuesValidator) validator;
List<ModelNode> allowed = avv.getAllowedValues();
if (allowed != null) {
for (ModelNode ok : allowed) {
result.get(ModelDescriptionConstants.ALLOWED).add(ok);
}
}
}
}
{code}
The ParameterValidator is an instance of NillableOrExpressionParameterValidator, which implements AllowedValuesValidator, so it enters the ‘else if’ block, and adds the ‘allowed’ part. Looking a bit at the history of AttributeDefinition and NillableOrExpressionParameterValidator, it appears that this would have worked this way for a while.
So this Jira is mainly to jot this down, so we can decide if ‘allowed’ should be removed or not. Please rename the Jira if we should remove it.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list