use of org.jboss.dmr.Property in project wildfly by wildfly.
the class EESubsystemXmlPersister method writeManagedExecutorServices.
private void writeManagedExecutorServices(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException {
writer.writeStartElement(Element.MANAGED_EXECUTOR_SERVICES.getLocalName());
for (Property property : subModel.asPropertyList()) {
writer.writeStartElement(Element.MANAGED_EXECUTOR_SERVICE.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
for (SimpleAttributeDefinition ad : ManagedExecutorServiceResourceDefinition.ATTRIBUTES) {
ad.marshallAsAttribute(property.getValue(), writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class EESubsystemXmlPersister method writeManagedThreadFactories.
private void writeManagedThreadFactories(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException {
writer.writeStartElement(Element.MANAGED_THREAD_FACTORIES.getLocalName());
for (Property property : subModel.asPropertyList()) {
writer.writeStartElement(Element.MANAGED_THREAD_FACTORY.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
for (SimpleAttributeDefinition ad : ManagedThreadFactoryResourceDefinition.ATTRIBUTES) {
ad.marshallAsAttribute(property.getValue(), writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class EESubsystemXmlPersister method writeContextServices.
private void writeContextServices(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException {
writer.writeStartElement(Element.CONTEXT_SERVICES.getLocalName());
for (Property property : subModel.asPropertyList()) {
writer.writeStartElement(Element.CONTEXT_SERVICE.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
for (SimpleAttributeDefinition ad : ContextServiceResourceDefinition.ATTRIBUTES) {
ad.marshallAsAttribute(property.getValue(), writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class RemotingProfileAdd method createChannelOptionMap.
private OptionMap createChannelOptionMap(final OperationContext context, final ModelNode channelCreationOptionsNode) throws OperationFailedException {
final OptionMap optionMap;
if (channelCreationOptionsNode.isDefined()) {
final OptionMap.Builder optionMapBuilder = OptionMap.builder();
final ClassLoader loader = this.getClass().getClassLoader();
for (final Property optionProperty : channelCreationOptionsNode.asPropertyList()) {
final String name = optionProperty.getName();
final ModelNode propValueModel = optionProperty.getValue();
final String type = RemoteConnectorChannelCreationOptionResource.CHANNEL_CREATION_OPTION_TYPE.resolveModelAttribute(context, propValueModel).asString();
final String optionClassName = this.getClassNameForChannelOptionType(type);
final String fullyQualifiedOptionName = optionClassName + "." + name;
final Option option = Option.fromString(fullyQualifiedOptionName, loader);
final String value = RemoteConnectorChannelCreationOptionResource.CHANNEL_CREATION_OPTION_VALUE.resolveModelAttribute(context, propValueModel).asString();
optionMapBuilder.set(option, option.parseValue(value, loader));
}
optionMap = optionMapBuilder.getMap();
} else {
optionMap = OptionMap.EMPTY;
}
return optionMap;
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class TransformUtils method transformModel.
static ModelNode transformModel(final ModelNode legacyModel) {
final ModelNode model = new ModelNode();
for (Property property : legacyModel.asPropertyList()) {
String name = property.getName();
ModelNode legacyValue = property.getValue();
if (legacyValue.isDefined()) {
if (name.equals(JacORBSubsystemConstants.IOR_SETTINGS)) {
transformIorSettings(model, legacyValue);
continue;
}
final boolean expression;
final String expressionVariable;
if (legacyValue.getType() == ModelType.EXPRESSION) {
expression = true;
final Matcher matcher = Pattern.compile("\\A\\$\\{(.*):(.*)\\}\\Z").matcher(legacyValue.asExpression().getExpressionString());
if (matcher.find()) {
expressionVariable = matcher.group(1);
String abc = matcher.group(2);
legacyValue = new ModelNode(abc);
} else {
model.get(name).set(legacyValue);
continue;
}
} else {
expression = false;
expressionVariable = null;
}
ModelNode value;
switch(name) {
case JacORBSubsystemConstants.ORB_GIOP_MINOR_VERSION:
name = Constants.ORB_GIOP_VERSION;
value = new ModelNode(new StringBuilder().append("1.").append(legacyValue.asString()).toString());
break;
case JacORBSubsystemConstants.ORB_INIT_TRANSACTIONS:
if (legacyValue.asString().equals(JacORBSubsystemConstants.ON)) {
value = new ModelNode(Constants.FULL);
} else if (legacyValue.asString().equals(JacORBSubsystemConstants.OFF)) {
value = new ModelNode(Constants.NONE);
} else {
value = legacyValue;
}
break;
case JacORBSubsystemConstants.ORB_INIT_SECURITY:
if (legacyValue.asString().equals(JacORBSubsystemConstants.OFF)) {
value = new ModelNode(Constants.NONE);
} else {
value = legacyValue;
}
break;
case JacORBSubsystemConstants.SECURITY_SUPPORT_SSL:
case JacORBSubsystemConstants.SECURITY_ADD_COMP_VIA_INTERCEPTOR:
case JacORBSubsystemConstants.NAMING_EXPORT_CORBALOC:
case JacORBSubsystemConstants.INTEROP_IONA:
if (legacyValue.asString().equals(JacORBSubsystemConstants.ON)) {
value = ModelNode.TRUE;
} else {
value = ModelNode.FALSE;
}
break;
default:
value = legacyValue;
}
if (!value.asString().equals(JacORBSubsystemConstants.OFF)) {
if (expression) {
String newExpression = "${" + expressionVariable;
if (expressionVariable != null) {
newExpression += (":" + value.asString());
}
newExpression += "}";
value = new ModelNode(new ValueExpression(newExpression));
}
model.get(name).set(value);
}
}
}
if (!legacyModel.get(JacORBSubsystemConstants.ORB_SOCKET_BINDING).isDefined()) {
model.get(JacORBSubsystemConstants.ORB_SOCKET_BINDING).set(JacORBSubsystemDefinitions.ORB_SOCKET_BINDING.getDefaultValue());
}
return model;
}
Aggregations