use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class JacORBSubsystemParser method parseORBInitializersConfig_1_0.
/**
* <p>
* Parses the ORB {@code initializers} section of the JacORB subsystem configuration according to the XSD version 1.0.
* </p>
*
* @param reader the {@code XMLExtendedStreamReader} used to read the configuration XML.
* @param node the {@code ModelNode} that will hold the parsed ORB initializers configuration.
* @throws javax.xml.stream.XMLStreamException
* if an error occurs while parsing the XML.
*/
private void parseORBInitializersConfig_1_0(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException {
requireNoAttributes(reader);
// read the element text - a comma-separated list of initializers.
String initializersList = reader.getElementText();
if (initializersList != null) {
String[] initializers = initializersList.split(",");
// read each configured initializer and set the appropriate values in the model node.
for (String initializer : initializers) {
SimpleAttributeDefinition definition = (SimpleAttributeDefinition) JacORBSubsystemDefinitions.valueOf(initializer);
if (definition != null && JacORBSubsystemDefinitions.ORB_INIT_ATTRIBUTES.contains(definition))
node.get(definition.getName()).set(JacORBSubsystemConstants.ON);
else
throw JacORBLogger.ROOT_LOGGER.invalidInitializerConfig(initializer, reader.getLocation());
}
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class Messaging13SubsystemParser method handleSingleAttribute.
static void handleSingleAttribute(final XMLExtendedStreamReader reader, final Element element, final String modelName, String attributeName, final ModelNode node) throws XMLStreamException {
AttributeDefinition attributeDefinition = element.getDefinition(modelName);
final String value = readStringAttributeElement(reader, attributeName);
if (attributeDefinition instanceof SimpleAttributeDefinition) {
((SimpleAttributeDefinition) attributeDefinition).parseAndSetParameter(value, node, reader);
} else if (attributeDefinition instanceof ListAttributeDefinition) {
((ListAttributeDefinition) attributeDefinition).parseAndAddParameterElement(value, node, reader);
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class QueueDefinition method registerAttributes.
@Override
public void registerAttributes(ManagementResourceRegistration registry) {
super.registerAttributes(registry);
for (SimpleAttributeDefinition attr : ATTRIBUTES) {
if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) {
if (isRuntime()) {
AttributeDefinition readOnlyRuntimeAttr = create(attr).setStorageRuntime().build();
registry.registerReadOnlyAttribute(readOnlyRuntimeAttr, QueueReadAttributeHandler.RUNTIME_INSTANCE);
} else {
registry.registerReadOnlyAttribute(attr, null);
}
}
}
for (AttributeDefinition attr : READONLY_ATTRIBUTES) {
registry.registerReadOnlyAttribute(attr, QueueReadAttributeHandler.INSTANCE);
}
for (AttributeDefinition metric : METRICS) {
registry.registerMetric(metric, QueueReadAttributeHandler.INSTANCE);
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class SecurityRoleDefinition method registerAttributes.
@Override
public void registerAttributes(ManagementResourceRegistration registry) {
super.registerAttributes(registry);
if (runtimeOnly) {
for (SimpleAttributeDefinition attr : ATTRIBUTES) {
AttributeDefinition readOnlyAttr = SimpleAttributeDefinitionBuilder.create(attr).setStorageRuntime().build();
registry.registerReadOnlyAttribute(readOnlyAttr, SecurityRoleReadAttributeHandler.INSTANCE);
}
} else {
for (AttributeDefinition attr : ATTRIBUTES) {
if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) {
registry.registerReadWriteAttribute(attr, null, SecurityRoleAttributeHandler.INSTANCE);
}
}
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class ExternalPooledConnectionFactoryDefinition method copy.
private static AttributeDefinition copy(AttributeDefinition attribute, AttributeAccess.Flag flag) {
AbstractAttributeDefinitionBuilder builder;
if (attribute instanceof SimpleListAttributeDefinition) {
builder = new SimpleListAttributeDefinition.Builder((SimpleListAttributeDefinition) attribute);
} else if (attribute instanceof SimpleMapAttributeDefinition) {
builder = new SimpleMapAttributeDefinition.Builder((SimpleMapAttributeDefinition) attribute);
} else if (attribute instanceof PrimitiveListAttributeDefinition) {
builder = new PrimitiveListAttributeDefinition.Builder((PrimitiveListAttributeDefinition) attribute);
} else {
builder = new SimpleAttributeDefinitionBuilder((SimpleAttributeDefinition) attribute);
}
builder.setFlags(flag);
return builder.build();
}
Aggregations