use of org.jboss.dmr.Property in project wildfly by wildfly.
the class EJB3SubsystemXMLPersister method writeChannelCreationOptions.
private void writeChannelCreationOptions(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException {
writer.writeStartElement(EJB3SubsystemXMLElement.CHANNEL_CREATION_OPTIONS.getLocalName());
for (final Property optionPropertyModelNode : node.asPropertyList()) {
writer.writeStartElement(EJB3SubsystemXMLElement.OPTION.getLocalName());
writer.writeAttribute(EJB3SubsystemXMLAttribute.NAME.getLocalName(), optionPropertyModelNode.getName());
final ModelNode propertyValueModelNode = optionPropertyModelNode.getValue();
RemoteConnectorChannelCreationOptionResource.CHANNEL_CREATION_OPTION_VALUE.marshallAsAttribute(propertyValueModelNode, writer);
RemoteConnectorChannelCreationOptionResource.CHANNEL_CREATION_OPTION_TYPE.marshallAsAttribute(propertyValueModelNode, writer);
writer.writeEndElement();
}
writer.writeEndElement();
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class EJB3SubsystemXMLPersister method writeCaches.
private void writeCaches(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException {
List<Property> caches = model.get(EJB3SubsystemModel.CACHE).asPropertyList();
for (Property property : caches) {
writer.writeStartElement(EJB3SubsystemXMLElement.CACHE.getLocalName());
ModelNode cache = property.getValue();
writer.writeAttribute(EJB3SubsystemXMLAttribute.NAME.getLocalName(), property.getName());
CacheFactoryResourceDefinition.PASSIVATION_STORE.marshallAsAttribute(cache, writer);
writeAttribute(writer, cache, CacheFactoryResourceDefinition.ALIASES);
writer.writeEndElement();
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class ConfigurationHelper method addGroupingHandlerConfiguration.
static void addGroupingHandlerConfiguration(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 PartitionManagerResourceDefinition method configureIdentityStore.
private static void configureIdentityStore(OperationContext context, ModelNode modelNode) throws OperationFailedException {
Property prop = modelNode.asProperty();
String storeType = prop.getName();
ModelNode identityStore = prop.getValue().asProperty().getValue();
if (storeType.equals(LDAP_STORE.getName())) {
if (!identityStore.hasDefined(LDAP_STORE_MAPPING.getName())) {
throw ROOT_LOGGER.idmLdapNoMappingDefined();
}
}
validateSupportedTypes(context, identityStore);
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class PartitionManagerResourceDefinition method validateSupportedTypes.
private static void validateSupportedTypes(OperationContext context, ModelNode identityStore) throws OperationFailedException {
boolean hasSupportedType = identityStore.hasDefined(SUPPORTED_TYPES.getName());
if (hasSupportedType) {
ModelNode featuresSetNode = identityStore.get(SUPPORTED_TYPES.getName()).asProperty().getValue();
try {
ModelNode supportsAllNode = SupportedTypesResourceDefinition.SUPPORTS_ALL.resolveModelAttribute(context, featuresSetNode);
hasSupportedType = supportsAllNode.asBoolean();
} catch (OperationFailedException ofe) {
if (featuresSetNode.get(SupportedTypesResourceDefinition.SUPPORTS_ALL.getName()).getType() == ModelType.EXPRESSION) {
// We just tried to resolve an expression is Stage.MODEL. That's not reliable.
// Just assume it would resolve to true and don't fail validation.
// If it's invalid it will be caught on a server
hasSupportedType = true;
} else {
throw ofe;
}
}
if (featuresSetNode.hasDefined(SUPPORTED_TYPE.getName())) {
for (Property supportedTypeNode : featuresSetNode.get(SUPPORTED_TYPE.getName()).asPropertyList()) {
ModelNode supportedType = supportedTypeNode.getValue();
if (!supportedType.hasDefined(SupportedTypeResourceDefinition.CLASS_NAME.getName()) && !supportedType.hasDefined(SupportedTypeResourceDefinition.CODE.getName())) {
throw ROOT_LOGGER.typeNotProvided(SUPPORTED_TYPE.getName());
}
hasSupportedType = true;
}
}
}
if (!hasSupportedType) {
throw ROOT_LOGGER.idmNoSupportedTypesDefined();
}
}
Aggregations