[jboss-jira] [JBoss JIRA] (AS7-4273) Re-visit Namespace Handling in Domain Parsing
Darran Lofthouse (JIRA)
jira-events at lists.jboss.org
Fri Mar 23 07:10:47 EDT 2012
Darran Lofthouse created AS7-4273:
-------------------------------------
Summary: Re-visit Namespace Handling in Domain Parsing
Key: AS7-4273
URL: https://issues.jboss.org/browse/AS7-4273
Project: Application Server 7
Issue Type: Task
Components: Domain Management
Reporter: Darran Lofthouse
Assignee: Darran Lofthouse
Priority: Critical
Fix For: 7.1.2.Final
This issue is picking at implementation details within the XML parsing - however this is something that is going to need to be maintained long term so we need to ensure it is right - we had already previously started to have exceptional if statements creeping in before the last clean up and this just leads to confusing code as each method then needs to be compared against every version of the schema - the method per version approach removes that but we need to ensure it is applied consistently.
As an example we now have the following method: -
void parseDomainSocketBindingGroups(final XMLExtendedStreamReader reader, final ModelNode address, final Namespace expectedNs,
final List<ModelNode> list, final Set<String> interfaces) throws XMLStreamException {
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader, expectedNs);
final Element element = Element.forName(reader.getLocalName());
switch (element) {
case SOCKET_BINDING_GROUP: {
switch (expectedNs) {
case DOMAIN_1_0:
// parse 1.0 socket binding group
this.parseSocketBindingGroup_1_0(reader, interfaces, address, expectedNs, list);
break;
case DOMAIN_1_1:
case DOMAIN_1_2:
// parse 1.1 socket binding group
this.parseSocketBindingGroup_1_1(reader, interfaces, address, expectedNs, list);
break;
default:
unexpectedElement(reader);
}
break;
}
default: {
throw unexpectedElement(reader);
}
}
}
}
There should not be a case for 1.1 and 1.2 of the schema, at the very top level when parsing began we have already confirmed that the schema is one of 1.0, 1.1 or 1.2 before this method is even called.
We do not support switching schema versions in a single document so the call requireNamespace(reader, expectedNs) has verified that the version has not changed - in this method both 1.1 and 1.2 can be handled as default. We only need to handle a list of versions like this once a new parseSocketBindingGroup_1_ method is added - at that point we will list the versions that match 1_1 and the newest will go to default.
The reason this is important is as it stands every time the schema version is incremented this method is going to need to be modified to keep adding new schema versions even if it is not affected by the updates.
--
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
More information about the jboss-jira
mailing list