Search in sources :

Example 21 with ModelNode

use of org.jboss.dmr.ModelNode in project wildfly by wildfly.

the class WebSubsystemParser method addDefaultContainerConfig.

static void addDefaultContainerConfig(final PathAddress parent, List<ModelNode> list) {
    final ModelNode config = new ModelNode();
    PathAddress containerPath = PathAddress.pathAddress(parent, WebExtension.CONTAINER_PATH);
    config.get(OP).set(ADD);
    config.get(OP_ADDR).set(containerPath.toModelNode());
    list.add(config);
    addDefaultStaticConfiguration(parent, list);
    addDefaultJSPConfiguration(parent, list);
}
Also used : PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode)

Example 22 with ModelNode

use of org.jboss.dmr.ModelNode in project wildfly by wildfly.

the class WebSubsystemParser method parseJSPConfiguration.

static void parseJSPConfiguration(XMLExtendedStreamReader reader, final PathAddress parent, List<ModelNode> list) throws XMLStreamException {
    final PathAddress address = PathAddress.pathAddress(parent, WebExtension.JSP_CONFIGURATION_PATH);
    final ModelNode jsp = new ModelNode();
    jsp.get(OP).set(ADD);
    jsp.get(OP_ADDR).set(address.toModelNode());
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        requireNoNamespaceAttribute(reader, i);
        final String value = reader.getAttributeValue(i);
        final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        switch(attribute) {
            case DEVELOPMENT:
            case DISABLED:
            case KEEP_GENERATED:
            case TRIM_SPACES:
            case TAG_POOLING:
            case MAPPED_FILE:
            case CHECK_INTERVAL:
            case MODIFICATION_TEST_INTERVAL:
            case RECOMPILE_ON_FAIL:
            case SMAP:
            case DUMP_SMAP:
            case GENERATE_STRINGS_AS_CHAR_ARRAYS:
            case ERROR_ON_USE_BEAN_INVALID_CLASS_ATTRIBUTE:
            case SCRATCH_DIR:
            case SOURCE_VM:
            case TARGET_VM:
            case JAVA_ENCODING:
            case X_POWERED_BY:
            case DISPLAY_SOURCE_FRAGMENT:
                WebJSPDefinition.ATTRIBUTES_MAP.get(attribute.getLocalName()).parseAndSetParameter(value, jsp, reader);
                break;
            default:
                throw unexpectedAttribute(reader, i);
        }
    }
    requireNoContent(reader);
    list.add(jsp);
}
Also used : ParseUtils.requireNoNamespaceAttribute(org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute) ParseUtils.unexpectedAttribute(org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute) PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode)

Example 23 with ModelNode

use of org.jboss.dmr.ModelNode in project wildfly by wildfly.

the class WebSubsystemParser method parseStaticResources.

static void parseStaticResources(XMLExtendedStreamReader reader, PathAddress parent, List<ModelNode> list) throws XMLStreamException {
    PathAddress address = PathAddress.pathAddress(parent, WebExtension.STATIC_RESOURCES_PATH);
    final ModelNode resources = new ModelNode();
    resources.get(OP).set(ADD);
    resources.get(OP_ADDR).set(address.toModelNode());
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        requireNoNamespaceAttribute(reader, i);
        final String value = reader.getAttributeValue(i);
        final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
        switch(attribute) {
            case LISTINGS:
                WebStaticResources.LISTINGS.parseAndSetParameter(value, resources, reader);
                break;
            case SENDFILE:
                WebStaticResources.SENDFILE.parseAndSetParameter(value, resources, reader);
                break;
            case FILE_ENCODING:
                WebStaticResources.FILE_ENCODING.parseAndSetParameter(value, resources, reader);
                break;
            case READ_ONLY:
                WebStaticResources.READ_ONLY.parseAndSetParameter(value, resources, reader);
                break;
            case WEBDAV:
                WebStaticResources.WEBDAV.parseAndSetParameter(value, resources, reader);
                break;
            case SECRET:
                WebStaticResources.SECRET.parseAndSetParameter(value, resources, reader);
                break;
            case MAX_DEPTH:
                WebStaticResources.MAX_DEPTH.parseAndSetParameter(value, resources, reader);
                break;
            case DISABLED:
                WebStaticResources.DISABLED.parseAndSetParameter(value, resources, reader);
                break;
            default:
                throw unexpectedAttribute(reader, i);
        }
    }
    requireNoContent(reader);
    list.add(resources);
}
Also used : ParseUtils.requireNoNamespaceAttribute(org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute) ParseUtils.unexpectedAttribute(org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute) PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode)

Example 24 with ModelNode

use of org.jboss.dmr.ModelNode in project wildfly by wildfly.

the class MigrateOperation method migrateConnectorAttribute.

private void migrateConnectorAttribute(ModelNode addOperation) {
    ModelNode connector = addOperation.get(CONNECTOR);
    if (connector.isDefined()) {
        // legacy connector is a property list where the name is the connector and the value is undefined
        List<Property> connectorProps = connector.asPropertyList();
        for (Property connectorProp : connectorProps) {
            addOperation.get("connectors").add(connectorProp.getName());
        }
        addOperation.remove(CONNECTOR);
    }
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 25 with ModelNode

use of org.jboss.dmr.ModelNode in project wildfly by wildfly.

the class MigrateOperation method migrateDiscoveryGroupNameAttribute.

private void migrateDiscoveryGroupNameAttribute(ModelNode addOperation) {
    ModelNode discoveryGroup = addOperation.get(DISCOVERY_GROUP_NAME);
    if (discoveryGroup.isDefined()) {
        // discovery-group-name attribute has been renamed to discovery-group
        addOperation.get("discovery-group").set(discoveryGroup);
        addOperation.remove(DISCOVERY_GROUP_NAME);
    }
}
Also used : ModelNode(org.jboss.dmr.ModelNode)

Aggregations

ModelNode (org.jboss.dmr.ModelNode)1634 PathAddress (org.jboss.as.controller.PathAddress)351 Test (org.junit.Test)344 KernelServices (org.jboss.as.subsystem.test.KernelServices)102 Property (org.jboss.dmr.Property)92 OperationFailedException (org.jboss.as.controller.OperationFailedException)89 OperationContext (org.jboss.as.controller.OperationContext)68 ParseUtils.unexpectedElement (org.jboss.as.controller.parsing.ParseUtils.unexpectedElement)68 ArrayList (java.util.ArrayList)58 Resource (org.jboss.as.controller.registry.Resource)54 PathElement (org.jboss.as.controller.PathElement)53 ParseUtils.unexpectedAttribute (org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute)52 ParseUtils.requireNoNamespaceAttribute (org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute)50 IOException (java.io.IOException)49 ServiceName (org.jboss.msc.service.ServiceName)49 ResourceTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)47 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)44 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)42 OperationBuilder (org.jboss.as.controller.client.OperationBuilder)42 Map (java.util.Map)38