use of org.jboss.dmr.Property 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);
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class MessagingXMLWriter method writeTransportParam.
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();
}
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class MessagingXMLWriter method writeAddressSettings.
private static void writeAddressSettings(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException {
if (!node.isDefined()) {
return;
}
List<Property> properties = node.asPropertyList();
if (!properties.isEmpty()) {
writer.writeStartElement(Element.ADDRESS_SETTINGS.getLocalName());
for (Property matchSetting : properties) {
writer.writeStartElement(Element.ADDRESS_SETTING.getLocalName());
writer.writeAttribute(Attribute.MATCH.getLocalName(), matchSetting.getName());
final ModelNode setting = matchSetting.getValue();
for (AttributeDefinition attribute : AddressSettingDefinition.ATTRIBUTES) {
attribute.marshallAsElement(setting, writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
writeNewLine(writer);
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class TransportConfigOperationHandlers method processConnectors.
/**
* Process the connector information.
*
* @param context the operation context
* @param configuration the ActiveMQ configuration
* @param params the detyped operation parameters
* @param bindings the referenced socket bindings
* @throws OperationFailedException
*/
static Map<String, TransportConfiguration> processConnectors(final OperationContext context, final String configServerName, final ModelNode params, final Set<String> bindings) throws OperationFailedException {
final Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
if (params.hasDefined(CONNECTOR)) {
for (final Property property : params.get(CONNECTOR).asPropertyList()) {
final String connectorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, CONNECTORS_KEYS_MAP);
final Map<String, Object> extraParameters = getExtraParameters(TransportConstants.ALLOWABLE_CONNECTOR_KEYS, parameters);
ModelNode socketBinding = GenericTransportDefinition.SOCKET_BINDING.resolveModelAttribute(context, config);
if (socketBinding.isDefined()) {
bindings.add(socketBinding.asString());
// uses the parameters to pass the socket binding name that will be read in ActiveMQServerService.start()
parameters.put(GenericTransportDefinition.SOCKET_BINDING.getName(), socketBinding.asString());
}
final String clazz = FACTORY_CLASS.resolveModelAttribute(context, config).asString();
connectors.put(connectorName, new TransportConfiguration(clazz, parameters, connectorName, extraParameters));
}
}
if (params.hasDefined(REMOTE_CONNECTOR)) {
for (final Property property : params.get(REMOTE_CONNECTOR).asPropertyList()) {
final String connectorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, CONNECTORS_KEYS_MAP);
final Map<String, Object> extraParameters = getExtraParameters(TransportConstants.ALLOWABLE_CONNECTOR_KEYS, parameters);
final String binding = config.get(RemoteTransportDefinition.SOCKET_BINDING.getName()).asString();
bindings.add(binding);
// uses the parameters to pass the socket binding name that will be read in ActiveMQServerService.start()
parameters.put(RemoteTransportDefinition.SOCKET_BINDING.getName(), binding);
connectors.put(connectorName, new TransportConfiguration(NettyConnectorFactory.class.getName(), parameters, connectorName, extraParameters));
}
}
if (params.hasDefined(IN_VM_CONNECTOR)) {
for (final Property property : params.get(IN_VM_CONNECTOR).asPropertyList()) {
final String connectorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, CONNECTORS_KEYS_MAP);
final Map<String, Object> extraParameters = getExtraParameters(IN_VM_ALLOWABLE_KEYS, parameters);
parameters.put(CONNECTORS_KEYS_MAP.get(InVMTransportDefinition.SERVER_ID.getName()), InVMTransportDefinition.SERVER_ID.resolveModelAttribute(context, config).asInt());
connectors.put(connectorName, new TransportConfiguration(InVMConnectorFactory.class.getName(), parameters, connectorName, extraParameters));
}
}
if (params.hasDefined(HTTP_CONNECTOR)) {
for (final Property property : params.get(HTTP_CONNECTOR).asPropertyList()) {
final String connectorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, CONNECTORS_KEYS_MAP);
final Map<String, Object> extraParameters = getExtraParameters(TransportConstants.ALLOWABLE_CONNECTOR_KEYS, parameters);
final String binding = HTTPConnectorDefinition.SOCKET_BINDING.resolveModelAttribute(context, config).asString();
bindings.add(binding);
// ARTEMIS-803 Artemis knows that is must not offset the HTTP port when it is used by colocated backups
parameters.put(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, true);
parameters.put(TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME, HTTPConnectorDefinition.ENDPOINT.resolveModelAttribute(context, config).asString());
// uses the parameters to pass the socket binding name that will be read in ActiveMQServerService.start()
parameters.put(HTTPConnectorDefinition.SOCKET_BINDING.getName(), binding);
ModelNode serverNameModelNode = HTTPConnectorDefinition.SERVER_NAME.resolveModelAttribute(context, config);
// use the name of this server if the server-name attribute is undefined
String serverName = serverNameModelNode.isDefined() ? serverNameModelNode.asString() : configServerName;
parameters.put(ACTIVEMQ_SERVER_NAME, serverName);
connectors.put(connectorName, new TransportConfiguration(NettyConnectorFactory.class.getName(), parameters, connectorName, extraParameters));
}
}
return connectors;
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class ModClusterSubsystemXMLWriter method writeProxy.
@SuppressWarnings("deprecation")
private static void writeProxy(XMLExtendedStreamWriter writer, String name, ModelNode model) throws XMLStreamException {
writer.writeStartElement(XMLElement.PROXY.getLocalName());
writer.writeAttribute(XMLAttribute.NAME.getLocalName(), name);
writeAttributes(writer, model, ProxyConfigurationResourceDefinition.Attribute.class);
if (model.get(SimpleLoadProviderResourceDefinition.PATH.getKeyValuePair()).isDefined()) {
ModelNode loadProviderModel = model.get(SimpleLoadProviderResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.SIMPLE_LOAD_PROVIDER.getLocalName());
writeAttributes(writer, loadProviderModel, SimpleLoadProviderResourceDefinition.Attribute.class);
writer.writeEndElement();
}
if (model.get(DynamicLoadProviderResourceDefinition.PATH.getKeyValuePair()).isDefined()) {
ModelNode loadProviderModel = model.get(DynamicLoadProviderResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.DYNAMIC_LOAD_PROVIDER.getLocalName());
writeAttributes(writer, loadProviderModel, DynamicLoadProviderResourceDefinition.Attribute.class);
if (loadProviderModel.hasDefined(LoadMetricResourceDefinition.WILDCARD_PATH.getKey())) {
for (Property prop : loadProviderModel.get(LoadMetricResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
ModelNode metricModel = prop.getValue();
writer.writeStartElement(XMLElement.LOAD_METRIC.getLocalName());
writeAttributes(writer, metricModel, LoadMetricResourceDefinition.Attribute.class);
writeAttributes(writer, metricModel, LoadMetricResourceDefinition.SharedAttribute.class);
writer.writeEndElement();
}
}
if (loadProviderModel.hasDefined(CustomLoadMetricResourceDefinition.WILDCARD_PATH.getKey())) {
for (Property prop : loadProviderModel.get(CustomLoadMetricResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
ModelNode customMetricModel = prop.getValue();
writer.writeStartElement(XMLElement.CUSTOM_LOAD_METRIC.getLocalName());
writeAttributes(writer, customMetricModel, CustomLoadMetricResourceDefinition.Attribute.class);
writeAttributes(writer, customMetricModel, LoadMetricResourceDefinition.SharedAttribute.class);
writer.writeEndElement();
}
}
writer.writeEndElement();
}
if (model.get(SSLResourceDefinition.PATH.getKeyValuePair()).isDefined()) {
writer.writeStartElement(XMLElement.SSL.getLocalName());
writeAttributes(writer, model.get(SSLResourceDefinition.PATH.getKeyValuePair()), EnumSet.allOf(SSLResourceDefinition.Attribute.class));
writer.writeEndElement();
}
writer.writeEndElement();
}
Aggregations