private static void writeConnectorServices(XMLExtendedStreamWriter writer, ModelNode node) throws XMLStreamException { if (!node.isDefined()) { return; } List<Property> properties = node.asPropertyList(); if (!properties.isEmpty()) { writer.writeStartElement(Element.CONNECTOR_SERVICES.getLocalName()); for (final Property property : node.asPropertyList()) { writer.writeStartElement(Element.CONNECTOR_SERVICE.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName()); final ModelNode service = property.getValue(); for (AttributeDefinition attribute : ConnectorServiceDefinition.ATTRIBUTES) { attribute.marshallAsElement(property.getValue(), writer); } // TODO use a custom attribute marshaller if (service.hasDefined(CommonAttributes.PARAM)) { for (Property param : service.get(CommonAttributes.PARAM).asPropertyList()) { writer.writeEmptyElement(Element.PARAM.getLocalName()); writer.writeAttribute(Attribute.KEY.getLocalName(), param.getName()); writer.writeAttribute( Attribute.VALUE.getLocalName(), param.getValue().get(ConnectorServiceParamDefinition.VALUE.getName()).asString()); } } writer.writeEndElement(); } writer.writeEndElement(); writeNewLine(writer); } }
private static void writeTransportParam( final XMLExtendedStreamWriter writer, final ModelNode param) throws XMLStreamException { if (param.isDefined()) { for (final Property parameter : param.asPropertyList()) { writer.writeStartElement(Element.PARAM.getLocalName()); writer.writeAttribute(Attribute.KEY.getLocalName(), parameter.getName()); writer.writeAttribute( Attribute.VALUE.getLocalName(), parameter.getValue().get(TransportParamDefinition.VALUE.getName()).asString()); writer.writeEndElement(); } } }