[jboss-jira] [JBoss JIRA] (WFCORE-809) Can not parse an ObjectListAttributeDefinition of a PersistentResourceDefinition
Jeff Mesnil (JIRA)
issues at jboss.org
Wed Jul 15 08:19:02 EDT 2015
[ https://issues.jboss.org/browse/WFCORE-809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13089665#comment-13089665 ]
Jeff Mesnil commented on WFCORE-809:
------------------------------------
I have not been able to provide a customer parser for this type of attribute.
It seems the PersistentResourceDefinition implementation does not support to have an attribute represented by an XML element.
The parser will look for management attributes:
* in XML attributes (and I can't represent a LIST of OBJECT in a single attribute)
* in a XML element if the attribute has an attribute group. But the XML element representing the attribute group can not include any children XML element
Once the PersistentResourceDefinition has looked in these places for attributes, it expects any other XML children elements to be represent children of the resources. But in this case, a XML element would also represent the XML representation of its "interceptors" attribute.
> Can not parse an ObjectListAttributeDefinition of a PersistentResourceDefinition
> --------------------------------------------------------------------------------
>
> Key: WFCORE-809
> URL: https://issues.jboss.org/browse/WFCORE-809
> Project: WildFly Core
> Issue Type: Bug
> Components: Domain Management
> Affects Versions: 2.0.0.Alpha6
> Reporter: Jeff Mesnil
> Assignee: Tomaz Cerar
>
> My server resource defines an "interceptors" attribute:
> {noformat}
> public static final ObjectTypeAttributeDefinition CLASS = ObjectTypeAttributeDefinition.Builder.of("class",
> create("name", ModelType.STRING, false)
> .setAllowExpression(false)
> .build(),
> create("module", ModelType.STRING, false)
> .setAllowExpression(false)
> .build())
> .build();
> public static final ObjectListAttributeDefinition INTERCEPTORS = ObjectListAttributeDefinition.Builder.of("interceptors", CLASS)
> .setAllowNull(true)
> .setAllowExpression(false)
> .setMinSize(1)
> .setMaxSize(Integer.MAX_VALUE)
> .build();
> {noformat}
> The "interceptors" is a LIST of "class" attribute which is an OBJECT composed of a "name" and "module" attribute.
> I'm not sure what is the corresponding XML format for this attribute.
> Ideally, I'd like to have this XML format:
> {noformat}
> <server name="default" >
> ...
> <interceptors>
> <class name="org.bar.MyInterceptor"
> module="org.bar" />
> <class name="org.baz.MyOtherInterceptor"
> module="org.baz" />
> </interceptors>
> ...
> </server>
> {noformat}
> This XML can not be parsed and I have not found which XML representation can be parsed given my INTERCEPTORS definition.
> The XML parsing fails with:
> {noformat}
> javax.xml.stream.XMLStreamException: ParseError at [row,col]:[23,27]
> Message: WFLYCTL0377: Unexpected element '{urn:jboss:domain:test:1.0}interceptors' encountered. Valid elements are: 'buffer-cache'
> at org.jboss.as.controller.parsing.ParseUtils.unexpectedElement(ParseUtils.java:98)
> at org.jboss.as.controller.PersistentResourceXMLDescription.parseChildren(PersistentResourceXMLDescription.java:270)
> at org.jboss.as.controller.PersistentResourceXMLDescription.parse(PersistentResourceXMLDescription.java:166)
> at org.jboss.as.controller.PersistentResourceXMLDescription.parseChildren(PersistentResourceXMLDescription.java:266)
> at org.jboss.as.controller.PersistentResourceXMLDescription.parse(PersistentResourceXMLDescription.java:166)
> at org.jboss.as.controller.PersistentResourceXMLParser.readElement(PersistentResourceXMLParser.java:41)
> at org.jboss.as.controller.PersistentResourceXMLParser.readElement(PersistentResourceXMLParser.java:35)
> {noformat}
> Corresponding test case in wildly-core is in my branch at https://github.com/jmesnil/wildfly-core/tree/parse_ObjectListAttributeDefinition
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list