Search in sources :

Example 36 with SimpleAttributeDefinition

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;
}
Also used : SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) ModelType(org.jboss.dmr.ModelType) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) SimpleAttributeDefinitionBuilder(org.jboss.as.controller.SimpleAttributeDefinitionBuilder) LinkedList(java.util.LinkedList)

Example 37 with SimpleAttributeDefinition

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();
    }
}
Also used : SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) ModelNode(org.jboss.dmr.ModelNode)

Example 38 with SimpleAttributeDefinition

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();
    }
}
Also used : SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) Property(org.jboss.dmr.Property)

Example 39 with SimpleAttributeDefinition

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();
}
Also used : SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) Property(org.jboss.dmr.Property)

Example 40 with SimpleAttributeDefinition

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;
}
Also used : SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) ModelNode(org.jboss.dmr.ModelNode)

Aggregations

SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)45 ModelNode (org.jboss.dmr.ModelNode)15 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)11 ParseUtils.requireNoNamespaceAttribute (org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute)9 ParseUtils.unexpectedAttribute (org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute)9 SimpleAttributeDefinitionBuilder (org.jboss.as.controller.SimpleAttributeDefinitionBuilder)8 Property (org.jboss.dmr.Property)6 OperationContext (org.jboss.as.controller.OperationContext)4 AbstractAttributeDefinitionBuilder (org.jboss.as.controller.AbstractAttributeDefinitionBuilder)3 PathAddress (org.jboss.as.controller.PathAddress)3 PrimitiveListAttributeDefinition (org.jboss.as.controller.PrimitiveListAttributeDefinition)3 ReloadRequiredWriteAttributeHandler (org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)3 SimpleListAttributeDefinition (org.jboss.as.controller.SimpleListAttributeDefinition)3 SimpleMapAttributeDefinition (org.jboss.as.controller.SimpleMapAttributeDefinition)3 ParseUtils.unexpectedElement (org.jboss.as.controller.parsing.ParseUtils.unexpectedElement)3 ClearWorkManagerStatisticsHandler (org.jboss.as.connector.dynamicresource.ClearWorkManagerStatisticsHandler)2 WorkManagerRuntimeAttributeReadHandler (org.jboss.as.connector.subsystems.resourceadapters.WorkManagerRuntimeAttributeReadHandler)2 WorkManagerRuntimeAttributeWriteHandler (org.jboss.as.connector.subsystems.resourceadapters.WorkManagerRuntimeAttributeWriteHandler)2 AbstractWriteAttributeHandler (org.jboss.as.controller.AbstractWriteAttributeHandler)2 ListAttributeDefinition (org.jboss.as.controller.ListAttributeDefinition)2