Jeff Mesnil created AS7-5072:
--------------------------------
Summary: value-type not set on ObjectTypeAttributeDefinition
Key: AS7-5072
URL:
https://issues.jboss.org/browse/AS7-5072
Project: Application Server 7
Issue Type: Feature Request
Components: Domain Management
Reporter: Jeff Mesnil
Assignee: Tomaz Cerar
I am not able to define an attribute properly and it seems there is a bug with setting
value-type on an ObjectTypeAttributionDefinition.
I have a CoreAddressDefinition which defines a runtime read-only attribute
"roles". This attribute is a LIST of OBJECT named "role". This OBJECT
is composed of a STRING attribute "name" and many BOOLEAN attributes (from the
SecurityRoleDefinition).
They are represented by:
private static final AttributeDefinition NAME = create("name",
ModelType.STRING)
.build();
private static final ObjectTypeAttributeDefinition ROLE =
ObjectTypeAttributeDefinition.Builder.of(CommonAttributes.ROLE, new AttributeDefinition[]
{ NAME }, SecurityRoleDefinition.ATTRIBUTES)
.build();
static final AttributeDefinition ROLES =
ObjectListAttributeDefinition.Builder.of(CommonAttributes.ROLES_ATTR_NAME, ROLE)
.setFlags(AttributeAccess.Flag.STORAGE_RUNTIME)
.build();
After they are registered (using a DefaultResourceDescriptionProvider), the value-type of
the OBJECT attribute is not set. I was expecting it to be the concatenation of the various
valueTypes I passed to the ROLE attribute.
{
"description" => "A runtime-only resource representing a HornetQ
\"address\". Zero or more queues can be bound to a single address. When a
message is routed, it is routed to the set of queues bound to the message's
address.",
"attributes" => {"roles" => {
"type" => LIST,
"description" => "A list of the security roles (name and
permissions) associated with the address.",
"expressions-allowed" => false,
"nillable" => false,
"value-type" => {"role" => {
"type" => OBJECT,
"description" => "A security role associated with the
address.",
"expressions-allowed" => false,
"nillable" => false
}}
}},
"operations" => undefined,
"children" => {}
}
I did a dew debugging and one thing that I don't understand is why in
ObjectListAttributeDefinition, the 3 implementations of addValueTypeDescription are
different and only 1 will check whether the value type corresponds to an OBJECT. Using a
DefaultResourceDescriptionProvider I end up using
ObjectListAttributeDefinition#addAttributeValueTypeDescription(final ModelNode node, final
ResourceDescriptionResolver resolver, final Locale locale, final ResourceBundle bundle)
which does *not* set the value-type.
To reproduce this failure, you can run mvn clean install -pl messaging from my branch, all
the tests fail because of this one:
https://github.com/jmesnil/jboss-as/tree/AS7-4790_ResourceDefinition_conv...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira