private void writeJmsBridge(XMLExtendedStreamWriter writer, String bridgeName, ModelNode value) throws XMLStreamException { writer.writeStartElement(Element.JMS_BRIDGE.getLocalName()); if (!DEFAULT.equals(bridgeName)) { writer.writeAttribute(Attribute.NAME.getLocalName(), bridgeName); } JMSBridgeDefinition.MODULE.marshallAsAttribute(value, writer); writer.writeStartElement(SOURCE.getLocalName()); for (AttributeDefinition attr : JMSBridgeDefinition.JMS_SOURCE_ATTRIBUTES) { attr.marshallAsElement(value, writer); } writer.writeEndElement(); writer.writeStartElement(TARGET.getLocalName()); for (AttributeDefinition attr : JMSBridgeDefinition.JMS_TARGET_ATTRIBUTES) { attr.marshallAsElement(value, writer); } writer.writeEndElement(); for (AttributeDefinition attr : JMSBridgeDefinition.JMS_BRIDGE_ATTRIBUTES) { if (attr == JMSBridgeDefinition.MODULE) { // handled as a XML attribute continue; } attr.marshallAsElement(value, writer); } writer.writeEndElement(); }
private static void writeHornetQServer( final XMLExtendedStreamWriter writer, final String serverName, final ModelNode node) throws XMLStreamException { writer.writeStartElement(Element.HORNETQ_SERVER.getLocalName()); if (!DEFAULT.equals(serverName)) { writer.writeAttribute(Attribute.NAME.getLocalName(), serverName); } for (AttributeDefinition simpleAttribute : CommonAttributes.SIMPLE_ROOT_RESOURCE_ATTRIBUTES) { simpleAttribute.marshallAsElement(node, writer); } final ModelNode paths = node.get(ModelDescriptionConstants.PATH); writeDirectory(writer, Element.PAGING_DIRECTORY, paths); writeDirectory(writer, Element.BINDINGS_DIRECTORY, paths); writeDirectory(writer, Element.JOURNAL_DIRECTORY, paths); writeDirectory(writer, Element.LARGE_MESSAGES_DIRECTORY, paths); // New line after the simpler elements writeNewLine(writer); writeConnectors(writer, node); writeAcceptors(writer, node); writeBroadcastGroups(writer, node.get(BROADCAST_GROUP)); writeDiscoveryGroups(writer, node.get(DISCOVERY_GROUP)); writeDiverts(writer, node.get(DIVERT)); writeQueues(writer, node.get(CommonAttributes.QUEUE)); writeBridges(writer, node.get(CommonAttributes.BRIDGE)); writeClusterConnections(writer, node.get(CommonAttributes.CLUSTER_CONNECTION)); writeGroupingHandler(writer, node.get(GROUPING_HANDLER)); writeSecuritySettings(writer, node.get(CommonAttributes.SECURITY_SETTING)); writeAddressSettings(writer, node.get(ADDRESS_SETTING)); writeConnectorServices(writer, node.get(CommonAttributes.CONNECTOR_SERVICE)); if (node.hasDefined(CONNECTION_FACTORY) || node.hasDefined(POOLED_CONNECTION_FACTORY)) { ModelNode cf = node.get(CONNECTION_FACTORY); ModelNode pcf = node.get(POOLED_CONNECTION_FACTORY); boolean hasCf = cf.isDefined() && cf.keys().size() > 0; boolean hasPcf = pcf.isDefined() && pcf.keys().size() > 0; if (hasCf || hasPcf) { writer.writeStartElement(JMS_CONNECTION_FACTORIES); writeConnectionFactories(writer, cf); writePooledConnectionFactories(writer, pcf); writer.writeEndElement(); writeNewLine(writer); } } if (node.hasDefined(JMS_QUEUE) || node.hasDefined(JMS_TOPIC)) { ModelNode queue = node.get(JMS_QUEUE); ModelNode topic = node.get(JMS_TOPIC); boolean hasQueue = queue.isDefined() && queue.keys().size() > 0; boolean hasTopic = topic.isDefined() && topic.keys().size() > 0; if (hasQueue || hasTopic) { writer.writeStartElement(JMS_DESTINATIONS); writeJmsQueues(writer, node.get(JMS_QUEUE)); writeTopics(writer, node.get(JMS_TOPIC)); writer.writeEndElement(); } } writer.writeEndElement(); }