use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class MessagingXMLWriter method writeTopics.
private static void writeTopics(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException {
if (!node.isDefined()) {
return;
}
if (node.asInt() > 0) {
for (String name : node.keys()) {
final ModelNode topic = node.get(name);
if (topic.isDefined()) {
writer.writeStartElement(Element.JMS_TOPIC.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), name);
for (AttributeDefinition attribute : JMSTopicDefinition.ATTRIBUTES) {
attribute.marshallAsElement(topic, writer);
}
writer.writeEndElement();
}
}
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class MessagingXMLWriter method writeJmsBridge.
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();
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class MessagingXMLWriter method writeConnectionFactories.
private static void writeConnectionFactories(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException {
if (!node.isDefined()) {
return;
}
if (node.asInt() > 0) {
for (String name : node.keys()) {
final ModelNode factory = node.get(name);
if (factory.isDefined()) {
writer.writeStartElement(Element.CONNECTION_FACTORY.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), name);
for (AttributeDefinition attribute : ConnectionFactoryDefinition.ATTRIBUTES) {
attribute.marshallAsElement(factory, writer);
}
writer.writeEndElement();
}
}
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class MessagingXMLWriter method writeConnectorServices.
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);
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class MessagingXMLWriter method writeBroadcastGroups.
private static void writeBroadcastGroups(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException {
if (!node.isDefined()) {
return;
}
List<Property> properties = node.asPropertyList();
if (!properties.isEmpty()) {
writer.writeStartElement(Element.BROADCAST_GROUPS.getLocalName());
for (final Property property : properties) {
writer.writeStartElement(Element.BROADCAST_GROUP.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
for (AttributeDefinition attribute : BroadcastGroupDefinition.ATTRIBUTES) {
attribute.marshallAsElement(property.getValue(), writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
writeNewLine(writer);
}
}
Aggregations