diff --git a/controller/src/main/java/org/jboss/as/controller/descriptions/ModelDescriptionConstants.java b/controller/src/main/java/org/jboss/as/controller/descriptions/ModelDescriptionConstants.java index 1555cb85eb3..04f524ffb84 100644 --- a/controller/src/main/java/org/jboss/as/controller/descriptions/ModelDescriptionConstants.java +++ b/controller/src/main/java/org/jboss/as/controller/descriptions/ModelDescriptionConstants.java @@ -66,6 +66,7 @@ public class ModelDescriptionConstants { public static final String AUTHENTICATION_CONTEXT = "authentication-context"; public static final String AUTHORIZATION = "authorization"; public static final String AUTO_START = "auto-start"; + public static final String BACKLOG = "backlog"; public static final String BASE_DN = "base-dn"; public static final String BASE_ROLE = "base-role"; public static final String BLOCKING = "blocking"; @@ -94,6 +95,8 @@ public class ModelDescriptionConstants { public static final String COMPLEX_ATTRIBUTE = "complex-attribute"; public static final String COMPOSITE = "composite"; public static final String CONFIGURATION_CHANGES="configuration-changes"; + public static final String CONNECTION_HIGH_WATER = "connection-high-water"; + public static final String CONNECTION_LOW_WATER = "connection-low-water"; public static final String CONSTRAINT = "constraint"; public static final String CONCURRENT_GROUPS = "concurrent-groups"; public static final String CONFIGURED_APPLICATION = "configured-application"; @@ -325,6 +328,7 @@ public class ModelDescriptionConstants { public static final String NETWORK = "network"; public static final String NILLABLE = "nillable"; public static final String NIL_SIGNIFICANT = "nil-significant"; + public static final String NO_REQUEST_TIMEOUT = "no-request-timeout"; public static final String NORMAL = "normal"; public static final String NOT = "not"; public static final String NOTIFICATION = "notification"; diff --git a/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java b/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java index 72876a3201e..1e5fcd337b8 100644 --- a/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java +++ b/controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java @@ -3798,4 +3798,8 @@ OperationFailedRuntimeException capabilityAlreadyRegisteredInContext(String capa @Message(id = 514, value = "Management namespace %s is not enabled by the current stability level") XMLStreamException unstableManagementNamespace(String namespaceURI); + @LogMessage(level = INFO) + @Message(id = 515, value = "The system property '%s' is deprecated and may be removed in a future version, " + + "attribute '%s' on resource '%s' should be used instead.") + void systemPropertyDeprecated(String systemProperty, String attribute, String address); } diff --git a/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceAddStepHandler.java b/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceAddStepHandler.java index ad8688ce689..2666367af54 100644 --- a/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceAddStepHandler.java +++ b/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceAddStepHandler.java @@ -5,6 +5,7 @@ package org.jboss.as.controller.management; +import static org.jboss.as.controller.logging.ControllerLogger.DEPRECATED_LOGGER; import static org.jboss.as.controller.logging.ControllerLogger.ROOT_LOGGER; import java.util.ArrayList; @@ -12,6 +13,7 @@ import java.util.List; import java.util.Map; +import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; @@ -30,6 +32,12 @@ */ public abstract class BaseHttpInterfaceAddStepHandler extends ManagementInterfaceAddStepHandler { + private static final String PROPERTY_BASE = "org.wildfly.management."; + private static final String BACKLOG_PROPERTY = PROPERTY_BASE + "backlog"; + private static final String CONNECTION_HIGH_WATER_PROPERTY = PROPERTY_BASE + "connection-high-water"; + private static final String CONNECTION_LOW_WATER_PROPERTY = PROPERTY_BASE + "connection-low-water"; + private static final String NO_REQUEST_TIMEOUT_PROPERTY = PROPERTY_BASE + "no-request-timeout"; + protected static final String HTTP_AUTHENTICATION_FACTORY_CAPABILITY = "org.wildfly.security.http-authentication-factory"; protected static final String SASL_AUTHENTICATION_FACTORY_CAPABILITY = "org.wildfly.security.sasl-authentication-factory"; protected static final String SSL_CONTEXT_CAPABILITY = "org.wildfly.security.ssl-context"; @@ -96,6 +104,10 @@ public void performRuntime(OperationContext context, ModelNode operation, ModelN } } + final int backlog = resolveIntProperty(BACKLOG_PROPERTY, BaseHttpInterfaceResourceDefinition.BACKLOG, context, model); + final int noRequestTimeout = resolveIntProperty(NO_REQUEST_TIMEOUT_PROPERTY, BaseHttpInterfaceResourceDefinition.NO_REQUEST_TIMEOUT, context, model); + final int connectionHighWater = resolveIntProperty(CONNECTION_HIGH_WATER_PROPERTY, BaseHttpInterfaceResourceDefinition.CONNECTION_HIGH_WATER, context, model); + final int connectionLowWater = resolveIntProperty(CONNECTION_LOW_WATER_PROPERTY, BaseHttpInterfaceResourceDefinition.CONNECTION_LOW_WATER, context, model); List requiredServices = installServices(context, new HttpInterfaceCommonPolicy() { @Override @@ -138,6 +150,28 @@ public Map> getConstantHeaders() { return constantHeaders; } + @Override + public int getBacklog() { + return backlog; + } + + @Override + public int getNoRequestTimeoutMs() { + return noRequestTimeout; + } + + @Override + public int getConnectionHighWater() { + return connectionHighWater; + } + + @Override + public int getConnectionLowWater() { + return connectionLowWater; + } + + + }, model); addVerifyInstallationStep(context, requiredServices); @@ -145,4 +179,17 @@ public Map> getConstantHeaders() { protected abstract List installServices(OperationContext context, HttpInterfaceCommonPolicy commonPolicy, ModelNode model) throws OperationFailedException; + private static int resolveIntProperty(final String systemProperty, final AttributeDefinition attributeDefinition, + final OperationContext context, final ModelNode model) throws OperationFailedException { + if (System.getProperty(systemProperty) != null) { + if (context.enables(attributeDefinition)) { + // Log a warning if the system property is used and the attribute is enabled at the current stability level. + DEPRECATED_LOGGER.systemPropertyDeprecated(systemProperty, attributeDefinition.getName(), context.getCurrentAddress().toCLIStyleString()); + } + return Integer.parseInt(System.getProperty(systemProperty)); + } + + // This is fine if not enabled as we still get the default returned. + return attributeDefinition.resolveModelAttribute(context, model).asInt(); + } } diff --git a/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceResourceDefinition.java b/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceResourceDefinition.java index 4e6f7008c81..071aa4af15e 100644 --- a/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceResourceDefinition.java +++ b/controller/src/main/java/org/jboss/as/controller/management/BaseHttpInterfaceResourceDefinition.java @@ -38,12 +38,14 @@ import org.jboss.as.controller.StringListAttributeDefinition; import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition; import org.jboss.as.controller.capability.RuntimeCapability; +import org.jboss.as.controller.client.helpers.MeasurementUnit; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.as.controller.operations.validation.ParameterValidator; import org.jboss.as.controller.operations.validation.StringLengthValidator; import org.jboss.as.controller.parsing.Attribute; import org.jboss.as.controller.registry.AttributeAccess; import org.jboss.as.controller.registry.ManagementResourceRegistration; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; @@ -181,8 +183,38 @@ public void validateParameter(String parameterName, ModelNode value) throws Oper .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); + public static final SimpleAttributeDefinition BACKLOG = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.BACKLOG, ModelType.INT, true) + .setAllowExpression(true) + .setDefaultValue(new ModelNode(50)) + .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) + .setStability(Stability.COMMUNITY) + .build(); + + public static final SimpleAttributeDefinition NO_REQUEST_TIMEOUT = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.NO_REQUEST_TIMEOUT, ModelType.INT, true) + .setAllowExpression(true) + .setMeasurementUnit(MeasurementUnit.MILLISECONDS) + .setDefaultValue(new ModelNode(60000)) + .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) + .setStability(Stability.COMMUNITY) + .build(); + + public static final SimpleAttributeDefinition CONNECTION_HIGH_WATER = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.CONNECTION_HIGH_WATER, ModelType.INT, true) + .setAllowExpression(true) + .setDefaultValue(new ModelNode(100)) + .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) + .setStability(Stability.COMMUNITY) + .build(); + + public static final SimpleAttributeDefinition CONNECTION_LOW_WATER = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.CONNECTION_LOW_WATER, ModelType.INT, true) + .setAllowExpression(true) + .setDefaultValue(new ModelNode(75)) + .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) + .setStability(Stability.COMMUNITY) + .build(); + protected static final AttributeDefinition[] COMMON_ATTRIBUTES = new AttributeDefinition[] { HTTP_AUTHENTICATION_FACTORY, SSL_CONTEXT, CONSOLE_ENABLED, HTTP_UPGRADE_ENABLED, - HTTP_UPGRADE, SASL_PROTOCOL, SERVER_NAME, ALLOWED_ORIGINS, CONSTANT_HEADERS}; + HTTP_UPGRADE, SASL_PROTOCOL, SERVER_NAME, ALLOWED_ORIGINS, CONSTANT_HEADERS, + BACKLOG, NO_REQUEST_TIMEOUT, CONNECTION_HIGH_WATER, CONNECTION_LOW_WATER }; /** * @param parameters diff --git a/controller/src/main/java/org/jboss/as/controller/management/HttpInterfaceCommonPolicy.java b/controller/src/main/java/org/jboss/as/controller/management/HttpInterfaceCommonPolicy.java index beb96bb85b1..412d6ad6593 100644 --- a/controller/src/main/java/org/jboss/as/controller/management/HttpInterfaceCommonPolicy.java +++ b/controller/src/main/java/org/jboss/as/controller/management/HttpInterfaceCommonPolicy.java @@ -77,6 +77,34 @@ public interface HttpInterfaceCommonPolicy { */ Map> getConstantHeaders(); + /** + * Get the maximum number of pending connections that can be queued before the server starts to reject connections. + * + * @return the maximum number of pending connections that can be queued before the server starts to reject connections. + */ + int getBacklog(); + + /** + * Get the maximum time in milliseconds that a connection can be idle without receiving a HTTP request before it is closed. + * + * @return the maximum time in milliseconds that a connection can be idle without receiving a HTTP request before it is closed. + */ + int getNoRequestTimeoutMs(); + + /** + * Get the maximum number of connections that can be open before the interface stops accepting new connections. + * + * @return the maximum number of connections that can be open before the interface stops accepting new connections. + */ + int getConnectionHighWater(); + + /** + * Gets the connection count that must be reached before the server starts to accept new connections again. + * + * @return the connection count that must be reached before the server starts to accept new connections again. + */ + int getConnectionLowWater(); + static class Header { final String name; final String value; diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/Attribute.java b/controller/src/main/java/org/jboss/as/controller/parsing/Attribute.java index 381f8d072c1..f75676ec590 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/Attribute.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/Attribute.java @@ -37,6 +37,7 @@ public enum Attribute { ATTRIBUTE("attribute"), AUTHENTICATION_CONTEXT("authentication-context"), AUTO_START("auto-start"), + BACKLOG("backlog"), BASE_DN("base-dn"), BASE_ROLE("base-role"), BOOT_TIME("boot-time"), @@ -44,6 +45,8 @@ public enum Attribute { CODE("code"), COMPACT("compact"), CONNECTION("connection"), + CONNECTION_HIGH_WATER("connection-high-water"), + CONNECTION_LOW_WATER("connection-low-water"), CONNECTOR("connector"), CONSOLE_ENABLED("console-enabled"), CONTENT("content"), @@ -122,6 +125,7 @@ public enum Attribute { MULTICAST_PORT("multicast-port"), NAME("name"), NATIVE("native"), + NO_REQUEST_TIMEOUT("no-request-timeout"), ORGANIZATION("organization"), PARSE_ROLES_FROM_DN("parse-group-name-from-dn"), PASSWORD("password"), diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java index f2e74907538..c1cd48dd029 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchema.java @@ -50,13 +50,13 @@ public String getLocalName() { @Override public void readElement(XMLExtendedStreamReader reader, List value) throws XMLStreamException { - readerWriterDelegate.readElement(reader, namespace.getVersion(), namespace.getUri(), value); + readerWriterDelegate.readElement(reader, namespace, value); } @Override public void writeContent(XMLExtendedStreamWriter streamWriter, ModelMarshallingContext value) throws XMLStreamException { - readerWriterDelegate.writeContent(streamWriter, namespace.getVersion(), namespace.getUri(), value); + readerWriterDelegate.writeContent(streamWriter, namespace, value); } public static ManagementSchema create(ManagementXmlReaderWriter readerWriterDelegate, diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchemas.java b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchemas.java index e7e03a54f31..bdfb9147751 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchemas.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementSchemas.java @@ -56,6 +56,7 @@ private enum Version implements Feature { VERSION_18(18), VERSION_19(19), VERSION_20(20), + VERSION_20_COMMUNITY(20, Stability.COMMUNITY), ; private final int majorVersion; @@ -66,6 +67,10 @@ private enum Version implements Feature { this(majorVersion, 0); } + Version(final int majorVersion, final Stability stability) { + this(majorVersion, 0, stability); + } + Version(final int majorVersion, final int minorVersion) { this(majorVersion, minorVersion, Stability.DEFAULT); } diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java index 6009f02825c..a177bd2e1b2 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/ManagementXmlReaderWriter.java @@ -10,6 +10,7 @@ import javax.xml.stream.XMLStreamException; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.IntVersion; import org.jboss.staxmapper.XMLExtendedStreamReader; @@ -22,7 +23,7 @@ */ public interface ManagementXmlReaderWriter { - void readElement(XMLExtendedStreamReader reader, IntVersion version, String namespaceUri, List value) throws XMLStreamException; + void readElement(XMLExtendedStreamReader reader, VersionedNamespace namespace, List value) throws XMLStreamException; - void writeContent(XMLExtendedStreamWriter streamWriter, IntVersion version, String namespaceUri, ModelMarshallingContext value) throws XMLStreamException; + void writeContent(XMLExtendedStreamWriter streamWriter, VersionedNamespace namespace, ModelMarshallingContext value) throws XMLStreamException; } diff --git a/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java b/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java index aa38991d872..2720bd62b76 100644 --- a/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java +++ b/controller/src/main/java/org/jboss/as/controller/parsing/UnstableManagementReaderWriter.java @@ -11,6 +11,7 @@ import javax.xml.stream.XMLStreamException; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.IntVersion; import org.jboss.staxmapper.XMLExtendedStreamReader; @@ -30,14 +31,14 @@ private UnstableManagementReaderWriter() { } @Override - public void readElement(XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, List value) throws XMLStreamException { + public void readElement(XMLExtendedStreamReader reader, final VersionedNamespace namespace, List value) throws XMLStreamException { throw ROOT_LOGGER.unstableManagementNamespace(reader.getNamespaceURI()); } @Override - public void writeContent(XMLExtendedStreamWriter streamWriter, final IntVersion version, final String namespaceUri, ModelMarshallingContext value) + public void writeContent(XMLExtendedStreamWriter streamWriter, final VersionedNamespace namespace, ModelMarshallingContext value) throws XMLStreamException { - throw ROOT_LOGGER.unstableManagementNamespace(namespaceUri); + throw ROOT_LOGGER.unstableManagementNamespace(namespace.getUri()); } } diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java index 74bbcaa199e..10a69799126 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java @@ -438,14 +438,16 @@ private class KernelServicesBuilderImpl implements KernelServicesBuilder, ModelT ExtensionRegistry extensionRegistry; private final Map>> attributeDescriptors = new HashMap<>(); private Map>>> operationParameterDescriptors = new HashMap<>(); + private final Stability stability; KernelServicesBuilderImpl(TestModelType type, Stability stability) { this.type = type; + this.stability = stability; this.processType = type == TestModelType.HOST || type == TestModelType.DOMAIN ? ProcessType.HOST_CONTROLLER : ProcessType.STANDALONE_SERVER; runningModeControl = type == TestModelType.HOST ? new HostRunningModeControl(RunningMode.ADMIN_ONLY, RestartMode.HC_ONLY) : new RunningModeControl(RunningMode.ADMIN_ONLY); extensionRegistry = ExtensionRegistry.builder(this.processType).withRunningModeControl(this.runningModeControl).withStability(stability).build(); - testParser = TestParser.create(extensionRegistry, xmlMapper, type); + testParser = TestParser.create(stability, extensionRegistry, xmlMapper, type); } diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java index ffab08e347b..7d1e7631d4d 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java @@ -106,7 +106,7 @@ class TestModelControllerService extends ModelTestModelControllerService { TestModelControllerService(ProcessType processType, RunningModeControl runningModeControl, StringConfigurationPersister persister, ModelTestOperationValidatorFilter validateOpsFilter, TestModelType type, ModelInitializer modelInitializer, TestDelegatingResourceDefinition rootResourceDefinition, ControlledProcessState processState, ExtensionRegistry extensionRegistry, CapabilityRegistry capabilityRegistry, RuntimeExpressionResolver expressionResolver) { - super(processType, runningModeControl, null, persister, validateOpsFilter, rootResourceDefinition, processState, + super(processType, extensionRegistry.getStability(), runningModeControl, null, persister, validateOpsFilter, rootResourceDefinition, processState, expressionResolver, capabilityRegistry); this.type = type; this.runningModeControl = runningModeControl; diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestParser.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestParser.java index 1222bdfab32..a4c1c852dae 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestParser.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestParser.java @@ -121,9 +121,7 @@ private static TestParser createLegacy(ExtensionRegistry registry, XMLMapper xml return testParser; } - private static TestParser createFrom27(ExtensionRegistry registry, XMLMapper xmlMapper, TestModelType type) { - Stability stability = Stability.DEFAULT; - + private static TestParser createFrom27(Stability stability, ExtensionRegistry registry, XMLMapper xmlMapper, TestModelType type) { ManagementSchemas schemas; if (type == TestModelType.STANDALONE) { schemas = new StandaloneXmlSchemas(stability, null, Executors.newCachedThreadPool(), registry); @@ -149,6 +147,10 @@ private static TestParser createFrom27(ExtensionRegistry registry, XMLMapper xml public static TestParser create(ExtensionRegistry registry, XMLMapper xmlMapper, TestModelType type) { + return create(Stability.DEFAULT, registry, xmlMapper, type); + } + + public static TestParser create(Stability stability, ExtensionRegistry registry, XMLMapper xmlMapper, TestModelType type) { if (getModelMajorVersion() < 27) { try { return createLegacy(registry, xmlMapper, type); @@ -156,7 +158,7 @@ public static TestParser create(ExtensionRegistry registry, XMLMapper xmlMapper, throw new IllegalStateException("Failed to create the parser", e); } } - return createFrom27(registry, xmlMapper, type); + return createFrom27(stability, registry, xmlMapper, type); } void addModelWriteSanitizer(ModelWriteSanitizer writeSanitizer) { diff --git a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/HostMgmtInterfacesTestCase.java b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/HostMgmtInterfacesTestCase.java index 409f6aecdbc..2674603f5db 100644 --- a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/HostMgmtInterfacesTestCase.java +++ b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/HostMgmtInterfacesTestCase.java @@ -8,6 +8,7 @@ import org.jboss.as.core.model.test.KernelServices; import org.jboss.as.core.model.test.TestModelType; import org.jboss.as.model.test.ModelTestUtils; +import org.jboss.as.version.Stability; import org.junit.Assert; import org.junit.Test; @@ -29,8 +30,18 @@ public void testEmptyAllowedOriginsConfiguration() throws Exception { testConfiguration("host_empty_allowed_origins.xml"); } + @Test + public void testResourceConstraints_Community() throws Exception { + // Test for https://issues.redhat.com/browse/WFCORE-6830 + testConfiguration("host_resource_constraints_community.xml", Stability.COMMUNITY); + } + private void testConfiguration(String fileName) throws Exception { - KernelServices kernelServices = createKernelServicesBuilder(TestModelType.HOST) + testConfiguration(fileName, Stability.DEFAULT); + } + + private void testConfiguration(String fileName, Stability stability) throws Exception { + KernelServices kernelServices = createKernelServicesBuilder(TestModelType.HOST, stability) .setXmlResource(fileName) .validateDescription() .build(); diff --git a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/StandaloneMgmtInterfacesTestCase.java b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/StandaloneMgmtInterfacesTestCase.java index 678f7723c9d..1c605af3e3b 100644 --- a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/StandaloneMgmtInterfacesTestCase.java +++ b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/mgmt_interfaces/StandaloneMgmtInterfacesTestCase.java @@ -8,6 +8,7 @@ import org.jboss.as.core.model.test.KernelServices; import org.jboss.as.core.model.test.TestModelType; import org.jboss.as.model.test.ModelTestUtils; +import org.jboss.as.version.Stability; import org.junit.Assert; import org.junit.Test; @@ -29,8 +30,18 @@ public void testEmptyAllowedOriginsConfiguration() throws Exception { testConfiguration("standalone_empty_allowed_origins.xml"); } + @Test + public void testResourceConstraints_Community() throws Exception { + // Test for https://issues.redhat.com/browse/WFCORE-6830 + testConfiguration("standalone_resource_constraints_community.xml", Stability.COMMUNITY); + } + public void testConfiguration(String fileName) throws Exception { - KernelServices kernelServices = createKernelServicesBuilder(TestModelType.STANDALONE) + testConfiguration(fileName, Stability.DEFAULT); + } + + public void testConfiguration(String fileName, Stability stability) throws Exception { + KernelServices kernelServices = createKernelServicesBuilder(TestModelType.STANDALONE, stability) .setXmlResource(fileName) .validateDescription() .build(); diff --git a/core-model-test/tests/src/test/resources/org/jboss/as/core/model/test/mgmt_interfaces/host_resource_constraints_community.xml b/core-model-test/tests/src/test/resources/org/jboss/as/core/model/test/mgmt_interfaces/host_resource_constraints_community.xml new file mode 100644 index 00000000000..d12ddd76af8 --- /dev/null +++ b/core-model-test/tests/src/test/resources/org/jboss/as/core/model/test/mgmt_interfaces/host_resource_constraints_community.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/core-model-test/tests/src/test/resources/org/jboss/as/core/model/test/mgmt_interfaces/standalone_resource_constraints_community.xml b/core-model-test/tests/src/test/resources/org/jboss/as/core/model/test/mgmt_interfaces/standalone_resource_constraints_community.xml new file mode 100644 index 00000000000..1cd27e53d21 --- /dev/null +++ b/core-model-test/tests/src/test/resources/org/jboss/as/core/model/test/mgmt_interfaces/standalone_resource_constraints_community.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpServer.java b/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpServer.java index 1287bc383b1..9b87be2f208 100644 --- a/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpServer.java +++ b/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpServer.java @@ -252,6 +252,9 @@ private static ManagementHttpServer create(Builder builder) { } } + ROOT_LOGGER.debugf("HTTP Management API Connection Constraints - backlog=%d, noRequestTimeout=%d, connectionHighWater=%d, connectionLowWater=%d", + builder.backlog, builder.noRequestTimeout, builder.connectionHighWater, builder.connectionLowWater); + final OptionMap undertowOptions; if (builder.noRequestTimeout != null) { undertowOptions = OptionMap.create(UndertowOptions.NO_REQUEST_TIMEOUT, builder.noRequestTimeout); diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/operations/HttpManagementAddHandler.java b/host-controller/src/main/java/org/jboss/as/host/controller/operations/HttpManagementAddHandler.java index 5ce83879ebb..123ede4e58d 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/operations/HttpManagementAddHandler.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/operations/HttpManagementAddHandler.java @@ -145,7 +145,8 @@ protected List installServices(OperationContext context, HttpInterf final Supplier scSupplier = sslContext != null ? builder.requiresCapability(SSL_CONTEXT_CAPABILITY, SSLContext.class, sslContext) : null; final UndertowHttpManagementService service = new UndertowHttpManagementService(hmConsumer, lrSupplier, mcSupplier, null, null, null, ibSupplier, sibSupplier, rpSupplier, xwSupplier, eSupplier, hafSupplier, scSupplier, port, securePort, commonPolicy.getAllowedOrigins(), consoleMode, - Functions.constantSupplier(environment.getProductConfig().getConsoleSlot()), commonPolicy.getConstantHeaders(), caSupplier); + Functions.constantSupplier(environment.getProductConfig().getConsoleSlot()), commonPolicy.getConstantHeaders(), caSupplier, + commonPolicy.getBacklog(), commonPolicy.getNoRequestTimeoutMs(), commonPolicy.getConnectionHighWater(), commonPolicy.getConnectionLowWater()); builder.setInstance(service); builder.setInitialMode(onDemand ? ServiceController.Mode.ON_DEMAND : ServiceController.Mode.ACTIVE).install(); diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java index ebd4cefaac3..5132c308878 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java @@ -12,7 +12,9 @@ import org.jboss.as.controller.extension.ExtensionRegistry; import org.jboss.as.controller.parsing.ExtensionXml; import org.jboss.as.controller.parsing.ManagementXmlReaderWriter; +import org.jboss.as.controller.parsing.ManagementXmlSchema; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.modules.ModuleLoader; import org.jboss.staxmapper.IntVersion; @@ -36,7 +38,11 @@ public DomainXml(final ModuleLoader loader, ExecutorService executorService, Ext } @Override - public void readElement(final XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, final List nodes) throws XMLStreamException { + public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace namespace, final List nodes) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + switch (version.major()) { case 1: case 2: @@ -65,7 +71,11 @@ public void readElement(final XMLExtendedStreamReader reader, final IntVersion v } @Override - public void writeContent(final XMLExtendedStreamWriter writer, final IntVersion version, final String namespaceUri, final ModelMarshallingContext context) throws XMLStreamException { + public void writeContent(final XMLExtendedStreamWriter writer, final VersionedNamespace namespace, final ModelMarshallingContext context) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + new DomainXml_16(extensionXml, extensionRegistry, version, namespaceUri).writeContent(writer, context); } diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java index 17035cd37fc..8f5c7692d14 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml.java @@ -14,7 +14,9 @@ import org.jboss.as.controller.extension.ExtensionRegistry; import org.jboss.as.controller.parsing.ExtensionXml; import org.jboss.as.controller.parsing.ManagementXmlReaderWriter; +import org.jboss.as.controller.parsing.ManagementXmlSchema; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.modules.ModuleLoader; import org.jboss.staxmapper.IntVersion; @@ -46,8 +48,12 @@ public HostXml(String defaultHostControllerName, RunningMode runningMode, boolea } @Override - public void readElement(final XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, final List operationList) + public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace namespace, final List operationList) throws XMLStreamException { + + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + switch (version.major()) { case 1: case 2: @@ -83,14 +89,15 @@ public void readElement(final XMLExtendedStreamReader reader, final IntVersion v new HostXml_18(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, version, namespaceUri).readElement(reader, operationList); break; default: - new HostXml_20(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, version, namespaceUri).readElement(reader, operationList); + new HostXml_20(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, namespace).readElement(reader, operationList); } } @Override - public void writeContent(final XMLExtendedStreamWriter writer, final IntVersion version, final String namespaceUri, final ModelMarshallingContext context) + public void writeContent(final XMLExtendedStreamWriter writer, final VersionedNamespace namespace, final ModelMarshallingContext context) throws XMLStreamException { - new HostXml_20(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, version, namespaceUri).writeContent(writer, context); + + new HostXml_20(defaultHostControllerName, runningMode, isCachedDc, extensionRegistry, extensionXml, namespace).writeContent(writer, context); } } diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml_20.java b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml_20.java index bc31d14cd45..e14c8ca16a1 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml_20.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml_20.java @@ -77,10 +77,12 @@ import org.jboss.as.controller.parsing.Attribute; import org.jboss.as.controller.parsing.Element; import org.jboss.as.controller.parsing.ExtensionXml; +import org.jboss.as.controller.parsing.ManagementXmlSchema; import org.jboss.as.controller.parsing.ParseUtils; import org.jboss.as.controller.parsing.ProfileParsingCompletionHandler; import org.jboss.as.controller.parsing.WriteUtils; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.as.domain.management.parsing.AuditLogXml; import org.jboss.as.domain.management.parsing.ManagementXml; import org.jboss.as.domain.management.parsing.ManagementXmlDelegate; @@ -101,6 +103,7 @@ import org.jboss.as.server.parsing.CommonXml; import org.jboss.as.server.parsing.SocketBindingsXml; import org.jboss.as.server.services.net.SocketBindingGroupResourceDefinition; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; import org.jboss.dmr.Property; @@ -126,18 +129,20 @@ final class HostXml_20 extends CommonXml implements ManagementXmlDelegate { private final ExtensionXml extensionXml; private final IntVersion version; private final String namespace; + private final Stability stability; HostXml_20(String defaultHostControllerName, RunningMode runningMode, boolean isCachedDC, - final ExtensionRegistry extensionRegistry, final ExtensionXml extensionXml, final IntVersion version, - final String namespaceUri) { + final ExtensionRegistry extensionRegistry, final ExtensionXml extensionXml, + final VersionedNamespace namespace) { super(new SocketBindingsXml.HostSocketBindingsXml()); - this.namespace = namespaceUri; + this.namespace = namespace.getUri(); + this.version = namespace.getVersion(); this.auditLogDelegate = AuditLogXml.newInstance(version, true); this.defaultHostControllerName = defaultHostControllerName; this.runningMode = runningMode; this.isCachedDc = isCachedDC; this.extensionRegistry = extensionRegistry; - this.version = version; + this.stability = namespace.getStability(); this.extensionXml = extensionXml; } @@ -396,6 +401,42 @@ private void parseHttpManagementInterfaceAttributes(XMLExtendedStreamReader read HttpManagementResourceDefinition.ALLOWED_ORIGINS.getParser().parseAndSetParameter(HttpManagementResourceDefinition.ALLOWED_ORIGINS, value, addOp, reader); break; } + case BACKLOG: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.BACKLOG.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } + case NO_REQUEST_TIMEOUT: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.NO_REQUEST_TIMEOUT.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } + case CONNECTION_HIGH_WATER: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.CONNECTION_HIGH_WATER.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } + case CONNECTION_LOW_WATER: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.CONNECTION_LOW_WATER.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } default: throw unexpectedAttribute(reader, i); } @@ -1711,9 +1752,15 @@ public boolean writeHttpManagementProtocol(XMLExtendedStreamWriter writer, Model HttpManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); HttpManagementResourceDefinition.CONSOLE_ENABLED.marshallAsAttribute(protocol, writer); HttpManagementResourceDefinition.ALLOWED_ORIGINS.getMarshaller().marshallAsAttribute( - HttpManagementResourceDefinition.ALLOWED_ORIGINS, protocol, true, writer); + HttpManagementResourceDefinition.ALLOWED_ORIGINS, protocol, true, writer); HttpManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); HttpManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.BACKLOG.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.NO_REQUEST_TIMEOUT.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.CONNECTION_HIGH_WATER.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.CONNECTION_LOW_WATER.marshallAsAttribute(protocol, writer); + } if (HttpManagementResourceDefinition.HTTP_UPGRADE.isMarshallable(protocol)) { writer.writeEmptyElement(Element.HTTP_UPGRADE.getLocalName()); diff --git a/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties b/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties index fd65c26527c..002709e157a 100644 --- a/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties +++ b/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties @@ -209,6 +209,10 @@ host.core.management.http-interface.sasl-protocol=The name of the protocol to be host.core.management.http-interface.sasl-protocol.deprecated=Only for use with the legacy security realms. host.core.management.http-interface.server-name=The name of the server used in the initial Remoting exchange and within the SASL mechanisms. host.core.management.http-interface.server-name.deprecated=Only for use with the legacy security realms. +host.core.management.http-interface.backlog=The maximum number of pending connections on the socket. +host.core.management.http-interface.no-request-timeout=The maximum time in milliseconds a connection can be idle without a HTTP request before it is closed. +host.core.management.http-interface.connection-high-water=The maximum number of connections that can be open at any one time. +host.core.management.http-interface.connection-low-water=The number of connections that the open count must reduce to before the connection-high-water level is reset. # Ignored resource ignored-resources=Names of direct child resources of the domain root resource requests for which this Host Controller should ignore. Only relevant on a secondary Host Controller. Configuring such "ignored resources" may help allow a Host Controller from an earlier release to function as a secondary to a Domain Controller running a later release, by letting the secondary ignore portions of the configuration its version of the software cannot understand. This strategy can only be successful if the servers managed by the secondary Host Controller do not reference any of the ignored configuration. diff --git a/host-controller/src/test/java/org/jboss/as/domain/controller/parsing/SupportedNamespaceParsingTestCase.java b/host-controller/src/test/java/org/jboss/as/domain/controller/parsing/SupportedNamespaceParsingTestCase.java index 7490fe9c889..5b270415448 100644 --- a/host-controller/src/test/java/org/jboss/as/domain/controller/parsing/SupportedNamespaceParsingTestCase.java +++ b/host-controller/src/test/java/org/jboss/as/domain/controller/parsing/SupportedNamespaceParsingTestCase.java @@ -10,11 +10,13 @@ import java.io.StringReader; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.jboss.as.controller.parsing.ManagementXmlSchema; @@ -23,6 +25,8 @@ import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.XMLMapper; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import org.projectodd.vdx.core.XMLStreamValidationException; /** @@ -30,6 +34,7 @@ * * @author Darran Lofthouse */ +@RunWith(Parameterized.class) public class SupportedNamespaceParsingTestCase { private static final String TEMPLATE = "" + @@ -44,9 +49,20 @@ public class SupportedNamespaceParsingTestCase { "urn:jboss:domain:1.5", "urn:jboss:domain:1.6"); + private final Stability testStability; + + public SupportedNamespaceParsingTestCase(Stability testStability) { + this.testStability = testStability; + } + + @Parameterized.Parameters + public static Iterable stabilityLevels() { + return Arrays.asList(Stability.DEFAULT, Stability.COMMUNITY, Stability.PREVIEW, Stability.EXPERIMENTAL); + } + @Test public void testNamespaceHandling() throws Exception { - DomainXmlSchemas xmlSchemas = new DomainXmlSchemas(Stability.DEFAULT, null, null, null); + DomainXmlSchemas xmlSchemas = new DomainXmlSchemas(testStability, null, null, null); Set schemas = new HashSet<>(); schemas.add(xmlSchemas.getCurrent()); schemas.addAll(xmlSchemas.getAdditional()); @@ -68,9 +84,16 @@ public void testNamespaceHandling() throws Exception { } catch (XMLStreamValidationException e) { assertTrue("Expected error should be WFLYCTL0513" , e.getMessage().contains("WFLYCTL0513")); } - } else { - // We expect no error if supported. + } else if (testStability.enables(current.getStability())) { + // We expect no error if supported mapper.parseDocument(operationList, reader); + } else { + try { + mapper.parseDocument(operationList, reader); + fail(String.format("Parsing expected to fail due to unsupported stability level %s", currentNamespace)); + } catch (XMLStreamException e) { + assertTrue("Expected error should be WFLYCTL0514" , e.getMessage().contains("WFLYCTL0514")); + } } } } diff --git a/host-controller/src/test/java/org/jboss/as/host/controller/parsing/SupportedNamespaceParsingTestCase.java b/host-controller/src/test/java/org/jboss/as/host/controller/parsing/SupportedNamespaceParsingTestCase.java index fccee87bb92..8e9650b3e14 100644 --- a/host-controller/src/test/java/org/jboss/as/host/controller/parsing/SupportedNamespaceParsingTestCase.java +++ b/host-controller/src/test/java/org/jboss/as/host/controller/parsing/SupportedNamespaceParsingTestCase.java @@ -10,11 +10,13 @@ import java.io.StringReader; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.jboss.as.controller.parsing.ManagementXmlSchema; @@ -22,6 +24,8 @@ import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.XMLMapper; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import org.projectodd.vdx.core.XMLStreamValidationException; /** @@ -29,6 +33,7 @@ * * @author Darran Lofthouse */ +@RunWith(Parameterized.class) public class SupportedNamespaceParsingTestCase { private static final String TEMPLATE = "" + @@ -48,9 +53,20 @@ public class SupportedNamespaceParsingTestCase { "urn:jboss:domain:1.5", "urn:jboss:domain:1.6"); + private final Stability testStability; + + public SupportedNamespaceParsingTestCase(Stability testStability) { + this.testStability = testStability; + } + + @Parameterized.Parameters + public static Iterable stabilityLevels() { + return Arrays.asList(Stability.DEFAULT, Stability.COMMUNITY, Stability.PREVIEW, Stability.EXPERIMENTAL); + } + @Test public void testNamespaceHandling() throws Exception { - HostXmlSchemas xmlSchemas = new HostXmlSchemas(Stability.DEFAULT, "primary", null, false, null, null, null); + HostXmlSchemas xmlSchemas = new HostXmlSchemas(testStability, "primary", null, false, null, null, null); Set schemas = new HashSet<>(); schemas.add(xmlSchemas.getCurrent()); schemas.addAll(xmlSchemas.getAdditional()); @@ -72,9 +88,16 @@ public void testNamespaceHandling() throws Exception { } catch (XMLStreamValidationException e) { assertTrue("Expected error should be WFLYCTL0513" , e.getMessage().contains("WFLYCTL0513")); } - } else { - // We expect no error if supported. + } else if (testStability.enables(current.getStability())) { + // We expect no error if supported mapper.parseDocument(operationList, reader); + } else { + try { + mapper.parseDocument(operationList, reader); + fail(String.format("Parsing expected to fail due to unsupported stability level %s", currentNamespace)); + } catch (XMLStreamException e) { + assertTrue("Expected error should be WFLYCTL0514" , e.getMessage().contains("WFLYCTL0514")); + } } } } diff --git a/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java b/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java index 176f26ff07f..fe36092aeee 100644 --- a/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java +++ b/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java @@ -185,14 +185,14 @@ protected ModelTestModelControllerService(final ProcessType processType, final R /** * This is the constructor to use for current core model tests */ - protected ModelTestModelControllerService(final ProcessType processType, final RunningModeControl runningModeControl, final TransformerRegistry transformerRegistry, + protected ModelTestModelControllerService(final ProcessType processType, final Stability stability, final RunningModeControl runningModeControl, final TransformerRegistry transformerRegistry, final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, final DelegatingResourceDefinition rootResourceDefinition, final ControlledProcessState processState, final ExpressionResolver expressionResolver, final CapabilityRegistry capabilityRegistry) { super(null, null, processType, - Stability.DEFAULT, + stability, runningModeControl, persister, processState == null ? new ControlledProcessState(true) : processState, rootResourceDefinition, diff --git a/server/src/main/java/org/jboss/as/server/mgmt/UndertowHttpManagementService.java b/server/src/main/java/org/jboss/as/server/mgmt/UndertowHttpManagementService.java index 38b3334c4c5..7c329bb4f12 100644 --- a/server/src/main/java/org/jboss/as/server/mgmt/UndertowHttpManagementService.java +++ b/server/src/main/java/org/jboss/as/server/mgmt/UndertowHttpManagementService.java @@ -72,12 +72,6 @@ public class UndertowHttpManagementService implements Service { public static final String JBOSS_REMOTING = "jboss-remoting"; public static final String MANAGEMENT_ENDPOINT = "management-endpoint"; - private static final String PROPERTY_BASE = "org.wildfly.management."; - private static final String BACKLOG_PROPERTY = PROPERTY_BASE + "backlog"; - private static final String CONNECTION_HIGH_WATER_PROPERTY = PROPERTY_BASE + "connection-high-water"; - private static final String CONNECTION_LOW_WATER_PROPERTY = PROPERTY_BASE + "connection-low-water"; - private static final String NO_REQUEST_TIMEOUT_PROPERTY = PROPERTY_BASE + "no-request-timeout"; - private final Consumer httpManagementConsumer; private final Supplier listenerRegistrySupplier; private final Supplier modelControllerSupplier; @@ -100,6 +94,11 @@ public class UndertowHttpManagementService implements Service { private final Supplier consoleAvailabilitySupplier; private final Supplier virtualSecurityDomainSupplier; private final Supplier virtualMechanismFactorySupplier; + // Resource Constraints + private final Integer backlog; + private final Integer noRequestTimeout; + private final Integer connectionHighWater; + private final Integer connectionLowWater; private ManagementHttpServer serverManagement; private SocketBindingManager socketBindingManager; @@ -192,6 +191,9 @@ public boolean hasConsole() { } }; + // These constructors are getting large and unwieldly, but where we use builders we end up triggering more classes to be loaded + // as well as more objects on the heap for a resource that generally comes up once at server start. + public UndertowHttpManagementService(final Consumer httpManagementConsumer, final Supplier listenerRegistrySupplier, final Supplier modelControllerSupplier, @@ -211,11 +213,16 @@ public UndertowHttpManagementService(final Consumer httpManageme final ConsoleMode consoleMode, final Supplier consoleSlot, final Map> constantHeaders, - final Supplier consoleAvailabilitySupplier) { + final Supplier consoleAvailabilitySupplier, + final Integer backlog, + final Integer noRequestTimeout, + final Integer connectionHighWater, + final Integer connectionLowWater) { this(httpManagementConsumer, listenerRegistrySupplier, modelControllerSupplier, socketBindingSupplier, secureSocketBindingSupplier, socketBindingManagerSupplier, interfaceBindingSupplier, secureInterfaceBindingSupplier, requestProcessorSupplier, workerSupplier, executorSupplier, httpAuthFactorySupplier, sslContextSupplier, port, securePort, - allowedOrigins, consoleMode, consoleSlot, constantHeaders, consoleAvailabilitySupplier, null, null); + allowedOrigins, consoleMode, consoleSlot, constantHeaders, consoleAvailabilitySupplier, null, null, + backlog, noRequestTimeout, connectionHighWater, connectionLowWater); } public UndertowHttpManagementService(final Consumer httpManagementConsumer, @@ -239,7 +246,11 @@ public UndertowHttpManagementService(final Consumer httpManageme final Map> constantHeaders, final Supplier consoleAvailabilitySupplier, final Supplier virtualSecurityDomainSupplier, - final Supplier virtualMechanismFactorySupplier) { + final Supplier virtualMechanismFactorySupplier, + final Integer backlog, + final Integer noRequestTimeout, + final Integer connectionHighWater, + final Integer connectionLowWater) { this.httpManagementConsumer = httpManagementConsumer; this.listenerRegistrySupplier = listenerRegistrySupplier; this.modelControllerSupplier = modelControllerSupplier; @@ -262,6 +273,10 @@ public UndertowHttpManagementService(final Consumer httpManageme this.consoleAvailabilitySupplier = consoleAvailabilitySupplier; this.virtualSecurityDomainSupplier = virtualSecurityDomainSupplier; this.virtualMechanismFactorySupplier = virtualMechanismFactorySupplier; + this.backlog = backlog; + this.noRequestTimeout = noRequestTimeout; + this.connectionHighWater = connectionHighWater; + this.connectionLowWater = connectionLowWater; } /** @@ -345,11 +360,6 @@ public synchronized void start(final StartContext context) throws StartException } } - final Integer backlog = Integer.getInteger(BACKLOG_PROPERTY, 50); - final Integer connectionHighWater = Integer.getInteger(CONNECTION_HIGH_WATER_PROPERTY, 100); - final Integer connectionLowWater = Integer.getInteger(CONNECTION_LOW_WATER_PROPERTY, 75); - final Integer noRequestTimeout = Integer.getInteger(NO_REQUEST_TIMEOUT_PROPERTY, 60000); - try { ManagementHttpServer.Builder serverManagementBuilder = ManagementHttpServer.builder() .setBindAddress(bindAddress) diff --git a/server/src/main/java/org/jboss/as/server/operations/HttpManagementAddHandler.java b/server/src/main/java/org/jboss/as/server/operations/HttpManagementAddHandler.java index e78c5757207..72eb125f8ce 100644 --- a/server/src/main/java/org/jboss/as/server/operations/HttpManagementAddHandler.java +++ b/server/src/main/java/org/jboss/as/server/operations/HttpManagementAddHandler.java @@ -156,7 +156,8 @@ public String get() { final Supplier scSupplier = sslContext != null ? builder.requiresCapability(SSL_CONTEXT_CAPABILITY, SSLContext.class, sslContext) : null; final UndertowHttpManagementService undertowService = new UndertowHttpManagementService(hmConsumer, lrSupplier, mcSupplier, sbSupplier, ssbSupplier, sbmSupplier, null, null, rpSupplier, xwSupplier, eSupplier, hafSupplier, scSupplier, null, null, commonPolicy.getAllowedOrigins(), consoleMode, - consoleSlot, commonPolicy.getConstantHeaders(), caSupplier, virtualSecurityDomainSupplier, virtualMechanismFactorySupplier); + consoleSlot, commonPolicy.getConstantHeaders(), caSupplier, virtualSecurityDomainSupplier, virtualMechanismFactorySupplier, + commonPolicy.getBacklog(), commonPolicy.getNoRequestTimeoutMs(), commonPolicy.getConnectionHighWater(), commonPolicy.getConnectionLowWater()); builder.setInstance(undertowService); builder.install(); diff --git a/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java index e4b3d62adf9..162ef07f8a1 100644 --- a/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java +++ b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java @@ -15,8 +15,10 @@ import org.jboss.as.controller.parsing.DeferredExtensionContext; import org.jboss.as.controller.parsing.ExtensionXml; import org.jboss.as.controller.parsing.ManagementXmlReaderWriter; +import org.jboss.as.controller.parsing.ManagementXmlSchema; import org.jboss.as.controller.parsing.ProfileParsingCompletionHandler; import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; import org.jboss.dmr.ModelNode; import org.jboss.modules.ModuleLoader; import org.jboss.staxmapper.IntVersion; @@ -74,8 +76,11 @@ public StandaloneXml(ExtensionHandler handler, DeferredExtensionContext deferred } @Override - public void readElement(final XMLExtendedStreamReader reader, final IntVersion version, final String namespaceUri, final List operationList) + public void readElement(final XMLExtendedStreamReader reader, final VersionedNamespace namespace, final List operationList) throws XMLStreamException { + final IntVersion version = namespace.getVersion(); + final String namespaceUri = namespace.getUri(); + switch (version.major()) { case 1: case 2: @@ -105,15 +110,20 @@ public void readElement(final XMLExtendedStreamReader reader, final IntVersion v case 17: new StandaloneXml_11(extensionHandler, version, namespaceUri, deferredExtensionContext, parsingOptions).readElement(reader, operationList); break; - default: + case 18: + case 19: new StandaloneXml_18(extensionHandler, version, namespaceUri, deferredExtensionContext, parsingOptions).readElement(reader, operationList); + break; + default: + new StandaloneXml_20(extensionHandler, namespace, deferredExtensionContext, parsingOptions).readElement(reader, operationList); } } @Override - public void writeContent(final XMLExtendedStreamWriter writer, final IntVersion version, final String namespaceUri, final ModelMarshallingContext context) + public void writeContent(final XMLExtendedStreamWriter writer, final VersionedNamespace namespace, final ModelMarshallingContext context) throws XMLStreamException { - new StandaloneXml_18(extensionHandler, version, namespaceUri, deferredExtensionContext, parsingOptions).writeContent(writer, context); + + new StandaloneXml_20(extensionHandler, namespace, deferredExtensionContext, parsingOptions).writeContent(writer, context); } class DefaultExtensionHandler implements ExtensionHandler { diff --git a/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml_18.java b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml_18.java index a99bb3719c5..a975aa0c325 100644 --- a/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml_18.java +++ b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml_18.java @@ -9,15 +9,8 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ACCESS; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.AUTHORIZATION; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONTENT; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.EXTENSION; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HTTP_INTERFACE; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HTTP_UPGRADE; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.INTERFACE; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.MANAGEMENT; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.MANAGEMENT_INTERFACE; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NATIVE_INTERFACE; @@ -25,11 +18,8 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ORGANIZATION; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PATH; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOCKET_BINDING; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOCKET_BINDING_GROUP; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SYSTEM_PROPERTY; import static org.jboss.as.controller.parsing.ParseUtils.isNoNamespaceAttribute; import static org.jboss.as.controller.parsing.ParseUtils.isXmlNamespaceAttribute; import static org.jboss.as.controller.parsing.ParseUtils.missingRequired; @@ -41,7 +31,6 @@ import static org.jboss.as.controller.parsing.ParseUtils.requireSingleAttribute; import static org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute; import static org.jboss.as.controller.parsing.ParseUtils.unexpectedElement; -import static org.jboss.as.server.controller.resources.ServerRootResourceDefinition.ORGANIZATION_IDENTIFIER; import java.util.ArrayList; import java.util.Collections; @@ -57,21 +46,17 @@ import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.as.controller.logging.ControllerLogger; -import org.jboss.as.controller.management.BaseHttpInterfaceResourceDefinition; import org.jboss.as.controller.operations.common.Util; import org.jboss.as.controller.parsing.Attribute; import org.jboss.as.controller.parsing.DeferredExtensionContext; import org.jboss.as.controller.parsing.Element; import org.jboss.as.controller.parsing.ParseUtils; import org.jboss.as.controller.parsing.ProfileParsingCompletionHandler; -import org.jboss.as.controller.parsing.WriteUtils; -import org.jboss.as.controller.persistence.ModelMarshallingContext; import org.jboss.as.domain.management.access.AccessAuthorizationResourceDefinition; import org.jboss.as.domain.management.parsing.AccessControlXml; import org.jboss.as.domain.management.parsing.AuditLogXml; import org.jboss.as.domain.management.parsing.ManagementXml; import org.jboss.as.domain.management.parsing.ManagementXmlDelegate; -import org.jboss.as.server.controller.resources.DeploymentAttributes; import org.jboss.as.server.controller.resources.ServerRootResourceDefinition; import org.jboss.as.server.logging.ServerLogger; import org.jboss.as.server.mgmt.HttpManagementResourceDefinition; @@ -82,7 +67,6 @@ import org.jboss.dmr.Property; import org.jboss.staxmapper.IntVersion; import org.jboss.staxmapper.XMLExtendedStreamReader; -import org.jboss.staxmapper.XMLExtendedStreamWriter; /** * Parser and marshaller for standalone server configuration xml documents (e.g. standalone.xml) that use the urn:jboss:domain:19.0 schema. @@ -680,116 +664,6 @@ private void setServerName(final ModelNode address, final List operat } } - void writeContent(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) - throws XMLStreamException { - - ModelNode modelNode = context.getModelNode(); - writer.writeStartDocument(); - writer.writeStartElement(Element.SERVER.getLocalName()); - - if (modelNode.hasDefined(NAME)) { - ServerRootResourceDefinition.NAME.marshallAsAttribute(modelNode, false, writer); - } - - if (modelNode.hasDefined(ORGANIZATION_IDENTIFIER.getName())) { - ServerRootResourceDefinition.ORGANIZATION_IDENTIFIER.marshallAsAttribute(modelNode, false, writer); - } - - writer.writeDefaultNamespace(namespace); - writeNamespaces(writer, modelNode); - writeSchemaLocation(writer, modelNode); - - if (modelNode.hasDefined(EXTENSION)) { - extensionHandler.writeExtensions(writer, modelNode.get(EXTENSION)); - } - - if (modelNode.hasDefined(SYSTEM_PROPERTY)) { - writeProperties(writer, modelNode.get(SYSTEM_PROPERTY), Element.SYSTEM_PROPERTIES, true); - } - - if (modelNode.hasDefined(PATH)) { - writePaths(writer, modelNode.get(PATH), false); - } - - if (modelNode.hasDefined(CORE_SERVICE)) { - ManagementXml managementXml = ManagementXml.newInstance(version, namespace, this, false); - managementXml.writeManagement(writer, modelNode.get(CORE_SERVICE, MANAGEMENT), true); - } - - writeServerProfile(writer, context); - - if (modelNode.hasDefined(INTERFACE)) { - writeInterfaces(writer, modelNode.get(INTERFACE)); - } - - if (modelNode.hasDefined(SOCKET_BINDING_GROUP)) { - Set groups = modelNode.get(SOCKET_BINDING_GROUP).keys(); - if (groups.size() > 1) { - throw ControllerLogger.ROOT_LOGGER.multipleModelNodes(SOCKET_BINDING_GROUP); - } - for (String group : groups) { - writeSocketBindingGroup(writer, modelNode.get(SOCKET_BINDING_GROUP, group), group); - } - } - - if (modelNode.hasDefined(DEPLOYMENT)) { - writeServerDeployments(writer, modelNode.get(DEPLOYMENT)); - WriteUtils.writeNewLine(writer); - } - - if (modelNode.hasDefined(DEPLOYMENT_OVERLAY)) { - writeDeploymentOverlays(writer, modelNode.get(DEPLOYMENT_OVERLAY)); - WriteUtils.writeNewLine(writer); - } - writer.writeEndElement(); - writer.writeEndDocument(); - } - - private void writeServerDeployments(final XMLExtendedStreamWriter writer, final ModelNode modelNode) - throws XMLStreamException { - - boolean deploymentWritten = false; - for (String deploymentName : modelNode.keys()) { - - final ModelNode deployment = modelNode.get(deploymentName); - if (!deployment.isDefined()) { - continue; - } - - if (!deploymentWritten) { - writer.writeStartElement(Element.DEPLOYMENTS.getLocalName()); - deploymentWritten = true; - } - - writer.writeStartElement(Element.DEPLOYMENT.getLocalName()); - WriteUtils.writeAttribute(writer, Attribute.NAME, deploymentName); - DeploymentAttributes.RUNTIME_NAME.marshallAsAttribute(deployment, writer); - DeploymentAttributes.ENABLED.marshallAsAttribute(deployment, writer); - final List contentItems = deployment.require(CONTENT).asList(); - for (ModelNode contentItem : contentItems) { - writeContentItem(writer, contentItem); - } - writer.writeEndElement(); - } - if (deploymentWritten) { - writer.writeEndElement(); - } - } - - private void writeServerProfile(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) - throws XMLStreamException { - - final ModelNode profileNode = context.getModelNode(); - // In case there are no subsystems defined - if (!profileNode.hasDefined(SUBSYSTEM)) { - return; - } - - writer.writeStartElement(Element.PROFILE.getLocalName()); - writeSubsystems(profileNode, writer, context); - writer.writeEndElement(); - } - /* * ManagamentXmlDelegate Methods */ @@ -901,84 +775,4 @@ public boolean parseAuditLog(XMLExtendedStreamReader reader, ModelNode address, return true; } - @Override - public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { - - writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName()); - NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); - NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); - NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); - NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); - - if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) { - writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); - NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); - } - - writer.writeEndElement(); - - return true; - } - - @Override - public boolean writeHttpManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { - - writer.writeStartElement(Element.HTTP_INTERFACE.getLocalName()); - HttpManagementResourceDefinition.HTTP_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); - HttpManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); - HttpManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); - HttpManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); - HttpManagementResourceDefinition.CONSOLE_ENABLED.marshallAsAttribute(protocol, writer); - - HttpManagementResourceDefinition.ALLOWED_ORIGINS.getMarshaller().marshallAsAttribute( - HttpManagementResourceDefinition.ALLOWED_ORIGINS, protocol, true, writer); - - if (HttpManagementResourceDefinition.HTTP_UPGRADE.isMarshallable(protocol)) { - writer.writeEmptyElement(Element.HTTP_UPGRADE.getLocalName()); - HttpManagementResourceDefinition.ENABLED.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer); - HttpManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer); - } - - if (HttpManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol) - || HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.isMarshallable(protocol)) { - writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); - HttpManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); - HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.marshallAsAttribute(protocol, writer); - } - - if (HttpManagementResourceDefinition.CONSTANT_HEADERS.isMarshallable(protocol)) { - writer.writeStartElement(Element.CONSTANT_HEADERS.getLocalName()); - - for (ModelNode headerMapping : protocol.require(ModelDescriptionConstants.CONSTANT_HEADERS).asList()) { - writer.writeStartElement(Element.HEADER_MAPPING.getLocalName()); - BaseHttpInterfaceResourceDefinition.PATH.marshallAsAttribute(headerMapping, writer); - for (ModelNode header : headerMapping.require(ModelDescriptionConstants.HEADERS).asList()) { - writer.writeEmptyElement(Element.HEADER.getLocalName()); - BaseHttpInterfaceResourceDefinition.HEADER_NAME.marshallAsAttribute(header, writer); - BaseHttpInterfaceResourceDefinition.HEADER_VALUE.marshallAsAttribute(header, writer); - } - writer.writeEndElement(); - } - - writer.writeEndElement(); - } - - writer.writeEndElement(); - - return true; - } - - @Override - public boolean writeAccessControl(XMLExtendedStreamWriter writer, ModelNode accessAuthorization) throws XMLStreamException { - accessControlXml.writeAccessControl(writer, accessAuthorization); - - return true; - } - - @Override - public boolean writeAuditLog(XMLExtendedStreamWriter writer, ModelNode auditLog) throws XMLStreamException { - auditLogDelegate.writeAuditLog(writer, auditLog); - - return true; - } } diff --git a/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml_20.java b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml_20.java new file mode 100644 index 00000000000..21d6c78600a --- /dev/null +++ b/server/src/main/java/org/jboss/as/server/parsing/StandaloneXml_20.java @@ -0,0 +1,1034 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.jboss.as.server.parsing; + +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ACCESS; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.AUTHORIZATION; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONNECTION_HIGH_WATER; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONNECTION_LOW_WATER; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONTENT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.EXTENSION; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HTTP_INTERFACE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HTTP_UPGRADE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.INTERFACE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.MANAGEMENT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.MANAGEMENT_INTERFACE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NATIVE_INTERFACE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NATIVE_REMOTING_INTERFACE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NO_REQUEST_TIMEOUT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ORGANIZATION; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PATH; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOCKET_BINDING; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOCKET_BINDING_GROUP; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SYSTEM_PROPERTY; +import static org.jboss.as.controller.parsing.ParseUtils.isNoNamespaceAttribute; +import static org.jboss.as.controller.parsing.ParseUtils.isXmlNamespaceAttribute; +import static org.jboss.as.controller.parsing.ParseUtils.missingRequired; +import static org.jboss.as.controller.parsing.ParseUtils.missingRequiredElement; +import static org.jboss.as.controller.parsing.ParseUtils.nextElement; +import static org.jboss.as.controller.parsing.ParseUtils.requireNamespace; +import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes; +import static org.jboss.as.controller.parsing.ParseUtils.requireNoContent; +import static org.jboss.as.controller.parsing.ParseUtils.requireSingleAttribute; +import static org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute; +import static org.jboss.as.controller.parsing.ParseUtils.unexpectedElement; +import static org.jboss.as.server.controller.resources.ServerRootResourceDefinition.ORGANIZATION_IDENTIFIER; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; + +import org.jboss.as.controller.descriptions.ModelDescriptionConstants; +import org.jboss.as.controller.logging.ControllerLogger; +import org.jboss.as.controller.management.BaseHttpInterfaceResourceDefinition; +import org.jboss.as.controller.operations.common.Util; +import org.jboss.as.controller.parsing.Attribute; +import org.jboss.as.controller.parsing.DeferredExtensionContext; +import org.jboss.as.controller.parsing.Element; +import org.jboss.as.controller.parsing.ManagementXmlSchema; +import org.jboss.as.controller.parsing.ParseUtils; +import org.jboss.as.controller.parsing.ProfileParsingCompletionHandler; +import org.jboss.as.controller.parsing.WriteUtils; +import org.jboss.as.controller.persistence.ModelMarshallingContext; +import org.jboss.as.controller.xml.VersionedNamespace; +import org.jboss.as.domain.management.access.AccessAuthorizationResourceDefinition; +import org.jboss.as.domain.management.parsing.AccessControlXml; +import org.jboss.as.domain.management.parsing.AuditLogXml; +import org.jboss.as.domain.management.parsing.ManagementXml; +import org.jboss.as.domain.management.parsing.ManagementXmlDelegate; +import org.jboss.as.server.controller.resources.DeploymentAttributes; +import org.jboss.as.server.controller.resources.ServerRootResourceDefinition; +import org.jboss.as.server.logging.ServerLogger; +import org.jboss.as.server.mgmt.HttpManagementResourceDefinition; +import org.jboss.as.server.mgmt.NativeManagementResourceDefinition; +import org.jboss.as.server.services.net.SocketBindingGroupResourceDefinition; +import org.jboss.as.version.Stability; +import org.jboss.dmr.ModelNode; +import org.jboss.dmr.ModelType; +import org.jboss.dmr.Property; +import org.jboss.staxmapper.IntVersion; +import org.jboss.staxmapper.XMLExtendedStreamReader; +import org.jboss.staxmapper.XMLExtendedStreamWriter; + +/** + * Parser and marshaller for standalone server configuration xml documents (e.g. standalone.xml) that use the urn:jboss:domain:19.0 schema. + * + * @author Brian Stansberry + * @author David M. Lloyd + * @author Darran Lofthouse + */ +final class StandaloneXml_20 extends CommonXml implements ManagementXmlDelegate { + + private final AccessControlXml accessControlXml; + private final StandaloneXml.ParsingOption[] parsingOptions; + private final IntVersion version; + private final String namespace; + private final Stability stability; + private AuditLogXml auditLogDelegate; + private ExtensionHandler extensionHandler; + private final DeferredExtensionContext deferredExtensionContext; + + StandaloneXml_20(ExtensionHandler extensionHandler, final VersionedNamespace namespace, DeferredExtensionContext deferredExtensionContext, StandaloneXml.ParsingOption... options) { + super(new SocketBindingsXml.ServerSocketBindingsXml()); + this.extensionHandler = extensionHandler; + this.version = namespace.getVersion(); + this.namespace = namespace.getUri(); + this.stability = namespace.getStability(); + this.accessControlXml = AccessControlXml.newInstance(this.namespace); + this.auditLogDelegate = AuditLogXml.newInstance(version, false); + this.deferredExtensionContext = deferredExtensionContext; + this.parsingOptions = options; + } + + @Override + public void readElement(final XMLExtendedStreamReader reader, final List operationList) + throws XMLStreamException { + + long start = System.currentTimeMillis(); + final ModelNode address = new ModelNode().setEmptyList(); + + if (Element.forName(reader.getLocalName()) != Element.SERVER) { + throw unexpectedElement(reader); + } + + readServerElement(reader, address, operationList); + + if (ServerLogger.ROOT_LOGGER.isDebugEnabled()) { + long elapsed = System.currentTimeMillis() - start; + ServerLogger.ROOT_LOGGER.debugf("Parsed standalone configuration in [%d] ms", elapsed); + } + } + + /** + * Read the element. + * + * @param reader the xml stream reader + * @param address address of the parent resource of any resources this method will add + * @param list the list of boot operations to which any new operations should be added + * @throws XMLStreamException if a parsing error occurs + */ + private void readServerElement(final XMLExtendedStreamReader reader, final ModelNode address, final List list) + throws XMLStreamException { + + parseNamespaces(reader, address, list); + + ModelNode serverName = null; + + // attributes + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + if (isNoNamespaceAttribute(reader, i)) { + final String value = reader.getAttributeValue(i); + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case NAME: { + serverName = parseAttributeValue(ServerRootResourceDefinition.NAME, value, reader); + break; + } + case ORGANIZATION: { + setOrganization(address, list, parseAttributeValue(ServerRootResourceDefinition.ORGANIZATION_IDENTIFIER, value, reader)); + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } else if (isXmlNamespaceAttribute(reader, i)) { + switch (Attribute.forName(reader.getAttributeLocalName(i))) { + case SCHEMA_LOCATION: { + parseSchemaLocations(reader, address, list, i); + break; + } + case NO_NAMESPACE_SCHEMA_LOCATION: { + // todo, jeez + break; + } + default: { + throw unexpectedAttribute(reader, i); + } + } + } else { + throw unexpectedAttribute(reader, i); + } + } + + setServerName(address, list, serverName); + + // elements - sequence + + Element element = nextElement(reader, namespace); + if (element == Element.EXTENSIONS) { + extensionHandler.parseExtensions(reader, address, namespace, list); + element = nextElement(reader, namespace); + } + // System properties + if (element == Element.SYSTEM_PROPERTIES) { + parseSystemProperties(reader, address, namespace, list, true); + element = nextElement(reader, namespace); + } + if (element == Element.PATHS) { + parsePaths(reader, address, namespace, list, true); + element = nextElement(reader, namespace); + } + + if (element == Element.MANAGEMENT) { + ManagementXml managementXml = ManagementXml.newInstance(version, namespace, this, false); + managementXml.parseManagement(reader, address, list, false); + element = nextElement(reader, namespace); + } + //load all extensions and initialize the parsers + deferredExtensionContext.load(); + // Single profile + if (element == Element.PROFILE) { + parseServerProfile(reader, address, list); + element = nextElement(reader, namespace); + } + + // Interfaces + final Set interfaceNames = new HashSet(); + if (element == Element.INTERFACES) { + parseInterfaces(reader, interfaceNames, address, version, namespace, list, true); + element = nextElement(reader, namespace); + } + // Single socket binding group + if (element == Element.SOCKET_BINDING_GROUP) { + parseSocketBindingGroup(reader, interfaceNames, address, list); + element = nextElement(reader, namespace); + } + if (element == Element.DEPLOYMENTS) { + parseDeployments(reader, address, namespace, list, EnumSet.of(Attribute.NAME, Attribute.RUNTIME_NAME, Attribute.ENABLED), + EnumSet.of(Element.CONTENT, Element.FS_ARCHIVE, Element.FS_EXPLODED), true); + element = nextElement(reader, namespace); + } + + if (element == Element.DEPLOYMENT_OVERLAYS) { + parseDeploymentOverlays(reader, namespace, new ModelNode(), list, true, true); + element = nextElement(reader, namespace); + } + if (element != null) { + throw unexpectedElement(reader); + } + } + + private void parseHttpManagementInterfaceAttributes(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw unexpectedAttribute(reader, i); + } else { + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case HTTP_AUTHENTICATION_FACTORY: { + HttpManagementResourceDefinition.HTTP_AUTHENTICATION_FACTORY.parseAndSetParameter(value, addOp, reader); + break; + } + case SASL_PROTOCOL: { + HttpManagementResourceDefinition.SASL_PROTOCOL.parseAndSetParameter(value, addOp, reader); + break; + } + case SERVER_NAME: { + HttpManagementResourceDefinition.SERVER_NAME.parseAndSetParameter(value, addOp, reader); + break; + } + case SSL_CONTEXT: { + HttpManagementResourceDefinition.SSL_CONTEXT.parseAndSetParameter(value, addOp, reader); + break; + } + case CONSOLE_ENABLED: { + HttpManagementResourceDefinition.CONSOLE_ENABLED.parseAndSetParameter(value, addOp, reader); + break; + } + case ALLOWED_ORIGINS: { + HttpManagementResourceDefinition.ALLOWED_ORIGINS.getParser().parseAndSetParameter(HttpManagementResourceDefinition.ALLOWED_ORIGINS, value, addOp, reader); + break; + } + case BACKLOG: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.BACKLOG.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } + case NO_REQUEST_TIMEOUT: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.NO_REQUEST_TIMEOUT.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } + case CONNECTION_HIGH_WATER: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.CONNECTION_HIGH_WATER.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } + case CONNECTION_LOW_WATER: { + // Can't pull the Stability level from the attribute definition as to move would mean a new major version of the schema. + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.CONNECTION_LOW_WATER.parseAndSetParameter(value, addOp, reader); + } else { + throw unexpectedAttribute(reader, i); + } + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } + } + } + + private void parseNativeManagementInterfaceAttributes(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw unexpectedAttribute(reader, i); + } else { + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case SASL_AUTHENTICATION_FACTORY: { + NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.parseAndSetParameter(value, addOp, reader); + break; + } + case SASL_PROTOCOL: { + NativeManagementResourceDefinition.SASL_PROTOCOL.parseAndSetParameter(value, addOp, reader); + break; + } + case SERVER_NAME: { + NativeManagementResourceDefinition.SERVER_NAME.parseAndSetParameter(value, addOp, reader); + break; + } + case SSL_CONTEXT: { + NativeManagementResourceDefinition.SSL_CONTEXT.parseAndSetParameter(value, addOp, reader); + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } + } + } + + private void parseNativeManagementInterface(XMLExtendedStreamReader reader, ModelNode address, List list) throws XMLStreamException { + final ModelNode operationAddress = address.clone(); + operationAddress.add(MANAGEMENT_INTERFACE, NATIVE_INTERFACE); + final ModelNode addOp = Util.getEmptyOperation(ADD, operationAddress); + + // Handle attributes + parseNativeManagementInterfaceAttributes(reader, addOp); + + // Handle elements + while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { + requireNamespace(reader, namespace); + final Element element = Element.forName(reader.getLocalName()); + switch (element) { + case SOCKET: + throw ControllerLogger.ROOT_LOGGER.unsupportedElement(reader.getName(),reader.getLocation(), SOCKET_BINDING); + case SOCKET_BINDING: + parseNativeManagementSocketBinding(reader, addOp); + break; + default: + throw unexpectedElement(reader); + } + } + + list.add(addOp); + } + + private void parseHttpManagementInterface(XMLExtendedStreamReader reader, ModelNode address, List list) throws XMLStreamException { + final ModelNode operationAddress = address.clone(); + operationAddress.add(MANAGEMENT_INTERFACE, HTTP_INTERFACE); + final ModelNode addOp = Util.getEmptyOperation(ADD, operationAddress); + + // Handle attributes + parseHttpManagementInterfaceAttributes(reader, addOp); + + // Handle elements + while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { + requireNamespace(reader, namespace); + final Element element = Element.forName(reader.getLocalName()); + switch (element) { + case SOCKET: + throw ControllerLogger.ROOT_LOGGER.unsupportedElement(reader.getName(),reader.getLocation(), SOCKET_BINDING); + case SOCKET_BINDING: + parseHttpManagementSocketBinding(reader, addOp); + break; + case HTTP_UPGRADE: + parseHttpUpgrade(reader, addOp); + break; + case CONSTANT_HEADERS: + parseConstantHeaders(reader, addOp); + break; + default: + throw unexpectedElement(reader); + } + } + + list.add(addOp); + } + + private void parseConstantHeaders(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { + // Attributes + requireNoAttributes(reader); + + ModelNode constantHeaders= new ModelNode(); + // Content + while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { + requireNamespace(reader, namespace); + if (Element.forName(reader.getLocalName()) != Element.HEADER_MAPPING) { + throw unexpectedElement(reader); + } + + ModelNode headerMapping = new ModelNode(); + requireSingleAttribute(reader, Attribute.PATH.getLocalName()); + // After double checking the name of the only attribute we can retrieve it. + HttpManagementResourceDefinition.PATH.parseAndSetParameter(reader.getAttributeValue(0), headerMapping, reader); + ModelNode headers = new ModelNode(); + boolean headerFound = false; + while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { + requireNamespace(reader, namespace); + if (Element.forName(reader.getLocalName()) != Element.HEADER) { + throw unexpectedElement(reader); + } + headerFound = true; + + ModelNode header= new ModelNode(); + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw unexpectedAttribute(reader, i); + } else { + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case NAME: { + HttpManagementResourceDefinition.HEADER_NAME.parseAndSetParameter(value, header, reader); + break; + } + case VALUE: { + HttpManagementResourceDefinition.HEADER_VALUE.parseAndSetParameter(value, header, reader); + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } + } + headers.add(header); + + requireNoContent(reader); + } + if (headerFound == false) { + throw missingRequiredElement(reader, Collections.singleton(Element.HEADER.getLocalName())); + } + + headerMapping.get(ModelDescriptionConstants.HEADERS).set(headers); + constantHeaders.add(headerMapping); + } + + addOp.get(ModelDescriptionConstants.CONSTANT_HEADERS).set(constantHeaders); + } + + private void parseHttpManagementSocketBinding(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { + + // Handle attributes + + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw unexpectedAttribute(reader, i); + } else { + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case HTTP: { + HttpManagementResourceDefinition.SOCKET_BINDING.parseAndSetParameter(value, addOp, reader); + break; + } + case HTTPS: { + HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.parseAndSetParameter(value, addOp, reader); + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } + } + + requireNoContent(reader); + } + + private void parseHttpUpgrade(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { + // Handle attributes + + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw unexpectedAttribute(reader, i); + } else { + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case ENABLED: { + ModelNode httpUpgrade = addOp.get(HTTP_UPGRADE); + HttpManagementResourceDefinition.ENABLED.parseAndSetParameter(value, httpUpgrade, reader); + break; + } + case SASL_AUTHENTICATION_FACTORY: { + ModelNode httpUpgrade = addOp.get(HTTP_UPGRADE); + HttpManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.parseAndSetParameter(value, httpUpgrade, reader); + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } + } + + requireNoContent(reader); + } + + private void parseNativeManagementSocketBinding(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { + + // Handle attributes + boolean hasRef = false; + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw unexpectedAttribute(reader, i); + } else { + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case NATIVE: { + NativeManagementResourceDefinition.SOCKET_BINDING.parseAndSetParameter(value, addOp, reader); + hasRef = true; + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } + } + + if (!hasRef) { + throw missingRequired(reader, Collections.singleton(Attribute.REF.getLocalName())); + } + + requireNoContent(reader); + } + + private void parseNativeRemotingManagementInterface(final XMLExtendedStreamReader reader, final ModelNode address, + final List list) throws XMLStreamException { + + requireNoAttributes(reader); + //requireNoContent(reader); + + final ModelNode connector = new ModelNode(); + connector.get(OP).set(ADD); + ModelNode operationAddress = address.clone(); + operationAddress.add(MANAGEMENT_INTERFACE, NATIVE_REMOTING_INTERFACE); + connector.get(OP_ADDR).set(operationAddress); + list.add(connector); + + reader.discardRemainder(); + } + + private void parseSocketBindingGroup(final XMLExtendedStreamReader reader, final Set interfaces, + final ModelNode address, final List updates) throws XMLStreamException { + + // unique names for both socket-binding and outbound-socket-binding(s) + final Set uniqueBindingNames = new HashSet(); + + ModelNode op = Util.getEmptyOperation(ADD, null); + // Handle attributes + String socketBindingGroupName = null; + + final EnumSet required = EnumSet.of(Attribute.NAME, Attribute.DEFAULT_INTERFACE); + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw unexpectedAttribute(reader, i); + } + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + switch (attribute) { + case NAME: { + socketBindingGroupName = value; + required.remove(attribute); + break; + } + case DEFAULT_INTERFACE: { + SocketBindingGroupResourceDefinition.DEFAULT_INTERFACE.parseAndSetParameter(value, op, reader); + required.remove(attribute); + if (op.get(SocketBindingGroupResourceDefinition.DEFAULT_INTERFACE.getName()).getType() != ModelType.EXPRESSION + && !interfaces.contains(value)) { + throw ControllerLogger.ROOT_LOGGER.unknownInterface(value, Attribute.DEFAULT_INTERFACE.getLocalName(), Element.INTERFACES.getLocalName(), reader.getLocation()); + } + break; + } + case PORT_OFFSET: { + SocketBindingGroupResourceDefinition.PORT_OFFSET.parseAndSetParameter(value, op, reader); + break; + } + default: + throw ParseUtils.unexpectedAttribute(reader, i); + } + } + + if (!required.isEmpty()) { + throw missingRequired(reader, required); + } + + + ModelNode groupAddress = address.clone().add(SOCKET_BINDING_GROUP, socketBindingGroupName); + op.get(OP_ADDR).set(groupAddress); + + updates.add(op); + + // Handle elements + while (reader.nextTag() != END_ELEMENT) { + requireNamespace(reader, namespace); + final Element element = Element.forName(reader.getLocalName()); + switch (element) { + case SOCKET_BINDING: { + final String bindingName = parseSocketBinding(reader, interfaces, groupAddress, updates); + if (!uniqueBindingNames.add(bindingName)) { + throw ControllerLogger.ROOT_LOGGER.alreadyDeclared(Element.SOCKET_BINDING.getLocalName(), Element.OUTBOUND_SOCKET_BINDING.getLocalName(), bindingName, Element.SOCKET_BINDING_GROUP.getLocalName(), socketBindingGroupName, reader.getLocation()); + } + break; + } + case OUTBOUND_SOCKET_BINDING: { + final String bindingName = parseOutboundSocketBinding(reader, interfaces, groupAddress, updates); + if (!uniqueBindingNames.add(bindingName)) { + throw ControllerLogger.ROOT_LOGGER.alreadyDeclared(Element.SOCKET_BINDING.getLocalName(), Element.OUTBOUND_SOCKET_BINDING.getLocalName(), bindingName, Element.SOCKET_BINDING_GROUP.getLocalName(), socketBindingGroupName, reader.getLocation()); + } + break; + } + default: + throw unexpectedElement(reader); + } + } + } + + private void parseServerProfile(final XMLExtendedStreamReader reader, final ModelNode address, final List list) + throws XMLStreamException { + // Attributes + requireNoAttributes(reader); + + // Content + final Map> profileOps = new LinkedHashMap>(); + while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { + if (Element.forName(reader.getLocalName()) != Element.SUBSYSTEM) { + throw unexpectedElement(reader); + } + String namespace = reader.getNamespaceURI(); + if (profileOps.containsKey(namespace)) { + throw ControllerLogger.ROOT_LOGGER.duplicateDeclaration("subsystem", reader.getLocation()); + } + // parse subsystem + final List subsystems = new ArrayList(); + try { + reader.handleAny(subsystems); + } catch (XMLStreamException e) { + if(StandaloneXml.ParsingOption.IGNORE_SUBSYSTEM_FAILURES.isSet(this.parsingOptions)) { + QName element = new QName(reader.getNamespaceURI(), reader.getLocalName()); + ControllerLogger.ROOT_LOGGER.failedToParseElementLenient(e, element.toString()); + reader.discardRemainder(); + } + else { + throw e; + } + } + + profileOps.put(namespace, subsystems); + } + + // Let extensions modify the profile + Set completionHandlers = extensionHandler.getProfileParsingCompletionHandlers(); + for (ProfileParsingCompletionHandler completionHandler : completionHandlers) { + completionHandler.handleProfileParsingCompletion(profileOps, list); + } + + for (List subsystems : profileOps.values()) { + for (final ModelNode update : subsystems) { + // Process relative subsystem path address + final ModelNode subsystemAddress = address.clone(); + for (final Property path : update.get(OP_ADDR).asPropertyList()) { + subsystemAddress.add(path.getName(), path.getValue().asString()); + } + update.get(OP_ADDR).set(subsystemAddress); + list.add(update); + } + } + } + + private void setOrganization(final ModelNode address, final List operationList, final ModelNode value) { + if (value != null && value.isDefined() && value.asString().length() > 0) { + final ModelNode update = Util.getWriteAttributeOperation(address, ORGANIZATION, value); + operationList.add(update); + } + } + private void setServerName(final ModelNode address, final List operationList, final ModelNode value) { + if (value != null && value.isDefined() && value.asString().length() > 0) { + final ModelNode update = Util.getWriteAttributeOperation(address, NAME, value); + operationList.add(update); + } + } + + void writeContent(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) + throws XMLStreamException { + + ModelNode modelNode = context.getModelNode(); + writer.writeStartDocument(); + writer.writeStartElement(Element.SERVER.getLocalName()); + + if (modelNode.hasDefined(NAME)) { + ServerRootResourceDefinition.NAME.marshallAsAttribute(modelNode, false, writer); + } + + if (modelNode.hasDefined(ORGANIZATION_IDENTIFIER.getName())) { + ServerRootResourceDefinition.ORGANIZATION_IDENTIFIER.marshallAsAttribute(modelNode, false, writer); + } + + writer.writeDefaultNamespace(namespace); + writeNamespaces(writer, modelNode); + writeSchemaLocation(writer, modelNode); + + if (modelNode.hasDefined(EXTENSION)) { + extensionHandler.writeExtensions(writer, modelNode.get(EXTENSION)); + } + + if (modelNode.hasDefined(SYSTEM_PROPERTY)) { + writeProperties(writer, modelNode.get(SYSTEM_PROPERTY), Element.SYSTEM_PROPERTIES, true); + } + + if (modelNode.hasDefined(PATH)) { + writePaths(writer, modelNode.get(PATH), false); + } + + if (modelNode.hasDefined(CORE_SERVICE)) { + ManagementXml managementXml = ManagementXml.newInstance(version, namespace, this, false); + managementXml.writeManagement(writer, modelNode.get(CORE_SERVICE, MANAGEMENT), true); + } + + writeServerProfile(writer, context); + + if (modelNode.hasDefined(INTERFACE)) { + writeInterfaces(writer, modelNode.get(INTERFACE)); + } + + if (modelNode.hasDefined(SOCKET_BINDING_GROUP)) { + Set groups = modelNode.get(SOCKET_BINDING_GROUP).keys(); + if (groups.size() > 1) { + throw ControllerLogger.ROOT_LOGGER.multipleModelNodes(SOCKET_BINDING_GROUP); + } + for (String group : groups) { + writeSocketBindingGroup(writer, modelNode.get(SOCKET_BINDING_GROUP, group), group); + } + } + + if (modelNode.hasDefined(DEPLOYMENT)) { + writeServerDeployments(writer, modelNode.get(DEPLOYMENT)); + WriteUtils.writeNewLine(writer); + } + + if (modelNode.hasDefined(DEPLOYMENT_OVERLAY)) { + writeDeploymentOverlays(writer, modelNode.get(DEPLOYMENT_OVERLAY)); + WriteUtils.writeNewLine(writer); + } + writer.writeEndElement(); + writer.writeEndDocument(); + } + + private void writeServerDeployments(final XMLExtendedStreamWriter writer, final ModelNode modelNode) + throws XMLStreamException { + + boolean deploymentWritten = false; + for (String deploymentName : modelNode.keys()) { + + final ModelNode deployment = modelNode.get(deploymentName); + if (!deployment.isDefined()) { + continue; + } + + if (!deploymentWritten) { + writer.writeStartElement(Element.DEPLOYMENTS.getLocalName()); + deploymentWritten = true; + } + + writer.writeStartElement(Element.DEPLOYMENT.getLocalName()); + WriteUtils.writeAttribute(writer, Attribute.NAME, deploymentName); + DeploymentAttributes.RUNTIME_NAME.marshallAsAttribute(deployment, writer); + DeploymentAttributes.ENABLED.marshallAsAttribute(deployment, writer); + final List contentItems = deployment.require(CONTENT).asList(); + for (ModelNode contentItem : contentItems) { + writeContentItem(writer, contentItem); + } + writer.writeEndElement(); + } + if (deploymentWritten) { + writer.writeEndElement(); + } + } + + private void writeServerProfile(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) + throws XMLStreamException { + + final ModelNode profileNode = context.getModelNode(); + // In case there are no subsystems defined + if (!profileNode.hasDefined(SUBSYSTEM)) { + return; + } + + writer.writeStartElement(Element.PROFILE.getLocalName()); + writeSubsystems(profileNode, writer, context); + writer.writeEndElement(); + } + + /* + * ManagamentXmlDelegate Methods + */ + + @Override + public boolean parseManagementInterfaces(final XMLExtendedStreamReader reader, final ModelNode address, + final List list) throws XMLStreamException { + requireNoAttributes(reader); + + while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { + requireNamespace(reader, namespace); + final Element element = Element.forName(reader.getLocalName()); + switch (element) { + case NATIVE_INTERFACE: { + parseNativeManagementInterface(reader, address, list); + break; + } + case HTTP_INTERFACE: { + parseHttpManagementInterface(reader, address, list); + break; + } + case NATIVE_REMOTING_INTERFACE: { + parseNativeRemotingManagementInterface(reader, address, list); + break; + } + default: { + throw unexpectedElement(reader); + } + } + } + + return true; + } + + @Override + public boolean parseAccessControl(XMLExtendedStreamReader reader, ModelNode address, List operationsList) + throws XMLStreamException { + + ModelNode accAuthzAddr = address.clone().add(ACCESS, AUTHORIZATION); + + final int count = reader.getAttributeCount(); + for (int i = 0; i < count; i++) { + + final String value = reader.getAttributeValue(i); + if (!isNoNamespaceAttribute(reader, i)) { + throw ParseUtils.unexpectedAttribute(reader, i); + } + + final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); + if (null == attribute) { + throw unexpectedAttribute(reader, i); + } + switch (attribute) { + case PROVIDER: + { + ModelNode provider = AccessAuthorizationResourceDefinition.PROVIDER.getParser().parse(AccessAuthorizationResourceDefinition.PROVIDER, value, reader); + ModelNode op = Util.getWriteAttributeOperation(accAuthzAddr, + AccessAuthorizationResourceDefinition.PROVIDER.getName(), provider); + operationsList.add(op); + break; + } + case USE_IDENTITY_ROLES: + { + ModelNode useIdentityRoles = AccessAuthorizationResourceDefinition.USE_IDENTITY_ROLES.getParser().parse(AccessAuthorizationResourceDefinition.USE_IDENTITY_ROLES, value, reader); + ModelNode op = Util.getWriteAttributeOperation(accAuthzAddr, + AccessAuthorizationResourceDefinition.USE_IDENTITY_ROLES.getName(), useIdentityRoles); + operationsList.add(op); + break; + } + case PERMISSION_COMBINATION_POLICY: + { + ModelNode provider = AccessAuthorizationResourceDefinition.PERMISSION_COMBINATION_POLICY.getParser().parse(AccessAuthorizationResourceDefinition.PERMISSION_COMBINATION_POLICY, value, reader); + ModelNode op = Util.getWriteAttributeOperation(accAuthzAddr, + AccessAuthorizationResourceDefinition.PERMISSION_COMBINATION_POLICY.getName(), provider); + operationsList.add(op); + break; + } + default: + throw unexpectedAttribute(reader, i); + } + } + + while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { + requireNamespace(reader, namespace); + final Element element = Element.forName(reader.getLocalName()); + switch (element) { + case ROLE_MAPPING: { + accessControlXml.parseAccessControlRoleMapping(reader, accAuthzAddr, operationsList); + break; + } + case CONSTRAINTS: { + accessControlXml.parseAccessControlConstraints(reader, accAuthzAddr, operationsList); + break; + } + default: { + throw unexpectedElement(reader); + } + } + } + + return true; + } + + @Override + public boolean parseAuditLog(XMLExtendedStreamReader reader, ModelNode address, List list) + throws XMLStreamException { + auditLogDelegate.parseAuditLog(reader, address, namespace, list); + + return true; + } + + @Override + public boolean writeNativeManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { + + writer.writeStartElement(Element.NATIVE_INTERFACE.getLocalName()); + NativeManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); + NativeManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); + NativeManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); + NativeManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); + + if (NativeManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol)) { + writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); + NativeManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); + } + + writer.writeEndElement(); + + return true; + } + + @Override + public boolean writeHttpManagementProtocol(XMLExtendedStreamWriter writer, ModelNode protocol) throws XMLStreamException { + + writer.writeStartElement(Element.HTTP_INTERFACE.getLocalName()); + HttpManagementResourceDefinition.HTTP_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.SSL_CONTEXT.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.SASL_PROTOCOL.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.SERVER_NAME.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.CONSOLE_ENABLED.marshallAsAttribute(protocol, writer); + if (stability.enables(Stability.COMMUNITY)) { + HttpManagementResourceDefinition.BACKLOG.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.NO_REQUEST_TIMEOUT.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.CONNECTION_HIGH_WATER.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.CONNECTION_LOW_WATER.marshallAsAttribute(protocol, writer); + } + + HttpManagementResourceDefinition.ALLOWED_ORIGINS.getMarshaller().marshallAsAttribute( + HttpManagementResourceDefinition.ALLOWED_ORIGINS, protocol, true, writer); + + if (HttpManagementResourceDefinition.HTTP_UPGRADE.isMarshallable(protocol)) { + writer.writeEmptyElement(Element.HTTP_UPGRADE.getLocalName()); + HttpManagementResourceDefinition.ENABLED.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer); + HttpManagementResourceDefinition.SASL_AUTHENTICATION_FACTORY.marshallAsAttribute(protocol.require(HTTP_UPGRADE), writer); + } + + if (HttpManagementResourceDefinition.SOCKET_BINDING.isMarshallable(protocol) + || HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.isMarshallable(protocol)) { + writer.writeEmptyElement(Element.SOCKET_BINDING.getLocalName()); + HttpManagementResourceDefinition.SOCKET_BINDING.marshallAsAttribute(protocol, writer); + HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.marshallAsAttribute(protocol, writer); + } + + if (HttpManagementResourceDefinition.CONSTANT_HEADERS.isMarshallable(protocol)) { + writer.writeStartElement(Element.CONSTANT_HEADERS.getLocalName()); + + for (ModelNode headerMapping : protocol.require(ModelDescriptionConstants.CONSTANT_HEADERS).asList()) { + writer.writeStartElement(Element.HEADER_MAPPING.getLocalName()); + BaseHttpInterfaceResourceDefinition.PATH.marshallAsAttribute(headerMapping, writer); + for (ModelNode header : headerMapping.require(ModelDescriptionConstants.HEADERS).asList()) { + writer.writeEmptyElement(Element.HEADER.getLocalName()); + BaseHttpInterfaceResourceDefinition.HEADER_NAME.marshallAsAttribute(header, writer); + BaseHttpInterfaceResourceDefinition.HEADER_VALUE.marshallAsAttribute(header, writer); + } + writer.writeEndElement(); + } + + writer.writeEndElement(); + } + + writer.writeEndElement(); + + return true; + } + + @Override + public boolean writeAccessControl(XMLExtendedStreamWriter writer, ModelNode accessAuthorization) throws XMLStreamException { + accessControlXml.writeAccessControl(writer, accessAuthorization); + + return true; + } + + @Override + public boolean writeAuditLog(XMLExtendedStreamWriter writer, ModelNode auditLog) throws XMLStreamException { + auditLogDelegate.writeAuditLog(writer, auditLog); + + return true; + } +} diff --git a/server/src/main/resources/org/jboss/as/server/controller/descriptions/LocalDescriptions.properties b/server/src/main/resources/org/jboss/as/server/controller/descriptions/LocalDescriptions.properties index a5e83cebfe6..4d6a9331464 100644 --- a/server/src/main/resources/org/jboss/as/server/controller/descriptions/LocalDescriptions.properties +++ b/server/src/main/resources/org/jboss/as/server/controller/descriptions/LocalDescriptions.properties @@ -174,6 +174,10 @@ core.management.http-interface.http-upgrade-enabled.deprecated=Instead use http- core.management.http-interface.http-upgrade=HTTP Upgrade specific configuration core.management.http-interface.http-upgrade.enabled=Flag that indicates HTTP Upgrade is enabled, which allows HTTP requests to be upgraded to native remoting connections core.management.http-interface.http-upgrade.sasl-authentication-factory=The server side SASL authentication policy to use to secure the interface where the connection is after a HTTP upgrade. +core.management.http-interface.backlog=The maximum number of pending connections on the socket. +core.management.http-interface.no-request-timeout=The maximum time in milliseconds a connection can be idle without a HTTP request before it is closed. +core.management.http-interface.connection-high-water=The maximum number of connections that can be open at any one time. +core.management.http-interface.connection-low-water=The number of connections that the open count must reduce to before the connection-high-water level is reset. core.service-container=The central container that manages all services in a running standalone server or in a host controller in a management domain. core.module-loading=The modular classloading system. core.module-loading.module-roots=A list of filesystem locations under which the module loading system looks for modules, arranged in order of precedence. diff --git a/server/src/main/resources/schema/wildfly-config_community_20_0.xsd b/server/src/main/resources/schema/wildfly-config_community_20_0.xsd new file mode 100644 index 00000000000..c4c27b0059a --- /dev/null +++ b/server/src/main/resources/schema/wildfly-config_community_20_0.xsd @@ -0,0 +1,3909 @@ + + + + + + + + + + + + Root element for the main document specifying the core configuration + for the servers in a domain. There should be one such main + document per domain, available to the host controller that + is configured to act as the domain controller. + + + + + + + + + + + + + + + + + + + + + The name to use for the domain controller. Useful for administrators who need to work with multiple domains. + + + + + + + The name of the organization running this domain. + + + + + + + + + + Root element for a document configuring a host controller and + the group of servers under the control of that host controller. + The standard usage would be for a domain to have one such host controller + on each physical (or virtual) host machine. Emphasis in this + document is on enumerating the servers, configuring items that + are specific to the host environment (e.g. IP addresses), and + on any server-specific configuration settings. + + + + + + + + + + + + + + + + + + + The name to use for this host's host controller. Must be unique across the domain. + If not set, defaults to the runtime value "HOSTNAME" or "COMPUTERNAME" environment variables, + or, if neither environment variable is present, to the value of InetAddress.getLocalHost().getHostName(). + + If the special value "jboss.domain.uuid" is used, a java.util.UUID will be created + and used, based on the value of InetAddress.getLocalHost(). + + + + + + + The name of the organization running this host. + + + + + + + + + + Root element for a document specifying the configuration + of a single "standalone" server that does not operate + as part of a domain. + + Note that this element is distinct from the 'serverType' + specified in this schema. The latter type forms part of the + configuration of a server that operates as part of a domain. + + + + + + + + + + + + + + + + + + The name to use for this server. + If not set, defaults to the runtime value "HOSTNAME" or "COMPUTERNAME" environment variables, + or, if neither environment variable is present, to the value of InetAddress.getLocalHost().getHostName(). + + If the special value "jboss.domain.uuid" is used, a java.util.UUID will be created + and used, based on the value of InetAddress.getLocalHost(). + + + + + + + The name of the organization running this server. + + + + + + + + + + Domain-wide default configuration settings for the management of standalone servers and a Host Controller. + + + + + + + Configuration for the history of configuration changes. + + + + + + + Number of configuration changes that are available in history. + + + + + + + + + + + + + The centralized configuration for the management of a Host Controller. + + + + + + + + + + + + + + + + + + + + + + + + + The centralized configuration for the management of standalone server. + + + + + + + + + + + + + + + + + + + + + + + + + The centralized configuration for domain-wide management. + + + + + + + + + + A list of URLs. + + + + + + + A list of String. + + + + + + + + Configuration of the secret/password-based identity of this server. + + + + + + + Credential to be used by as protection parameter for the Credential Store. + + + + + + + + The secret / password - Base64 Encoded + + + + + + + + + The keystore configuration for the server. + + + + + + + Credential reference to be used by as protection parameter for the Keystore. + + + + + + + + The password to open the keystore. + + + + + + + + + This is a more complex keystore definition which also allows for an alias + and key password to be specified. + + + + + + + + + Credential reference to be used by as protection parameter when loading keys from the keystore. + + + + + + + + The alias of the entry to use from the keystore, if specified all remaining + entries in the keystore will be ignored. + + Note: The use of aliases is only available for JKS based stores, for other store types this will be ignored. + + + + + + + The password to use when loading keys from the keystore. + + + + + + + If this is set and the key store does not exist then a new keystore will be created and a + self-signed certificate will be generated. The host name for the self-signed certificate + will be the value of this attribute. + + This is not intended for production use. + + + + + + + + + + + An extension of keyStoreType used for audit logging configuration. + + + + + + + + The path of the keystore, this is required if the provider is JKS otherwise it will be ignored. + + + + + + + The name of another previously named path, or of one of the + standard paths provided by the system. If 'relative-to' is + provided, the value of the 'path' attribute is treated as + relative to the path specified by this + attribute. + + + + + + + + + + + An audit specific extension of the extended key store type. + + + + + + + + The path of the keystore, this is required if the provider is JKS otherwise it will be ignored. + + + + + + + The name of another previously named path, or of one of the + standard paths provided by the system. If 'relative-to' is + provided, the value of the 'path' attribute is treated as + relative to the path specified by this + attribute. + + + + + + + + + + + Declaration of management operation audit logging formatters. + + + + + + + + + + + Shared configuration for audit log formatters.. + + + + + + The name of the formatter. Must be unique across all types of formatter + (there is only the JSON formatter at present but more are planned for the + future) + + + + + + + Whether or not to include the date in the formatted log record + + + + + + + The date format to use as understood by {@link java.text.SimpleDateFormat}. + Will be ignored if include-date="false". + + + + + + + The separator between the date and the rest of the formatted log message. + Will be ignored if include-date="false". + + + + + + + + + Configuration of a JSON formatter for the audit log. + + + + + + + + If true will format the JSON on one line. There may still be + values containing new lines, so if having the whole record on + one line is important, set escape-new-line or escape-control-characters to true. + + + + + + + If true will escape all new lines with the ascii code in octal, + e.g. #012. + + + + + + + If true will escape all control characters (ascii entries with a decimal + value less than 32) with the ascii code in octal, e.g.'\n\ becomes '#012'. + If this is true, it will override escape-new-line="false" + + + + + + + + + + + Declaration of management operation audit logging handlers. + + + + + + + + + + + + Configuration of a in memory handler for the audit log. + + + + + + The name of the handler. The name must be unique across all types of handler. + + + + + + + The number of logging entries stored in memory. + + + + + + + + + + + + Common configuration of a handler for the audit log. + + + + + + The name of the handler. The name must be unique across all types of handler. + + + + + + + The name of the formatter to use for the handler. + + + + + + + The number of logging failures before this handler is disabled. + + + + + + + + + Configuration of a simple file handler for the audit log. This writes to a local file. + + + + + + + + The path of the audit log. + + + + + + + The name of another previously named path, or of one of the + standard paths provided by the system. If 'relative-to' is + provided, the value of the 'path' attribute is treated as + relative to the path specified by this attribute. + + + + + + + + + + + Configuration of a simple file handler for the audit log. This writes to a local file. + + + + + + + + Whether or not should an old log file be rotated during a handler initialization. + + + + + + + + + + + Configuration of a size rotating file handler for the audit log. This writes to a local file, + rotating the log after the size of the file grows beyond a certain point and keeping + a fixed number of backups.. + + + + + + + + The size at which to rotate the log file. + + + + + + + The maximum number of backups to keep. + + + + + + + + + + + Configuration of a periodic rotating file handler for the audit log. This writes to a local file, + rotating the log after a time period derived from the given suffix string, + which should be in a format understood by java.text.SimpleDateFormat. + + + + + + + + The suffix string in a format which can be understood by java.text.SimpleDateFormat. + The period of the rotation is automatically calculated based on the suffix. + + + + + + + + + + A positive number optionally followed by one of [bBkKmMgGtT] + + + + + + + + + + Configuration of a syslog file handler for the audit log on a server. This writes to syslog server. + + + + + + + + The configuration of the protocol to use communication with the syslog server. See your + syslog provider's documentation for configuration options. + + + + + + + + + + + + + The format to use for the syslog messages. See your syslog provider's documentation for what is supported. + + + + + + + Format the syslog data according to the RFC-5424 standard + + + + + Format the syslog data according to the RFC-3164 standard + + + + + + + + + The maximum length in bytes a log message, including the header, is allowed to be. If undefined, it will default to 1024 bytes if the syslog-format is RFC3164, or 2048 bytes if the syslog-format is RFC5424. + + + + + + + Whether or not a message, including the header, should truncate the message if the length in bytes is greater than the maximum length. If set to false messages will be split and sent with the same header values. + + + + + + + The facility to use for syslog logging as defined in section 6.2.1 of RFC-5424, and section 4.1.1 of RFC-3164. + The numerical values in the enumeration entries, is the numerical value as defined in the RFC. + + + + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + + + + + The application name to add to the syslog records as defined in section 6.2.5 of RFC-5424. If not specified it will default to the name of the product. + + + + + + + + + + + + The host of the syslog server. + + + + + + + The port of the syslog server. + + + + + + + + Configure udp as the protocol for communicating with the syslog server + + + + + + + + + Configure tcp as the protocol for communicating with the syslog server + + + + + + + The message transfer setting as described in section 3.4 of RFC-6587. See your syslog provider's + documentation for what is supported + + + + + + + + Use the octet counting format for message transfer as described in section 3.4.1 of RFC-6587. + + + + + + + Use the non-transparent-framing format for message transfer as described in section 3.4.1 of RFC-6587. + + + + + + + + + + If a connection drop is detected, the number of seconds to wait before reconnecting. A negative number means + don't reconnect automatically. + + + + + + + + + + Configure tls as the protocol for communicating with the syslog server + + + + + + + + Configuration of a keystore to use to create a trust manager to verify the server + certificate for encrypted communications. If the server certificate is signed off by a + signing authority, tls can be used without a truststore. + + + + + + + Configuration of a keystore containing a client certificate and a private key, e.g. in + PKCS12 format. This turns on authenticating the clients against the syslog server. + + + + + + + + + + + + Declaration of management operation audit logging configuration coming from the model controller core. + + + + + + + + + Whether operations should be logged on boot. + + + + + + + Whether operations that do not modify the configuration or any runtime services should be logged. + + + + + + + Whether audit logging is enabled. + + + + + + + + + References to audit-log-handlers defined in the audit-log-handlers section + + + + + + + + + + + A reference to an audit-log-handler defined in the audit-log-appenders section + + + + + + + + + + + + + + + + + Reference to the SSLContext to use for this management interface. + + + + + + + Where Remoting is accepting incomming connections part of the authentication process + advertises the name of the protocol in use, by default this is 'remote' but this attribute + can be set if an alternative is required. + + + + + + + Where Remoting is accepting incomming connection the initial exchange and the authentication + process both advertise the name of the server, by default this is derived from the address Remoting + is listening on but this attribute can be set to override the name. + + + + + + + + + + + + + HTTP Upgrade configuration on the management interface. + + + + + + + Is HTTP Upgrade to 'remote' enabled. + + + + + + + The SASL authentication policy to secure connections upgraded from HTTP. + + + + + + + + + + + The HTTP authentication factory to use to secure normal HTTP requests. + + + + + + + The maximum number of pending connections on the socket. + + + + + + + The maximum time in milliseconds a connection can be idle without a HTTP request before it is closed. + + + + + + + The maximum number of connections that can be open at any one time. + + Once reached no further connections will be accepted until the count reduces to the connection-low-water level. + + + + + + + The number of connections that the open count must reduce to before the connection-high-water level is reset. + + + + + + + + + + + Definition to HTTP headers to be added to responses based on the path of the request. + + + + + + + + + + + + The name of the header to set. + + Must be a valid HTTP Header name. + + + + + + + The value to set the header to. + + + + + + + + + + The path prefix this header mapping applies to. + + + + + + + + + + + + + + + The SASL server authentication policy to secure connections upgraded from HTTP. + + + + + + + + + + + Configuration of a host's exposed native management interface. + + + + + + + + + + + + + + + Configuration of the socket used by host or standalone server's exposed management interface. + + + + + + Network interface on which the host's socket for + management communication should be opened. + + + + + + + + + Configuration of the socket used by host or standalone server's exposed HTTP management interface. + + + + + + + + Port on which the host's socket for native + management communication should be opened. + + + + + + + + + + + Configuration of a host's exposed HTTP management interface. + + + + + + + + + + + + + + + + Configuration of the socket used by host or standalone server's exposed HTTP management interface. + + + + + + + + Port on which the host's socket for + management communication should be opened. + + If not specified the port will not be opened. + + + + + + + Port on which the host's socket for HTTPS + management communication should be opened. + + If not specified the port will not be opened. + + If specified an ssl-context will be + required to obtain the SSL configuration. + + + + + + + + + + + Configuration of the socket used by host's exposed HTTP management interface. + + + + + + + + Network interface on which the host's socket for + HTTPS management communication should be opened + if a different interface should be used from that + specified by the 'interface' attribute. + + If not specified the interface specified by the 'interface' + attribute will be used. + + Has no effect if the 'secure-port' attribute is not set. + + If specified with a different value from the 'interface' + attribute, redirect of HTTPS requests received on the HTTP + socket to the HTTPS address will not be supported. + + If specified an ssl-context will be + required to obtain the SSL configuration. + + + + + + + + + + + + + + + + + + + Configuration of the socket used by host or standalone server's exposed HTTP management interface. + + + + + + + Configuration of the socket to use for the native management interface is a choice + between a direct configuration of the address and port, or a reference to a socket-binding + configuration in the server's socket-binding-group element. The latter is the recommended + approach as it makes it easier to avoid port conflicts by taking advantage of the + socket-binding-group's port-offset configuration. Direct configuration of the address and + ports is deprecated and is only provided to preserve backward compatibility. + + + + + + + Deprecated. Use 'socket-binding' + + + + + + + + + + + + + Reference to the configuration of the socket to be used by a standalone server's exposed native management interface. + + + + + + Name of a socket-binding configuration declared in the server's socket-binding-group. + + + + + + + + + Configuration of a standalone server's exposed HTTP/HTTPS management interface. + + + + + + + Configuration of the socket to use for the HTTP/HTTPS management interface is a choice + between a direct configuration of the address and ports, or a reference to socket-binding + configurations in the server's socket-binding-group element. The latter is the recommended + approach as it makes it easier to avoid port conflicts by taking advantage of the + socket-binding-group's port-offset configuration. Direct configuration of the address and + ports is deprecated and is only provided to preserve backward compatibility. + + + + + + + Deprecated. Use 'socket-binding' + + + + + + + + + + A space separated list of Origins that will be trusted to send request to the management + API once the user is authenticated. This is used following the Cross-Origin Resource Sharing + recommendation (http://www.w3.org/TR/access-control/). + + + + + + + + + + + Reference to the configurations of the sockets to be used by a standalone server's exposed HTTP and HTTPS management interface. + + + + + + Name of a socket-binding configuration declared in the server's socket-binding-group to use for a HTTP socket. + + + + + + + Name of a socket-binding configuration declared in the server's socket-binding-group to use for a HTTPS socket. + + Note: When specified the interface must also be configured to reference an ssl-context. + + + + + + + + + Makes the native management interface available via the connectors set up in the remoting subsystem, + using the remoting subsystem's endpoint. This should only be used for a server not for a HC/DC. + + + + + + + + + + + + + + + + + + + + + + + + + + The remote domain controller's protocol. If not set, a discovery option must be provided, + or the --cached-dc startup option must be used, or the --admin-only startup option must be used + with the 'admin-only-policy' attribute set to a value other than 'fetch-from-domain-controller'. + + + + + + + The remote domain controller's host name. If not set, a discovery option must be provided, + or the --cached-dc startup option must be used, or the --admin-only startup option must be used + with the 'admin-only-policy' attribute set to a value other than 'fetch-from-domain-controller'. + + + + + + + The remote domain controller's port. If not set, a discovery option must be provided, + or the --cached-dc startup option must be used, or the --admin-only startup option must be used + with the 'admin-only-policy' attribute set to a value other than 'fetch-from-domain-controller'. + + + + + + + Reference to the authentication-context to use when establishing the remote connection. + + + + + + + + When set to true, this instructs the Domain Controller to not forward configuration and + operations for profiles, socket binding groups and server groups which do not affect our servers. + Setting to false will ensure that all of this configuration information is copied. Note that using + the '--backup' startup option on the command line will set this to false if the value is unspecified + in host.xml. If the value is specified in host.xml, then using '--backup' will not override the + specified value (for example: setting ignore-unused-configuration="true" and using --backup will + not override the value of ignore-unused-configuration, which will remain true). If --backup is not + used, this value will be true at runtime. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides names of direct child resources of the domain root resource requests for which the + Host Controller should ignore. Only relevant on a secondary Host Controller. Configuring such + "ignored resources" may help allow a Host Controller from an earlier release to function as a + secondary Host Controller to a primary Host Controller running a later release, by letting the secondary + ignore portions of the configuration its version of the software cannot understand. This strategy can + only be successful if the servers managed by the secondary Host Controller do not reference any of the + ignored configuration. + + Supports the following attributes: + + type -- the type of resource (e.g. 'profile' or 'socket-binding-group') certain instances of which + should be ignored. The value corresponds to the 'key' portion of the first element in the + resource's address (e.g. 'profile' in the address /profile=ha/subsystem=web) + + wildcard -- if 'true', all resources of the given type should be ignored. + + Child elements list the names of specific instances of the given type of resource + that should be ignored. Each element in the list corresponds to the 'value' portion of + the first element in the resource's address (e.g. 'ha' in the address /profile=ha/subsystem=web.) + + + + + + + + + + + + + + The name of a specific instances of a particular type of resource that should be ignored. + The 'name' attribute corresponds to the 'value' portion of the first element in the resource's address + (e.g. 'ha' in the address /profile=ha/subsystem=web.) + + + + + + + + + + + + + + + + + + + + The name for this domain controller discovery option. + + + + + + + The fully qualified class name for the DiscoveryOption implementation. + + + + + + + The module from which the DiscoveryOption implementation should be loaded. If not provided, + the DiscoveryOption implementation must be available from the Host Controller's own module. + + + + + + + + + + The name for this domain controller discovery option. + + + + + + + The remote domain controller's protocol. + + + + + + + The remote domain controller's host name. + + + + + + + The remote domain controller's port. + + + + + + + + + + + + + + + + Indicates each server's writable directories should be grouped under the server's name + in the domain/servers directory. This is the default option. + + + + + + + Indicates each server's writable directories should be grouped based on their "type" + (i.e. "data", "log", "tmp") with directories of a given type for all servers appearing + in the domain level directory for that type, e.g. domain/data/servers/server-name. + + + + + + + + + + + + + + + + + + + + + + + Configuration of the SSLContext used for the connection from the application server back to it's host controller. + + + + + + + + + + + Iif the server last status (STARTED or STOPPED) is to be used to define the value of auto-start. + + + + + + + + + + The protocol to initialise the SSLContext, if 'Default' is specified the JVM wide default SSLContext will be used instead. + + + + + + + The algorithm to use when initialising the TrustManagerFactory. + + If not specified the JVM default is used instead. + + + + + + + The type of the trust store. + + If not specified the JVM default is used instead. + + + + + + + The fully qualified path to the truststore. + + If not specified the no file will be used to initialise the truststore. + + + + + + + The password to open the truststore. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contains a list of extension modules. + + + + + + + + + + A module that extends the standard capabilities of a domain + or a standalone server. + + + + + The name of the module + + + + + + + + + + + + + + + + + + + + + + + + The name of the server group + + + + + + + The name of the profile this server is running. + + + + + + + Set to true to have servers in the group start gracefully, queuing or cleanly rejecting incoming + requests until the server is fully started. If set to false, the server will pass the request to the + appropriate subsystem for processing, irrespective of whether or not that system is ready. + + + + + + + Set to true to have servers belonging to the server group connect back to the host controller using the + endpoint from their remoting subsystem. The subsystem must be preset for this to + work. + + + + + + + + Contains a list of deployments that have been mapped to a server-group. + + + + + + + + + A deployment that has been mapped to a server group. + + + + + + + Whether the deployment deploy automatically when the server starts up. + + + + + + + + + + + Unique identifier of the deployment. Must be unique across all deployments. + + + + + + Name by which the deployment will be known within a running server.of the deployment. + Does not need to be unique across all deployments in the domain, although it must be unique within + an individual server. For example, two different deployments running on different servers in + the domain could both have a 'runtime-name' of 'example.war', with one having a 'name' + of 'example.war_v1' and another with an 'name' of 'example.war_v2'. + + + + + + + + Contains a list of deployments that have been mapped to a server. + + + + + + + + + A deployment that has been mapped to a server. + + + + + + + + + + + + + + + Whether the deployment deploy automatically when the server starts up. + + + + + + + + + + + The checksum of the content + + + + + + + Archived content found on the filesystem + + + + + + + + + + + + + + + + Exploded content found on the filesystem + + + + + + + + + Contains a list of domain-level deployments + + + + + + + + + Deployment represents anything that can be deployed (e.g. an application such as EJB-JAR, + WAR, EAR, + any kind of standard archive such as RAR or JBoss-specific deployment), + which can be enabled or disabled on a domain level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The domain controller/server bootstrap configuration + + + + + + + + The URI for bootstrapping a domain server + + + + + + Contains a list of profiles available for use in the domain + + + + + + + + + Contains a list of subsystems + + + + + A profile declaration may include configuration + elements from other namespaces for the subsystems that make up the profile. + + + + + + + Name of the profile + + + + + + A profile may include another profile. Overriding of included profiles is not supported. + + + + + + + + Contains a list of subsystems + + + + + + A profile declaration may include configuration + elements from other namespaces for the subsystems that make up the profile. + + + + + + + + + + Contains a list of subsystems that will be run on the host + + + + + + A profile declaration may include configuration + elements from other namespaces for the subsystems that make up the profile. + + + + + + + + + + + Contains a list of socket binding groups + + + + + + + + + Contains a list of socket configurations + + + + + + + + + + Name of an interface that should be used as the interface for + any sockets that do not explicitly declare one. + + + + + + + A profile may include another profile. Overriding of included profiles is not supported. + + + + + + + + Contains a list of socket configurations + + + + + + + + + + Name of an interface that should be used as the interface for + any sockets that do not explicitly declare one. + + + + + + + Increment to apply to the base port values defined in the + socket group to derive the values to use on this + server. + + + + + + + + Contains a list of socket configurations + + + + + + + + + + Name of an interface that should be used as the interface for + any sockets that do not explicitly declare one. + + + + + + + Increment to apply to the base port values defined in the + socket group to derive the values to use on this + server. + + + + + + + + Configuration information for a socket. + + + + + + Specifies zero or more client mappings for this socket binding. + A client connecting to this socket should use the destination address + specified in the mapping that matches its desired outbound interface. + This allows for advanced network topologies that use either network + address translation, or have bindings on multiple network interfaces + to function. + + Each mapping should be evaluated in declared order, with the first successful + match used to determine the destination. + + + + + + + + + Name of the interface to which the socket should be bound, or, for multicast + sockets, the interface on which it should listen. This should + be one of the declared interfaces. + + + + + + + Number of the port to which the socket should be bound. + + + + + + + Whether the port value should remain fixed even if numerically offsets + are applied to the other sockets in the socket group.. + + + + + + + Multicast address on which the socket should receive multicast + traffic. If unspecified, the socket will not be configured + to receive multicast. + + + + + + + Port on which the socket should receive multicast + traffic. Must be configured if 'multicast-address' is configured. + + + + + + + + + Type definition for a client mapping on a socket binding. A client + mapping specifies how external clients should connect to this + socket's port, provided that the client's outbound interface + match the specified source network value. + + + + + + Source network the client connection binds on. This value is in + the form of ip/netmask. A client should match this value against + the desired client host network interface, and if matched the + client should connect to the corresponding destination values. + + If omitted this mapping should match any interface. + + + + + + + The destination address that a client should connect to if the + source-network matches. This value can either be a hostname or + an IP address. + + + + + + + The destination port that a client should connect to if the + source-network matches. + + If omitted this mapping will reuse the effective socket binding + port. + + + + + + + + Configuration information for an outbound socket. + + + + + + + + + + The name of the outbound socket binding + + + + + + + The name of the interface that should be used for setting up the source address of the + outbound socket. This should be one of the declared interfaces. + + + + + + + + The port number that will be used for setting the source address of the outbound socket. If the + source-interface attribute has been specified and the source-port attribute equals 0 or is absent, + then the system uses an ephemeral port while binding the socket to a source address. + + + + + + + Whether the source-port value should remain fixed even if the socket binding group specifies + a port offset + + + + + + + + + + The remote server address to which the outbound socket has to be connect. + The address can be either an IP address of the host server of the hostname of the server + + + + + + + The remote port to which the outbound socket has to connect. + + + + + + + + + + + + + + + + + + + + The reference to a socket binding that has to be used as the destination for the outbound + socket binding. This socket binding name should belong to the same socket binding group + to which this local destination client socket belongs. + + + + + + + + + + The socket group to use for the server group or server. + + + + + + + Increment to apply to the base port values defined in the + referenced socket group to derive the values to use on this + server. + + + + + + + + + + + + + + + + + A list of named network interfaces. The interfaces may or may + not be fully specified (i.e. include criteria on how to determine + their IP address.) + + + + + + + + + + + + A named network interface, but without any criteria + for determining the IP address to associate with that interface. + Acts as a placeholder in the model (e.g. at the domain level) + until a fully specified interface definition is applied at a + lower level (e.g. at the server level, where available addresses + are known.) + + + + + + + + + + A list of fully specified named network interfaces. + + + + + + + + + + + A named network interface, along with required criteria + for determining the IP address to associate with that interface. + + + + + + + + + + A set of criteria that can be used at runtime to determine + what IP address to use for an interface. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Either an IP address in IPv6 or IPv4 dotted decimal notation, + or a hostname that can be resolved to an IP address. + + + + + + + + + + The name of a network interface (e.g. eth0, eth1, lo). + + + + + + + + + + A regular expression against which the names of the network + interfaces available on the machine can be matched to find + an acceptable interface. + + + + + + + + + + A network IP address and the number of bits in the + address' network prefix, written in "slash notation"; + e.g. "192.168.0.0/16". + + + + + + + + + + + + + + + + + + + + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not it is a loopback + interface. + + + + + + + + A loopback address that may not actually be configured on the machine's loopback interface. + Differs from inet-addressType in that the given value will be used even if no NIC can + be found that has the IP address associated with it. + + + + + + An IP address in IPv6 or IPv4 dotted decimal notation. + + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not it supports + multicast. + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not it is a point-to-point + interface. + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not it is currently up. + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not it is a virtual + interface. + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not it has a publicly + routable address. + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not an address associated + with it is site-local. + + + + + + + + Empty element indicating that part of the selection criteria + for an interface should be whether or not an address associated + with it is link-local. + + + + + + + + Empty element indicating that sockets using this interface + should be bound to a wildcard address. The IPv6 wildcard + address (::) will be used unless the java.net.preferIpV4Stack + system property is set to true, in which case the IPv4 + wildcard address (0.0.0.0) will be used. If a socket is + bound to an IPv6 anylocal address on a dual-stack machine, + it can accept both IPv6 and IPv4 traffic; if it is bound to + an IPv4 (IPv4-mapped) anylocal address, it can only accept + IPv4 traffic. + + + + + + + Configuration information for a socket. + + + + + + Name of the interface to which the socket should be bound, or, for multicast + sockets, the interface on which it should listen. This should + be one of the declared interfaces. + + + + + + + Number of the port to which the socket should be bound. + + + + + + + Whether the port value should remain fixed even if numerically offsets + are applied to the other sockets in the socket group.. + + + + + + + Multicast address on which the socket should receive multicast + traffic. If unspecified, the socket will not be configured + to receive multicast. + + + + + + + Port on which the socket should receive multicast + traffic. If unspecified, the socket will not be configured + to receive multicast. + + + + + + + + + + A list of named filesystem paths. The paths may or may + not be fully specified (i.e. include the actual paths.) + + + + + + + + + + + A named filesystem path, but without a requirement to specify + the actual path. If no actual path is specified, acts as a + as a placeholder in the model (e.g. at the domain level) + until a fully specified path definition is applied at a + lower level (e.g. at the host level, where available addresses + are known.) + + + + + + + + The name of the path. Cannot be one of the standard fixed paths + provided by the system: + + jboss.home.dir - the root directory of the JBoss AS distribution + user.home - user's home directory + user.dir - user's current working directory + java.home - java installation directory + jboss.server.base.dir - root directory for an individual server + instance + + Note that the system provides other standard paths that can be + overridden by declaring them in the configuration file. See + the 'relative-to' attribute documentation for a complete + list of standard paths. + + + + + + + + + + + + The actual filesystem path. Treated as an absolute path, unless the + 'relative-to' attribute is specified, in which case the value + is treated as relative to that path. + + If treated as an absolute path, the actual runtime pathname specified + by the value of this attribute will be determined as follows: + + If this value is already absolute, then the value is directly + used. Otherwise the runtime pathname is resolved in a + system-dependent way. On UNIX systems, a relative pathname is + made absolute by resolving it against the current user directory. + On Microsoft Windows systems, a relative pathname is made absolute + by resolving it against the current directory of the drive named by the + pathname, if any; if not, it is resolved against the current user + directory. + + + + + + + + + + + + The name of another previously named path, or of one of the + standard paths provided by the system. If 'relative-to' is + provided, the value of the 'path' attribute is treated as + relative to the path specified by this attribute. The standard + paths provided by the system include: + + jboss.home.dir - the root directory of the JBoss AS distribution + user.home - user's home directory + user.dir - user's current working directory + java.home - java installation directory + jboss.server.base.dir - root directory for an individual server + instance + jboss.server.config.dir - directory in which server configuration + files are stored. + jboss.server.data.dir - directory the server will use for persistent + data file storage + jboss.server.log.dir - directory the server will use for + log file storage + jboss.server.temp.dir - directory the server will use for + temporary file storage + jboss.domain.servers.dir - directory under which a host controller + will create the working area for + individual server instances + + + + + + + + + A list of named filesystem paths. + + + + + + + + + + + A named filesystem path. + + + + + + The name of the path. Cannot be one of the standard fixed paths + provided by the system: + + jboss.home.dir - the root directory of the JBoss AS distribution + user.home - user's home directory + user.dir - user's current working directory + java.home - java installation directory + jboss.server.base.dir - root directory for an individual server + instance + + Note that the system provides other standard paths that can be + overridden by declaring them in the configuration file. See + the 'relative-to' attribute documentation for a complete + list of standard paths. + + + + + + + The actual filesystem path. Treated as an absolute path, unless the + 'relative-to' attribute is specified, in which case the value + is treated as relative to that path. + + If treated as an absolute path, the actual runtime pathname specified + by the value of this attribute will be determined as follows: + + If this value is already absolute, then the value is directly + used. Otherwise the runtime pathname is resolved in a + system-dependent way. On UNIX systems, a relative pathname is + made absolute by resolving it against the current user directory. + On Microsoft Windows systems, a relative pathname is made absolute + by resolving it against the current directory of the drive named by the + pathname, if any; if not, it is resolved against the current user + directory. + + Note relative path declarations have to use '/' as file separator. + + + + + + + + + + + + The name of another previously named path, or of one of the + standard paths provided by the system. If 'relative-to' is + provided, the value of the 'path' attribute is treated as + relative to the path specified by this attribute. The standard + paths provided by the system include: + + jboss.home.dir - the root directory of the JBoss AS distribution + user.home - user's home directory + user.dir - user's current working directory + java.home - java installation directory + jboss.server.base.dir - root directory for an individual server + instance + jboss.server.config.dir - directory in which server configuration + files are stored. + jboss.server.data.dir - directory the server will use for persistent + data file storage + jboss.server.log.dir - directory the server will use for + log file storage + jboss.server.temp.dir - directory the server will use for + temporary file storage + jboss.domain.servers.dir - directory under which a host controller + will create the working area for + individual server instances + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Allows the full set of JVM options to be set via the jvm schema elements + + + + + Sets a subset of the JVM options via the jvm schema elements + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Initial JVM heap size + + + + + Maximum JVM heap size + + + + + + + + + + + + + + JVM option value + + + + + + + + JVM agent lib value + + + + + + + + JVM agent path value + + + + + + + + JVM javaagent value + + + + + + + + + + + + + + JBoss Modules option value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Definition of the security domain to use to obtain the current identity from. + + + + + + Reference to the security domain to use to obtain the current identity. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Configuration of if a classification's read is sensitive + + + + + + + Configuration of if a classification's write is sensitive + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Configuration of if a classification's addressability is sensitive + + + + + + + The name of the constraint, must be unique for each name + + + + + + + 'core' or the name of the subsystem defining the constraint + + + + + + + + + + + + + + + + + + + + + + + + + + + + The name of the constraint, must be unique for each name + + + + + + + 'core' or the name of the subsystem defining the constraint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . (for example, EAP6.2 or EAP7.3) + * WildFly. (for example WildFly10.0 or WildFly10.1) + + The corresponding kernel management API version is defined in the enum + org.jboss.as.domain.controller.resources.HostExcludeResourceDefinition.KnownRelease. + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/server/src/test/java/org/jboss/as/server/parsing/SupportedNamespaceParsingTestCase.java b/server/src/test/java/org/jboss/as/server/parsing/SupportedNamespaceParsingTestCase.java index 018d8b65d34..bd6a0f5efbd 100644 --- a/server/src/test/java/org/jboss/as/server/parsing/SupportedNamespaceParsingTestCase.java +++ b/server/src/test/java/org/jboss/as/server/parsing/SupportedNamespaceParsingTestCase.java @@ -10,11 +10,13 @@ import java.io.StringReader; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.jboss.as.controller.parsing.ManagementXmlSchema; @@ -22,6 +24,8 @@ import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.XMLMapper; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import org.projectodd.vdx.core.XMLStreamValidationException; /** @@ -29,6 +33,7 @@ * * @author Darran Lofthouse */ +@RunWith(Parameterized.class) public class SupportedNamespaceParsingTestCase { private static final String TEMPLATE = "" + @@ -43,9 +48,20 @@ public class SupportedNamespaceParsingTestCase { "urn:jboss:domain:1.5", "urn:jboss:domain:1.6"); + private final Stability testStability; + + public SupportedNamespaceParsingTestCase(Stability testStability) { + this.testStability = testStability; + } + + @Parameterized.Parameters + public static Iterable stabilityLevels() { + return Arrays.asList(Stability.DEFAULT, Stability.COMMUNITY, Stability.PREVIEW, Stability.EXPERIMENTAL); + } + @Test public void testNamespaceHandling() throws Exception { - final StandaloneXmlSchemas standaloneXmlSchemas = new StandaloneXmlSchemas(Stability.DEFAULT, null, null, null); + final StandaloneXmlSchemas standaloneXmlSchemas = new StandaloneXmlSchemas(testStability, null, null, null); Set schemas = new HashSet<>(); schemas.add(standaloneXmlSchemas.getCurrent()); schemas.addAll(standaloneXmlSchemas.getAdditional()); @@ -68,9 +84,16 @@ public void testNamespaceHandling() throws Exception { } catch (XMLStreamValidationException e) { assertTrue("Expected error should be WFLYCTL0513" , e.getMessage().contains("WFLYCTL0513")); } - } else { - // We expect no error if supported. + } else if (testStability.enables(current.getStability())) { + // We expect no error if supported mapper.parseDocument(operationList, reader); + } else { + try { + mapper.parseDocument(operationList, reader); + fail(String.format("Parsing expected to fail due to unsupported stability level %s", currentNamespace)); + } catch (XMLStreamException e) { + assertTrue("Expected error should be WFLYCTL0514" , e.getMessage().contains("WFLYCTL0514")); + } } } } diff --git a/testsuite/domain/src/test/resources/base-server-config.xml b/testsuite/domain/src/test/resources/base-server-config.xml index 144bec65579..11a3ef525d9 100644 --- a/testsuite/domain/src/test/resources/base-server-config.xml +++ b/testsuite/domain/src/test/resources/base-server-config.xml @@ -1,6 +1,6 @@ - + diff --git a/testsuite/domain/src/test/resources/domain-configs/domain-standard.xml b/testsuite/domain/src/test/resources/domain-configs/domain-standard.xml index d97c6c5987a..5e61b7ad500 100644 --- a/testsuite/domain/src/test/resources/domain-configs/domain-standard.xml +++ b/testsuite/domain/src/test/resources/domain-configs/domain-standard.xml @@ -4,7 +4,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - + diff --git a/testsuite/domain/src/test/resources/host-configs/host-primary.xml b/testsuite/domain/src/test/resources/host-configs/host-primary.xml index 04afd1ee159..71c9c005dc3 100644 --- a/testsuite/domain/src/test/resources/host-configs/host-primary.xml +++ b/testsuite/domain/src/test/resources/host-configs/host-primary.xml @@ -4,9 +4,9 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - diff --git a/testsuite/domain/src/test/resources/host-configs/host-secondary.xml b/testsuite/domain/src/test/resources/host-configs/host-secondary.xml index fd9be4ef865..02c8df4c052 100644 --- a/testsuite/domain/src/test/resources/host-configs/host-secondary.xml +++ b/testsuite/domain/src/test/resources/host-configs/host-secondary.xml @@ -4,9 +4,9 @@ ~ SPDX-License-Identifier: Apache-2.0 --> - diff --git a/testsuite/manualmode/pom.xml b/testsuite/manualmode/pom.xml index e6a07080831..b7a5e0144ee 100644 --- a/testsuite/manualmode/pom.xml +++ b/testsuite/manualmode/pom.xml @@ -625,7 +625,7 @@ org.wildfly.core.test.standalone.mgmt.HTTPSManagementInterfaceTestCase - org.wildfly.core.test.standalone.mgmt.HTTPSManagementInterfacePKCS12TestCase + org.wildfly.core.test.standalone.mgmt.ManagementInterfaceResourcesTestCase org.wildfly.core.test.standalone.mgmt.PreparedResponseTestCase diff --git a/testsuite/manualmode/src/test/java/org/wildfly/core/test/standalone/mgmt/ManagementInterfaceResourcesTestCase.java b/testsuite/manualmode/src/test/java/org/wildfly/core/test/standalone/mgmt/ManagementInterfaceResourcesTestCase.java index 9c4743f53f6..6f9e00f6b14 100644 --- a/testsuite/manualmode/src/test/java/org/wildfly/core/test/standalone/mgmt/ManagementInterfaceResourcesTestCase.java +++ b/testsuite/manualmode/src/test/java/org/wildfly/core/test/standalone/mgmt/ManagementInterfaceResourcesTestCase.java @@ -36,10 +36,28 @@ public class ManagementInterfaceResourcesTestCase { private static final Logger LOG = Logger.getLogger(ManagementInterfaceResourcesTestCase.class.getName()); + /* + * System Properties + */ private static final String BACKLOG_PROPERTY = "org.wildfly.management.backlog"; private static final String CONNECTION_HIGH_WATER_PROPERTY = "org.wildfly.management.connection-high-water"; private static final String CONNECTION_LOW_WATER_PROPERTY = "org.wildfly.management.connection-low-water"; private static final String NO_REQUEST_TIMEOUT_PROPERTY = "org.wildfly.management.no-request-timeout"; + /* + * Attribute names + */ + private static final String BACKLOG_ATTRIBUTE = "backlog"; + private static final String CONNECTION_HIGH_WATER_ATTRIBUTE = "connection-high-water"; + private static final String CONNECTION_LOW_WATER_ATTRIBUTE = "connection-low-water"; + private static final String NO_REQUEST_TIMEOUT_ATTRIBUTE = "no-request-timeout"; + /* + * Command Templates + */ + private static final String HTTP_INTERFACE_READ_ATTRIBUTE = "/core-service=management/management-interface=http-interface:read-attribute(name=%s)"; + private static final String HTTP_INTERFACE_WRITE_ATTRIBUTE = "/core-service=management/management-interface=http-interface:write-attribute(name=%s, value=%d)"; + private static final String HTTP_INTERFACE_UNDEFINE_ATTRIBUTE = "/core-service=management/management-interface=http-interface:undefine-attribute(name=%s)"; + private static final String SYSTEM_PROPERTY_ADD = "/system-property=%s:add(value=%d)"; + private static final String SYSTEM_PROPERTY_REMOVE = "/system-property=%s:remove()"; @Inject protected static ServerController controller; @@ -128,12 +146,31 @@ public void testTimeout() throws Exception { } private void runTest(int noRequestTimeout, ExceptionRunnable test) throws Exception { + runTest(true, noRequestTimeout, test); + runTest(false, noRequestTimeout, test); + } + + private void runTest(boolean useSystemProperties, int noRequestTimeout, ExceptionRunnable test) throws Exception { controller.startInAdminMode(); try (CLIWrapper cli = new CLIWrapper(true)) { - cli.sendLine(String.format("/system-property=%s:add(value=%d)", BACKLOG_PROPERTY, 2)); - cli.sendLine(String.format("/system-property=%s:add(value=%d)", CONNECTION_HIGH_WATER_PROPERTY, 6)); - cli.sendLine(String.format("/system-property=%s:add(value=%d)", CONNECTION_LOW_WATER_PROPERTY, 3)); - cli.sendLine(String.format("/system-property=%s:add(value=%d)", NO_REQUEST_TIMEOUT_PROPERTY, noRequestTimeout)); + if (useSystemProperties) { + cli.sendLine(String.format(SYSTEM_PROPERTY_ADD, BACKLOG_PROPERTY, 2)); + cli.sendLine(String.format(SYSTEM_PROPERTY_ADD, CONNECTION_HIGH_WATER_PROPERTY, 6)); + cli.sendLine(String.format(SYSTEM_PROPERTY_ADD, CONNECTION_LOW_WATER_PROPERTY, 3)); + cli.sendLine(String.format(SYSTEM_PROPERTY_ADD, NO_REQUEST_TIMEOUT_PROPERTY, noRequestTimeout)); + } else { + cli.sendLine(String.format(HTTP_INTERFACE_READ_ATTRIBUTE, BACKLOG_ATTRIBUTE), true); + String response = cli.readOutput(); + if (response.contains("WFLYCTL0201")) { + LOG.info("Attribute \"backlog\" not found - assuming the attributes are not available at the server's stability level" ); + controller.stop(); + return; + } + cli.sendLine(String.format(HTTP_INTERFACE_WRITE_ATTRIBUTE, BACKLOG_ATTRIBUTE, 2)); + cli.sendLine(String.format(HTTP_INTERFACE_WRITE_ATTRIBUTE, CONNECTION_HIGH_WATER_ATTRIBUTE, 6)); + cli.sendLine(String.format(HTTP_INTERFACE_WRITE_ATTRIBUTE, CONNECTION_LOW_WATER_ATTRIBUTE, 3)); + cli.sendLine(String.format(HTTP_INTERFACE_WRITE_ATTRIBUTE, NO_REQUEST_TIMEOUT_ATTRIBUTE, noRequestTimeout)); + } } try { @@ -144,10 +181,17 @@ private void runTest(int noRequestTimeout, ExceptionRunnable test) th controller.reload(); try (CLIWrapper cli = new CLIWrapper(true)) { - cli.sendLine(String.format("/system-property=%s:remove()", BACKLOG_PROPERTY)); - cli.sendLine(String.format("/system-property=%s:remove()", CONNECTION_HIGH_WATER_PROPERTY)); - cli.sendLine(String.format("/system-property=%s:remove()", CONNECTION_LOW_WATER_PROPERTY)); - cli.sendLine(String.format("/system-property=%s:remove()", NO_REQUEST_TIMEOUT_PROPERTY)); + if (useSystemProperties) { + cli.sendLine(String.format(SYSTEM_PROPERTY_REMOVE, BACKLOG_PROPERTY)); + cli.sendLine(String.format(SYSTEM_PROPERTY_REMOVE, CONNECTION_HIGH_WATER_PROPERTY)); + cli.sendLine(String.format(SYSTEM_PROPERTY_REMOVE, CONNECTION_LOW_WATER_PROPERTY)); + cli.sendLine(String.format(SYSTEM_PROPERTY_REMOVE, NO_REQUEST_TIMEOUT_PROPERTY)); + } else { + cli.sendLine(String.format(HTTP_INTERFACE_UNDEFINE_ATTRIBUTE, BACKLOG_ATTRIBUTE)); + cli.sendLine(String.format(HTTP_INTERFACE_UNDEFINE_ATTRIBUTE, CONNECTION_HIGH_WATER_ATTRIBUTE)); + cli.sendLine(String.format(HTTP_INTERFACE_UNDEFINE_ATTRIBUTE, CONNECTION_LOW_WATER_ATTRIBUTE)); + cli.sendLine(String.format(HTTP_INTERFACE_UNDEFINE_ATTRIBUTE, NO_REQUEST_TIMEOUT_ATTRIBUTE)); + } } controller.stop(); }