Skip to content

Commit

Permalink
[WFCORE-6829] Pass VersionedNamespace into ManagementXmlReaderWriter …
Browse files Browse the repository at this point in the history
…so version, URI, and Stability are all accessible.
  • Loading branch information
darranl committed Sep 3, 2024
1 parent a3e8817 commit be14f48
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public String getLocalName() {

@Override
public void readElement(XMLExtendedStreamReader reader, List<ModelNode> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +23,7 @@
*/
public interface ManagementXmlReaderWriter {

void readElement(XMLExtendedStreamReader reader, IntVersion version, String namespaceUri, List<ModelNode> value) throws XMLStreamException;
void readElement(XMLExtendedStreamReader reader, VersionedNamespace<IntVersion, ManagementXmlSchema> namespace, List<ModelNode> value) throws XMLStreamException;

void writeContent(XMLExtendedStreamWriter streamWriter, IntVersion version, String namespaceUri, ModelMarshallingContext value) throws XMLStreamException;
void writeContent(XMLExtendedStreamWriter streamWriter, VersionedNamespace<IntVersion, ManagementXmlSchema> namespace, ModelMarshallingContext value) throws XMLStreamException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,14 +31,14 @@ private UnstableManagementReaderWriter() {
}

@Override
public void readElement(XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, List<ModelNode> value) throws XMLStreamException {
public void readElement(XMLExtendedStreamReader reader, final VersionedNamespace<IntVersion, ManagementXmlSchema> namespace, List<ModelNode> 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<IntVersion, ManagementXmlSchema> namespace, ModelMarshallingContext value)
throws XMLStreamException {
throw ROOT_LOGGER.unstableManagementNamespace(namespaceUri);
throw ROOT_LOGGER.unstableManagementNamespace(namespace.getUri());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ModelNode> nodes) throws XMLStreamException {
public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace<IntVersion, ManagementXmlSchema> namespace, final List<ModelNode> nodes) throws XMLStreamException {

final IntVersion version = namespace.getVersion();
final String namespaceUri = namespace.getUri();

switch (version.major()) {
case 1:
case 2:
Expand Down Expand Up @@ -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<IntVersion, ManagementXmlSchema> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ModelNode> operationList)
public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace<IntVersion, ManagementXmlSchema> namespace, final List<ModelNode> operationList)
throws XMLStreamException {

final IntVersion version = namespace.getVersion();
final String namespaceUri = namespace.getUri();

switch (version.major()) {
case 1:
case 2:
Expand Down Expand Up @@ -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<IntVersion, ManagementXmlSchema> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ModelNode> operationList)
public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace<IntVersion, ManagementXmlSchema> namespace, final List<ModelNode> operationList)
throws XMLStreamException {
final IntVersion version = namespace.getVersion();
final String namespaceUri = namespace.getUri();

switch (version.major()) {
case 1:
case 2:
Expand Down Expand Up @@ -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<IntVersion, ManagementXmlSchema> 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);
}

Expand Down

0 comments on commit be14f48

Please sign in to comment.