diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java index f2e74907538..c1cd48dd029 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java @@ -50,13 +50,13 @@ public String getLocalName() { @Override public void readElement(XMLExtendedStreamReader reader, List value) throws XMLStreamException { - readerWriterDelegate.readElement(reader, namespace.getVersion(), namespace.getUri(), value); + readerWriterDelegate.readElement(reader, namespace, value); } @Override public void writeContent(XMLExtendedStreamWriter streamWriter, ModelMarshallingContext value) throws XMLStreamException { - readerWriterDelegate.writeContent(streamWriter, namespace.getVersion(), namespace.getUri(), value); + readerWriterDelegate.writeContent(streamWriter, namespace, value); } public static ManagementSchema create(ManagementXmlReaderWriter readerWriterDelegate, diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java index 6009f02825c..a177bd2e1b2 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java @@ -10,6 +10,7 @@ import javax.xml.stream.XMLStreamException; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.IntVersion; import org.jboss.staxmapper.XMLExtendedStreamReader; @@ -22,7 +23,7 @@ */ public interface ManagementXmlReaderWriter { - void readElement(XMLExtendedStreamReader reader, IntVersion version, String namespaceUri, List value) throws XMLStreamException; + void readElement(XMLExtendedStreamReader reader, VersionedNamespace namespace, List value) throws XMLStreamException; - void writeContent(XMLExtendedStreamWriter streamWriter, IntVersion version, String namespaceUri, ModelMarshallingContext value) throws XMLStreamException; + void writeContent(XMLExtendedStreamWriter streamWriter, VersionedNamespace namespace, ModelMarshallingContext value) throws XMLStreamException; } diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java b/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java index aa38991d872..2720bd62b76 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java @@ -11,6 +11,7 @@ import javax.xml.stream.XMLStreamException; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.IntVersion; import org.jboss.staxmapper.XMLExtendedStreamReader; @@ -30,14 +31,14 @@ private UnstableManagementReaderWriter() { } @Override - public void readElement(XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, List value) throws XMLStreamException { + public void readElement(XMLExtendedStreamReader reader, final VersionedNamespace namespace, List value) throws XMLStreamException { throw ROOT_LOGGER.unstableManagementNamespace(reader.getNamespaceURI()); } @Override - public void writeContent(XMLExtendedStreamWriter streamWriter, final IntVersion version, final String namespaceUri, ModelMarshallingContext value) + public void writeContent(XMLExtendedStreamWriter streamWriter, final VersionedNamespace namespace, ModelMarshallingContext value) throws XMLStreamException { - throw ROOT_LOGGER.unstableManagementNamespace(namespaceUri); + throw ROOT_LOGGER.unstableManagementNamespace(namespace.getUri()); } } diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java index ebd4cefaac3..5132c308878 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java @@ -12,7 +12,9 @@ import org.jboss.as.controller.extension.ExtensionRegistry; import org.jboss.as.controller.parsing.ExtensionXml; import org.jboss.as.controller.parsing.ManagementXmlReaderWriter; +import org.jboss.as.controller.parsing.ManagementXmlSchema; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.modules.ModuleLoader; import org.jboss.staxmapper.IntVersion; @@ -36,7 +38,11 @@ public DomainXml(final ModuleLoader loader, ExecutorService executorService, Ext } @Override - public void readElement(final XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, final List nodes) throws XMLStreamException { + public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace namespace, final List nodes) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + switch (version.major()) { case 1: case 2: @@ -65,7 +71,11 @@ public void readElement(final XMLExtendedStreamReader reader, final IntVersion v } @Override - public void writeContent(final XMLExtendedStreamWriter writer, final IntVersion version, final String namespaceUri, final ModelMarshallingContext context) throws XMLStreamException { + public void writeContent(final XMLExtendedStreamWriter writer, final VersionedNamespace namespace, final ModelMarshallingContext context) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + new DomainXml_16(extensionXml, extensionRegistry, version, namespaceUri).writeContent(writer, context); } diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java index 17035cd37fc..332074fd9ec 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java @@ -14,7 +14,9 @@ import org.jboss.as.controller.extension.ExtensionRegistry; import org.jboss.as.controller.parsing.ExtensionXml; import org.jboss.as.controller.parsing.ManagementXmlReaderWriter; +import org.jboss.as.controller.parsing.ManagementXmlSchema; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.modules.ModuleLoader; import org.jboss.staxmapper.IntVersion; @@ -46,8 +48,12 @@ public HostXml(String defaultHostControllerName, RunningMode runningMode, boolea } @Override - public void readElement(final XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, final List operationList) + public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace namespace, final List operationList) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + switch (version.major()) { case 1: case 2: @@ -88,8 +94,12 @@ public void readElement(final XMLExtendedStreamReader reader, final IntVersion v } @Override - public void writeContent(final XMLExtendedStreamWriter writer, final IntVersion version, final String namespaceUri, final ModelMarshallingContext context) + public void writeContent(final XMLExtendedStreamWriter writer, final VersionedNamespace namespace, final ModelMarshallingContext context) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + new HostXml_20(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, version, namespaceUri).writeContent(writer, context); } diff --git a/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java index 54183e691b2..7c9e5fae824 100644 --- a/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java +++ b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java @@ -15,8 +15,10 @@ import org.jboss.as.controller.parsing.DeferredExtensionContext; import org.jboss.as.controller.parsing.ExtensionXml; import org.jboss.as.controller.parsing.ManagementXmlReaderWriter; +import org.jboss.as.controller.parsing.ManagementXmlSchema; import org.jboss.as.controller.parsing.ProfileParsingCompletionHandler; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.modules.ModuleLoader; import org.jboss.staxmapper.IntVersion; @@ -74,8 +76,11 @@ public StandaloneXml(ExtensionHandler handler, DeferredExtensionContext deferred } @Override - public void readElement(final XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, final List operationList) + public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace namespace, final List operationList) throws XMLStreamException { + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + switch (version.major()) { case 1: case 2: @@ -115,8 +120,12 @@ public void readElement(final XMLExtendedStreamReader reader, final IntVersion v } @Override - public void writeContent(final XMLExtendedStreamWriter writer, final IntVersion version, final String namespaceUri, final ModelMarshallingContext context) + public void writeContent(final XMLExtendedStreamWriter writer, final VersionedNamespace namespace, final ModelMarshallingContext context) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + new StandaloneXml_20(extensionHandler, version, namespaceUri, deferredExtensionContext, parsingOptions).writeContent(writer, context); }