use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class StatisticsResourceDefinition method getAttributesFromPlugin.
public static List<AttributeDefinition> getAttributesFromPlugin(StatisticsPlugin plugin) {
LinkedList<AttributeDefinition> result = new LinkedList<>();
for (String name : plugin.getNames()) {
ModelType modelType = ModelType.STRING;
if (plugin.getType(name) == int.class) {
modelType = ModelType.INT;
}
if (plugin.getType(name) == long.class) {
modelType = ModelType.LONG;
}
SimpleAttributeDefinition attribute = new SimpleAttributeDefinitionBuilder(name, modelType).setRequired(false).setStorageRuntime().build();
result.add(attribute);
}
return result;
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class EESubsystemXmlPersister method writeDefaultBindingsElement.
private void writeDefaultBindingsElement(XMLExtendedStreamWriter writer, ModelNode eeSubSystem) throws XMLStreamException {
if (eeSubSystem.hasDefined(EESubsystemModel.SERVICE) && eeSubSystem.get(EESubsystemModel.SERVICE).hasDefined(EESubsystemModel.DEFAULT_BINDINGS)) {
ModelNode defaultBindingsNode = eeSubSystem.get(EESubsystemModel.SERVICE, EESubsystemModel.DEFAULT_BINDINGS);
writer.writeStartElement(Element.DEFAULT_BINDINGS.getLocalName());
for (SimpleAttributeDefinition ad : DefaultBindingsResourceDefinition.ATTRIBUTES) {
ad.marshallAsAttribute(defaultBindingsNode, writer);
}
writer.writeEndElement();
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class EESubsystemXmlPersister method writeDirectoryElement.
private void writeDirectoryElement(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException {
for (Property property : subModel.asPropertyList()) {
writer.writeStartElement(Element.DIRECTORY.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
for (SimpleAttributeDefinition ad : GlobalDirectoryResourceDefinition.ATTRIBUTES) {
ad.marshallAsAttribute(property.getValue(), writer);
}
writer.writeEndElement();
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class EESubsystemXmlPersister method writeManagedScheduledExecutorServices.
private void writeManagedScheduledExecutorServices(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException {
writer.writeStartElement(Element.MANAGED_SCHEDULED_EXECUTOR_SERVICES.getLocalName());
for (Property property : subModel.asPropertyList()) {
writer.writeStartElement(Element.MANAGED_SCHEDULED_EXECUTOR_SERVICE.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
for (SimpleAttributeDefinition ad : ManagedScheduledExecutorServiceResourceDefinition.ATTRIBUTES) {
ad.marshallAsAttribute(property.getValue(), writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class OidcConfigService method getCredentialValue.
private ModelNode getCredentialValue(ModelNode model) {
ModelNode credential = new ModelNode();
for (SimpleAttributeDefinition attribute : CredentialDefinition.ATTRIBUTES) {
String attributeName = attribute.getName();
ModelNode attributeValue = model.get(attributeName);
if (attributeValue.isDefined()) {
credential.get(attributeName).set(attributeValue.asString());
}
}
return credential;
}
Aggregations