use of org.jboss.dmr.Property in project wildfly by wildfly.
the class ServerAdd method processSecuritySettings.
/**
* Process the security settings.
*
* @param configuration the ActiveMQ configuration
* @param params the detyped operation parameters
*/
static void processSecuritySettings(final OperationContext context, final Configuration configuration, final ModelNode params) throws OperationFailedException {
if (params.get(SECURITY_SETTING).isDefined()) {
for (final Property property : params.get(SECURITY_SETTING).asPropertyList()) {
final String match = property.getName();
final ModelNode config = property.getValue();
if (config.hasDefined(CommonAttributes.ROLE)) {
final Set<Role> roles = new HashSet<Role>();
for (final Property role : config.get(CommonAttributes.ROLE).asPropertyList()) {
roles.add(SecurityRoleDefinition.transform(context, role.getName(), role.getValue()));
}
configuration.getSecurityRoles().put(match, roles);
}
}
}
}
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 void processConnectors(final OperationContext context, final Configuration configuration, 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);
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));
}
}
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 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));
}
}
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);
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));
}
}
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 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() : configuration.getName();
parameters.put(ACTIVEMQ_SERVER_NAME, serverName);
connectors.put(connectorName, new TransportConfiguration(NettyConnectorFactory.class.getName(), parameters, connectorName));
}
}
configuration.setConnectorConfigurations(connectors);
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class GroupingHandlerAdd method addGroupingHandlerConfig.
static void addGroupingHandlerConfig(final OperationContext context, final Configuration configuration, final ModelNode model) throws OperationFailedException {
if (model.hasDefined(CommonAttributes.GROUPING_HANDLER)) {
final Property prop = model.get(CommonAttributes.GROUPING_HANDLER).asProperty();
final String name = prop.getName();
final ModelNode node = prop.getValue();
final GroupingHandlerConfiguration.TYPE type = GroupingHandlerConfiguration.TYPE.valueOf(GroupingHandlerDefinition.TYPE.resolveModelAttribute(context, node).asString());
final String address = GROUPING_HANDLER_ADDRESS.resolveModelAttribute(context, node).asString();
final int timeout = TIMEOUT.resolveModelAttribute(context, node).asInt();
final long groupTimeout = GROUP_TIMEOUT.resolveModelAttribute(context, node).asLong();
final long reaperPeriod = REAPER_PERIOD.resolveModelAttribute(context, node).asLong();
final GroupingHandlerConfiguration conf = new GroupingHandlerConfiguration().setName(SimpleString.toSimpleString(name)).setType(type).setAddress(SimpleString.toSimpleString(address)).setTimeout(timeout).setGroupTimeout(groupTimeout).setReaperPeriod(reaperPeriod);
configuration.setGroupingHandlerConfiguration(conf);
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class BroadcastGroupAdd method addBroadcastGroupConfigs.
static void addBroadcastGroupConfigs(final OperationContext context, final Configuration configuration, final ModelNode model) throws OperationFailedException {
if (model.hasDefined(CommonAttributes.BROADCAST_GROUP)) {
final List<BroadcastGroupConfiguration> configs = configuration.getBroadcastGroupConfigurations();
final Set<String> connectors = configuration.getConnectorConfigurations().keySet();
for (Property prop : model.get(CommonAttributes.BROADCAST_GROUP).asPropertyList()) {
configs.add(createBroadcastGroupConfiguration(context, connectors, prop.getName(), prop.getValue()));
}
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class IdentityProviderAddHandler method restartTrustDomains.
private static void restartTrustDomains(String identityProviderName, ModelNode modelNode, OperationContext context) {
if (modelNode.hasDefined(ModelElement.IDENTITY_PROVIDER_TRUST_DOMAIN.getName())) {
for (Property handlerProperty : modelNode.get(ModelElement.IDENTITY_PROVIDER_TRUST_DOMAIN.getName()).asPropertyList()) {
String domainName = handlerProperty.getName();
TrustDomainAddHandler.restartServices(context, identityProviderName, domainName);
}
}
}
Aggregations