@Override public void writeContent( final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) throws XMLStreamException { ModelNode modelNode = context.getModelNode(); writer.writeStartDocument(); writer.writeStartElement(Element.DOMAIN.getLocalName()); writer.writeDefaultNamespace(Namespace.CURRENT.getUriString()); writeNamespaces(writer, modelNode); writeSchemaLocation(writer, modelNode); DomainAttributes.NAME.marshallAsAttribute(modelNode, false, writer); writeNewLine(writer); if (modelNode.hasDefined(EXTENSION)) { extensionXml.writeExtensions(writer, modelNode.get(EXTENSION)); writeNewLine(writer); } if (modelNode.hasDefined(SYSTEM_PROPERTY)) { writeProperties(writer, modelNode.get(SYSTEM_PROPERTY), Element.SYSTEM_PROPERTIES, false); writeNewLine(writer); } if (modelNode.hasDefined(PATH)) { writePaths(writer, modelNode.get(PATH)); writeNewLine(writer); } if (modelNode.hasDefined(PROFILE)) { writer.writeStartElement(Element.PROFILES.getLocalName()); for (final Property profile : modelNode.get(PROFILE).asPropertyList()) { writeProfile(writer, profile.getName(), profile.getValue(), context); } writer.writeEndElement(); writeNewLine(writer); } if (modelNode.hasDefined(INTERFACE)) { writeInterfaces(writer, modelNode.get(INTERFACE)); writeNewLine(writer); } if (modelNode.hasDefined(SOCKET_BINDING_GROUP)) { writer.writeStartElement(Element.SOCKET_BINDING_GROUPS.getLocalName()); for (final Property property : modelNode.get(SOCKET_BINDING_GROUP).asPropertyList()) { writeSocketBindingGroup(writer, property.getValue(), false); } writer.writeEndElement(); writeNewLine(writer); } if (modelNode.hasDefined(DEPLOYMENT)) { writeDomainDeployments(writer, modelNode.get(DEPLOYMENT)); writeNewLine(writer); } if (modelNode.hasDefined(SERVER_GROUP)) { writer.writeStartElement(Element.SERVER_GROUPS.getLocalName()); for (final Property property : modelNode.get(SERVER_GROUP).asPropertyList()) { writeServerGroup(writer, property.getName(), property.getValue()); } writer.writeEndElement(); writeNewLine(writer); } if (modelNode.hasDefined(MANAGEMENT_CLIENT_CONTENT)) { writeManagementClientContent(writer, modelNode.get(MANAGEMENT_CLIENT_CONTENT)); writeNewLine(writer); } writer.writeEndElement(); writeNewLine(writer); writer.writeEndDocument(); }
void readDomainElement1_3( final XMLExtendedStreamReader reader, final ModelNode address, final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException { parseNamespaces(reader, address, list); // attributes readDomainElementAttributes_1_3(reader, expectedNs, address, list); // Content // Handle elements: sequence Element element = nextElement(reader, expectedNs); if (element == Element.EXTENSIONS) { extensionXml.parseExtensions(reader, address, expectedNs, list); element = nextElement(reader, expectedNs); } if (element == Element.SYSTEM_PROPERTIES) { parseSystemProperties(reader, address, expectedNs, list, false); element = nextElement(reader, expectedNs); } if (element == Element.PATHS) { parsePaths(reader, address, expectedNs, list, false); element = nextElement(reader, expectedNs); } if (element == Element.PROFILES) { parseProfiles(reader, address, expectedNs, list); element = nextElement(reader, expectedNs); } final Set<String> interfaceNames = new HashSet<String>(); if (element == Element.INTERFACES) { parseInterfaces(reader, interfaceNames, address, expectedNs, list, false); element = nextElement(reader, expectedNs); } if (element == Element.SOCKET_BINDING_GROUPS) { parseDomainSocketBindingGroups(reader, address, expectedNs, list, interfaceNames); element = nextElement(reader, expectedNs); } if (element == Element.DEPLOYMENTS) { parseDeployments( reader, address, expectedNs, list, EnumSet.of(Attribute.NAME, Attribute.RUNTIME_NAME), EnumSet.of(Element.CONTENT, Element.FS_ARCHIVE, Element.FS_EXPLODED)); element = nextElement(reader, expectedNs); } if (element == Element.SERVER_GROUPS) { parseServerGroups(reader, address, expectedNs, list); element = nextElement(reader, expectedNs); } if (element == Element.MANAGEMENT_CLIENT_CONTENT) { parseManagementClientContent(reader, address, expectedNs, list); element = nextElement(reader, expectedNs); } else if (element == null) { // Always add op(s) to set up management-client-content resources initializeRolloutPlans(address, list); } else { throw unexpectedElement(reader); } }
/** * Read the <server/> element based on version 1.1 of the schema. * * @param reader the xml stream reader * @param address address of the parent resource of any resources this method will add * @param list the list of boot operations to which any new operations should be added * @throws XMLStreamException if a parsing error occurs */ private void readServerElement_1_1( final Namespace namespace, final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException { parseNamespaces(reader, address, list); String serverName = null; // attributes final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { switch (Namespace.forUri(reader.getAttributeNamespace(i))) { case NONE: { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NAME: { serverName = value; break; } default: throw unexpectedAttribute(reader, i); } break; } case XML_SCHEMA_INSTANCE: { switch (Attribute.forName(reader.getAttributeLocalName(i))) { case SCHEMA_LOCATION: { parseSchemaLocations(reader, address, list, i); break; } case NO_NAMESPACE_SCHEMA_LOCATION: { // todo, jeez break; } default: { throw unexpectedAttribute(reader, i); } } break; } default: throw unexpectedAttribute(reader, i); } } setServerName(address, list, serverName); // elements - sequence Element element = nextElement(reader, namespace); if (element == Element.EXTENSIONS) { extensionXml.parseExtensions(reader, address, namespace, list); element = nextElement(reader, namespace); } // System properties if (element == Element.SYSTEM_PROPERTIES) { parseSystemProperties(reader, address, namespace, list, true); element = nextElement(reader, namespace); } if (element == Element.PATHS) { parsePaths(reader, address, namespace, list, true); element = nextElement(reader, namespace); } if (element == Element.VAULT) { switch (namespace) { // Less than 1.1 does not end up in this method case DOMAIN_1_1: case DOMAIN_1_2: case DOMAIN_1_3: case DOMAIN_1_4: case DOMAIN_1_5: case DOMAIN_2_0: case DOMAIN_2_1: { parseVault_1_1(reader, address, namespace, list); break; } default: { parseVault_3_0(reader, address, namespace, list); } } element = nextElement(reader, namespace); } // Single profile if (element == Element.PROFILE) { parseServerProfile(reader, address, list); element = nextElement(reader, namespace); } // Interfaces final Set<String> interfaceNames = new HashSet<String>(); if (element == Element.INTERFACES) { parseInterfaces(reader, interfaceNames, address, namespace, list, true); element = nextElement(reader, namespace); } // Single socket binding group if (element == Element.SOCKET_BINDING_GROUP) { parseSocketBindingGroup(reader, interfaceNames, address, namespace, list); element = nextElement(reader, namespace); } if (element != null) { throw unexpectedElement(reader); } }