private static void writeSingleElement(final XMLExtendedStreamWriter writer, final Element element, final Attribute attribute, final ModelNode subModel) throws XMLStreamException { writer.writeEmptyElement(element.getLocalName()); writeAttribute(writer, attribute, subModel.asString()); }
private static void writeSingleElement(final XMLExtendedStreamWriter writer, final Element element, final Attribute attribute, final ModelNode subModel) throws XMLStreamException { writer.writeEmptyElement(element.getLocalName()); writeAttribute(writer, attribute, subModel.asString()); }
private static void writeListAsMultipleElements(final XMLExtendedStreamWriter writer, final Element element, Attribute attribute, final ModelNode subModel) throws XMLStreamException { final List<ModelNode> list = subModel.asList(); for (final ModelNode node : list) { writer.writeEmptyElement(element.getLocalName()); writeAttribute(writer, attribute, node.asString()); } }
private static void writeListAsMultipleElements(final XMLExtendedStreamWriter writer, final Element element, Attribute attribute, final ModelNode subModel) throws XMLStreamException { final List<ModelNode> list = subModel.asList(); for (final ModelNode node : list) { writer.writeEmptyElement(element.getLocalName()); writeAttribute(writer, attribute, node.asString()); } }
protected static void writeContentItem(final XMLExtendedStreamWriter writer, final ModelNode contentItem) throws XMLStreamException { if (contentItem.has(HASH)) { writeElement(writer, Element.CONTENT); writeAttribute(writer, Attribute.SHA1, HashUtil.bytesToHexString(contentItem.require(HASH).asBytes())); writer.writeEndElement(); } else { if (contentItem.require(ARCHIVE).asBoolean()) { writeElement(writer, Element.FS_ARCHIVE); } else { writeElement(writer, Element.FS_EXPLODED); } writeAttribute(writer, Attribute.PATH, contentItem.require(PATH).asString()); if (contentItem.has(RELATIVE_TO)) writeAttribute(writer, Attribute.RELATIVE_TO, contentItem.require(RELATIVE_TO).asString()); writer.writeEndElement(); } }
protected static void writeContentItem(final XMLExtendedStreamWriter writer, final ModelNode contentItem) throws XMLStreamException { if (contentItem.has(HASH)) { writeElement(writer, Element.CONTENT); writeAttribute(writer, Attribute.SHA1, HashUtil.bytesToHexString(contentItem.require(HASH).asBytes())); writer.writeEndElement(); } else { if (contentItem.require(ARCHIVE).asBoolean()) { writeElement(writer, Element.FS_ARCHIVE); } else { writeElement(writer, Element.FS_EXPLODED); } writeAttribute(writer, Attribute.PATH, contentItem.require(PATH).asString()); if (contentItem.has(RELATIVE_TO)) writeAttribute(writer, Attribute.RELATIVE_TO, contentItem.require(RELATIVE_TO).asString()); writer.writeEndElement(); } }
final ModelNode contentItem = modelNode.get(uniqueName); writer.writeStartElement(Element.DEPLOYMENT_OVERLAY.getLocalName()); writeAttribute(writer, Attribute.NAME, uniqueName); final String content = HashUtil.bytesToHexString(overrideNode.require(CONTENT).asBytes()); writer.writeStartElement(Element.CONTENT.getLocalName()); writeAttribute(writer, Attribute.PATH, override); writeAttribute(writer, Attribute.CONTENT, content); writer.writeEndElement(); final ModelNode depNode = deployments.get(deploymentName); writer.writeStartElement(Element.DEPLOYMENT.getLocalName()); writeAttribute(writer, Attribute.NAME, deploymentName); writer.writeEndElement();
final ModelNode contentItem = modelNode.get(uniqueName); writer.writeStartElement(Element.DEPLOYMENT_OVERLAY.getLocalName()); writeAttribute(writer, Attribute.NAME, uniqueName); final String content = HashUtil.bytesToHexString(overrideNode.require(CONTENT).asBytes()); writer.writeStartElement(Element.CONTENT.getLocalName()); writeAttribute(writer, Attribute.PATH, override); writeAttribute(writer, Attribute.CONTENT, content); writer.writeEndElement(); final ModelNode depNode = deployments.get(deploymentName); writer.writeStartElement(Element.DEPLOYMENT.getLocalName()); writeAttribute(writer, Attribute.NAME, deploymentName); writer.writeEndElement();
protected void writeProperties(final XMLExtendedStreamWriter writer, final ModelNode modelNode, Element element, boolean standalone) throws XMLStreamException { final List<Property> properties = modelNode.asPropertyList(); if (properties.size() > 0) { writer.writeStartElement(element.getLocalName()); for (Property prop : properties) { writer.writeStartElement(Element.PROPERTY.getLocalName()); writeAttribute(writer, Attribute.NAME, prop.getName()); ModelNode sysProp = prop.getValue(); SystemPropertyResourceDefinition.VALUE.marshallAsAttribute(sysProp, writer); if (!standalone) { SystemPropertyResourceDefinition.BOOT_TIME.marshallAsAttribute(sysProp, writer); } writer.writeEndElement(); } writer.writeEndElement(); } }
protected void writeProperties(final XMLExtendedStreamWriter writer, final ModelNode modelNode, Element element, boolean standalone) throws XMLStreamException { final List<Property> properties = modelNode.asPropertyList(); if (properties.size() > 0) { writer.writeStartElement(element.getLocalName()); for (Property prop : properties) { writer.writeStartElement(Element.PROPERTY.getLocalName()); writeAttribute(writer, Attribute.NAME, prop.getName()); ModelNode sysProp = prop.getValue(); SystemPropertyResourceDefinition.VALUE.marshallAsAttribute(sysProp, writer); if (!standalone) { SystemPropertyResourceDefinition.BOOT_TIME.marshallAsAttribute(sysProp, writer); } writer.writeEndElement(); } writer.writeEndElement(); } }
/** * Write the interfaces including the criteria elements. * * @param writer the xml stream writer * @param modelNode the model * @throws XMLStreamException */ protected void writeInterfaces(final XMLExtendedStreamWriter writer, final ModelNode modelNode) throws XMLStreamException { writer.writeStartElement(Element.INTERFACES.getLocalName()); final Set<String> interfaces = modelNode.keys(); for (String ifaceName : interfaces) { final ModelNode iface = modelNode.get(ifaceName); writer.writeStartElement(Element.INTERFACE.getLocalName()); writeAttribute(writer, Attribute.NAME, ifaceName); // <any-* /> is just handled at the root if (iface.get(Element.ANY_ADDRESS.getLocalName()).asBoolean(false)) { writer.writeEmptyElement(Element.ANY_ADDRESS.getLocalName()); } else if (iface.get(Element.ANY_IPV4_ADDRESS.getLocalName()).asBoolean(false)) { writer.writeEmptyElement(Element.ANY_IPV4_ADDRESS.getLocalName()); } else if (iface.get(Element.ANY_IPV6_ADDRESS.getLocalName()).asBoolean(false)) { writer.writeEmptyElement(Element.ANY_IPV6_ADDRESS.getLocalName()); } else { // Write the other criteria elements writeInterfaceCriteria(writer, iface, false); } writer.writeEndElement(); } writer.writeEndElement(); }
/** * Write the interfaces including the criteria elements. * * @param writer the xml stream writer * @param modelNode the model * @throws XMLStreamException */ protected void writeInterfaces(final XMLExtendedStreamWriter writer, final ModelNode modelNode) throws XMLStreamException { writer.writeStartElement(Element.INTERFACES.getLocalName()); final Set<String> interfaces = modelNode.keys(); for (String ifaceName : interfaces) { final ModelNode iface = modelNode.get(ifaceName); writer.writeStartElement(Element.INTERFACE.getLocalName()); writeAttribute(writer, Attribute.NAME, ifaceName); // <any-* /> is just handled at the root if (iface.get(Element.ANY_ADDRESS.getLocalName()).asBoolean(false)) { writer.writeEmptyElement(Element.ANY_ADDRESS.getLocalName()); } else if (iface.get(Element.ANY_IPV4_ADDRESS.getLocalName()).asBoolean(false)) { writer.writeEmptyElement(Element.ANY_IPV4_ADDRESS.getLocalName()); } else if (iface.get(Element.ANY_IPV6_ADDRESS.getLocalName()).asBoolean(false)) { writer.writeEmptyElement(Element.ANY_IPV6_ADDRESS.getLocalName()); } else { // Write the other criteria elements writeInterfaceCriteria(writer, iface, false); } writer.writeEndElement(); } writer.writeEndElement(); }
ModelNode binding = bindings.get(bindingName); writer.writeStartElement(Element.SOCKET_BINDING.getLocalName()); writeAttribute(writer, Attribute.NAME, bindingName); AbstractSocketBindingResourceDefinition.INTERFACE.marshallAsAttribute(binding, writer); AbstractSocketBindingResourceDefinition.PORT.marshallAsAttribute(binding, writer); writeAttribute(writer, Attribute.NAME, outboundSocketBindingName); writeAttribute(writer, Attribute.NAME, outboundSocketBindingName);
ModelNode binding = bindings.get(bindingName); writer.writeStartElement(Element.SOCKET_BINDING.getLocalName()); writeAttribute(writer, Attribute.NAME, bindingName); AbstractSocketBindingResourceDefinition.INTERFACE.marshallAsAttribute(binding, writer); AbstractSocketBindingResourceDefinition.PORT.marshallAsAttribute(binding, writer); writeAttribute(writer, Attribute.NAME, outboundSocketBindingName); writeAttribute(writer, Attribute.NAME, outboundSocketBindingName);