use of org.jboss.dmr.Property in project wildfly by wildfly.
the class MigrateOperation method migrateConnectorAttribute.
private void migrateConnectorAttribute(ModelNode addOperation) {
ModelNode connector = addOperation.get(CONNECTOR);
if (connector.isDefined()) {
// legacy connector is a property list where the name is the connector and the value is undefined
List<Property> connectorProps = connector.asPropertyList();
for (Property connectorProp : connectorProps) {
addOperation.get("connectors").add(connectorProp.getName());
}
addOperation.remove(CONNECTOR);
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class MigrateOperation method migrateBroadcastGroup.
private void migrateBroadcastGroup(ModelNode newAddOp, List<String> warnings) {
// These attributes are not present in the messaging-activemq subsystem.
// Instead a socket-binding must be used to configure the broadcast-group.
final Collection<String> unmigratedProperties = asList(LOCAL_BIND_ADDRESS.getName(), LOCAL_BIND_PORT.getName(), GROUP_ADDRESS.getName(), GROUP_PORT.getName());
for (Property property : newAddOp.asPropertyList()) {
if (unmigratedProperties.contains(property.getName())) {
warnings.add(ROOT_LOGGER.couldNotMigrateBroadcastGroupAttribute(property.getName(), pathAddress(newAddOp.get(OP_ADDR))));
}
}
boolean clearOp = false;
if (!newAddOp.hasDefined(CONNECTORS)) {
warnings.add(ROOT_LOGGER.couldNotMigrateBroadcastGroupWithoutConnectors(pathAddress(newAddOp.get(OP_ADDR))));
clearOp = true;
}
// These attributes no longer accept expressions in the messaging-activemq subsystem.
removePropertiesWithExpression(newAddOp, warnings, JGROUPS_CHANNEL.getName(), JGROUPS_STACK.getName());
if (!newAddOp.hasDefined(SOCKET_BINDING.getName())) {
if (!newAddOp.hasDefined(JGROUPS_CHANNEL.getName())) {
warnings.add(ROOT_LOGGER.couldNotMigrateBroadcastGroup(pathAddress(newAddOp.get(OP_ADDR))));
clearOp = true;
} else {
newAddOp.get("jgroups-cluster").set(newAddOp.get(JGROUPS_CHANNEL.getName()));
}
}
if (clearOp) {
newAddOp.clear();
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class MigrateOperation method connectionFactoryIsUsingInVMConnectors.
private boolean connectionFactoryIsUsingInVMConnectors(OperationContext context, ModelNode connectionFactoryAddOp) {
ModelNode connector = connectionFactoryAddOp.get(CONNECTOR);
if (connector.isDefined()) {
PathAddress connectionFactoryAddress = pathAddress(connectionFactoryAddOp.get(OP_ADDR));
PathElement relativeLegacyServerAddress = connectionFactoryAddress.getParent().getLastElement();
// read the server resource related to the context current address (which is the messaging subsystem address).
Resource serverResource = context.readResource(pathAddress(relativeLegacyServerAddress), false);
Set<String> definedInVMConnectors = serverResource.getChildrenNames("in-vm-connector");
// legacy connector is a property list where the name is the connector and the value is undefined
List<Property> connectorProps = connector.asPropertyList();
for (Property connectorProp : connectorProps) {
String connectorName = connectorProp.getName();
if (definedInVMConnectors.contains(connectorName)) {
return true;
}
}
}
return false;
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class JacORBSubsystemAdd method getConfigurationProperties.
@Override
protected Properties getConfigurationProperties(OperationContext context, ModelNode model) throws OperationFailedException {
Properties props = new Properties();
// get the configuration properties from the attribute definitions.
for (AttributeDefinition attrDefinition : JacORBSubsystemDefinitions.SUBSYSTEM_ATTRIBUTES) {
if (JacORBSubsystemDefinitions.ON_OFF_ATTRIBUTES_TO_REJECT.contains(attrDefinition) || JacORBSubsystemDefinitions.ATTRIBUTES_TO_REJECT.contains(attrDefinition)) {
continue;
}
ModelNode resolvedModelAttribute = attrDefinition.resolveModelAttribute(context, model);
if (resolvedModelAttribute.isDefined()) {
String name = attrDefinition.getName();
String value = resolvedModelAttribute.asString();
String openjdkProperty = PropertiesMap.PROPS_MAP.get(name);
if (openjdkProperty != null) {
name = openjdkProperty;
}
props.setProperty(name, value);
}
}
// check if the node contains a list of generic properties.
if (model.hasDefined(JacORBSubsystemConstants.PROPERTIES)) {
ModelNode propertiesNode = model.get(JacORBSubsystemConstants.PROPERTIES);
for (Property property : propertiesNode.asPropertyList()) {
String name = property.getName();
ModelNode value = property.getValue();
props.setProperty(name, value.asString());
}
}
return props;
}
use of org.jboss.dmr.Property 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);
}
}
Aggregations