diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/DynamicLoadProviderResourceDefinition.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/DynamicLoadProviderResourceDefinition.java index 077ba13f9930..3242c35c2cd4 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/DynamicLoadProviderResourceDefinition.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/DynamicLoadProviderResourceDefinition.java @@ -27,7 +27,6 @@ import org.jboss.as.clustering.controller.ChildResourceDefinition; import org.jboss.as.clustering.controller.ReloadRequiredResourceRegistration; import org.jboss.as.clustering.controller.ResourceDescriptor; -import org.jboss.as.clustering.controller.SimpleAliasEntry; import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.PathElement; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; @@ -39,13 +38,11 @@ /** * Definition for resource at address /subsystem=modcluster/proxy=X/load-provider=dynamic - * and its legacy alias /subsystem=modcluster/proxy=X/dynamic-load-provider=configuration * * @author Radoslav Husar */ public class DynamicLoadProviderResourceDefinition extends ChildResourceDefinition { - public static final PathElement LEGACY_PATH = PathElement.pathElement("dynamic-load-provider", "configuration"); public static final PathElement PATH = PathElement.pathElement("load-provider", "dynamic"); enum Attribute implements org.jboss.as.clustering.controller.Attribute, UnaryOperator { @@ -88,7 +85,6 @@ public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder b @Override public ManagementResourceRegistration register(ManagementResourceRegistration parent) { ManagementResourceRegistration registration = parent.registerSubModel(this); - parent.registerAlias(LEGACY_PATH, new SimpleAliasEntry(registration)); ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()) .addAttributes(Attribute.class) diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyMetricOperationsRegistration.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyMetricOperationsRegistration.java deleted file mode 100644 index be3dc8581115..000000000000 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyMetricOperationsRegistration.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2018, Red Hat, Inc., and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.wildfly.extension.mod_cluster; - -import java.util.Set; - -import org.jboss.as.clustering.controller.Operations; -import org.jboss.as.clustering.controller.Registration; -import org.jboss.as.controller.AttributeDefinition; -import org.jboss.as.controller.OperationContext; -import org.jboss.as.controller.OperationDefinition; -import org.jboss.as.controller.OperationFailedException; -import org.jboss.as.controller.OperationStepHandler; -import org.jboss.as.controller.PathAddress; -import org.jboss.as.controller.SimpleOperationDefinitionBuilder; -import org.jboss.as.controller.descriptions.ModelDescriptionConstants; -import org.jboss.as.controller.logging.ControllerLogger; -import org.jboss.as.controller.operations.common.Util; -import org.jboss.as.controller.registry.ManagementResourceRegistration; -import org.jboss.as.controller.registry.OperationEntry; -import org.jboss.as.controller.registry.Resource; -import org.jboss.dmr.ModelNode; - -/** - * Helper class that registers legacy add-metric/remove-metric/add-custom-metric/remove-custom-metric operations. - * The class in its entirety is designed to be removed (plus one line for registration) once deprecated long enough. - * Deprecated since model version 6.0.0. - * - * @author Radoslav Husar - */ -public class LegacyMetricOperationsRegistration implements Registration { - - public void register(ManagementResourceRegistration registration) { - // Transform legacy /subsystem=modcluster/mod-cluster-config=CONFIGURATION:add-metric(type=...) operation - // -> /subsystem=modcluster/proxy=*/dynamic-load-provider=configuration/load-metric=...:add(...) - OperationDefinition legacyAddMetricOperation = new SimpleOperationDefinitionBuilder("add-metric", ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(LoadMetricResourceDefinition.Attribute.TYPE.getDefinition()) - .addParameter(LoadMetricResourceDefinition.SharedAttribute.WEIGHT.getDefinition()) - .addParameter(LoadMetricResourceDefinition.SharedAttribute.CAPACITY.getDefinition()) - .addParameter(LoadMetricResourceDefinition.SharedAttribute.PROPERTY.getDefinition()) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - - OperationStepHandler legacyAddMetricHandler = new OperationStepHandler() { - @Override - public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { - operationDeprecated(context, operation); - PathAddress address = translateProxyPath(context); - String type = operation.require(LoadMetricResourceDefinition.Attribute.TYPE.getName()).asString(); - PathAddress metricPath = PathAddress.pathAddress(DynamicLoadProviderResourceDefinition.LEGACY_PATH, LoadMetricResourceDefinition.pathElement(type)); - PathAddress metricPathAddress = address.append(metricPath); - ModelNode metricOperation = Util.createAddOperation(metricPathAddress); - OperationEntry addOperationEntry = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(metricPath), ModelDescriptionConstants.ADD); - for (AttributeDefinition attribute : addOperationEntry.getOperationDefinition().getParameters()) { - String name = attribute.getName(); - if (operation.hasDefined(name)) { - metricOperation.get(name).set(operation.get(name)); - } - } - context.addStep(metricOperation, addOperationEntry.getOperationHandler(), OperationContext.Stage.MODEL, true); - } - }; - - registration.registerOperationHandler(legacyAddMetricOperation, legacyAddMetricHandler); - - // Transform legacy /subsystem=modcluster/mod-cluster-config=CONFIGURATION:remove-metric(type=...) operation - // -> /subsystem=modcluster/proxy=*/dynamic-load-provider=configuration/load-metric=...:remove() - OperationDefinition legacyRemoveMetricOperation = new SimpleOperationDefinitionBuilder("remove-metric", ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(LoadMetricResourceDefinition.Attribute.TYPE.getDefinition()) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - - OperationStepHandler legacyRemoveMetricHandler = new OperationStepHandler() { - @Override - public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { - operationDeprecated(context, operation); - PathAddress address = translateProxyPath(context); - String type = operation.require(LoadMetricResourceDefinition.Attribute.TYPE.getName()).asString(); - PathAddress metricPath = PathAddress.pathAddress(DynamicLoadProviderResourceDefinition.LEGACY_PATH, LoadMetricResourceDefinition.pathElement(type)); - PathAddress metricPathAddress = address.append(metricPath); - ModelNode metricOperation = Util.createRemoveOperation(metricPathAddress); - OperationEntry removeOperationEntry = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(metricPath), ModelDescriptionConstants.REMOVE); - context.addStep(metricOperation, removeOperationEntry.getOperationHandler(), OperationContext.Stage.MODEL, true); - } - }; - - registration.registerOperationHandler(legacyRemoveMetricOperation, legacyRemoveMetricHandler); - - // Transform legacy /subsystem=modcluster/mod-cluster-config=CONFIGURATION:add-custom-metric(class=...) operation - // -> /subsystem=modcluster/proxy=*/dynamic-load-provider=configuration/custom-load-metric=...:add(...) - OperationDefinition legacyAddCustomMetricOperation = new SimpleOperationDefinitionBuilder("add-custom-metric", ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(CustomLoadMetricResourceDefinition.Attribute.CLASS.getDefinition()) - .addParameter(LoadMetricResourceDefinition.SharedAttribute.WEIGHT.getDefinition()) - .addParameter(LoadMetricResourceDefinition.SharedAttribute.CAPACITY.getDefinition()) - .addParameter(LoadMetricResourceDefinition.SharedAttribute.PROPERTY.getDefinition()) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - - OperationStepHandler legacyAddCustomMetricHandler = new OperationStepHandler() { - @Override - public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { - operationDeprecated(context, operation); - PathAddress address = translateProxyPath(context); - String type = operation.require(CustomLoadMetricResourceDefinition.Attribute.CLASS.getName()).asString(); - PathAddress metricPath = PathAddress.pathAddress(DynamicLoadProviderResourceDefinition.LEGACY_PATH, LoadMetricResourceDefinition.pathElement(type)); - PathAddress metricPathAddress = address.append(metricPath); - ModelNode metricOperation = Util.createAddOperation(metricPathAddress); - OperationEntry addOperationEntry = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(metricPath), ModelDescriptionConstants.ADD); - for (AttributeDefinition attribute : addOperationEntry.getOperationDefinition().getParameters()) { - String name = attribute.getName(); - if (operation.hasDefined(name)) { - metricOperation.get(name).set(operation.get(name)); - } - } - context.addStep(metricOperation, addOperationEntry.getOperationHandler(), OperationContext.Stage.MODEL, true); - } - }; - - registration.registerOperationHandler(legacyAddCustomMetricOperation, legacyAddCustomMetricHandler); - - // Transform legacy /subsystem=modcluster/mod-cluster-config=CONFIGURATION:remove-custom-metric(class=...) operation - // -> /subsystem=modcluster/proxy=*/dynamic-load-provider=configuration/custom-load-metric=...:remove() - OperationDefinition legacyRemoveCustomMetricOperation = new SimpleOperationDefinitionBuilder("remove-custom-metric", ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(CustomLoadMetricResourceDefinition.Attribute.CLASS.getDefinition()) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - - OperationStepHandler legacyRemoveCustomMetricHandler = new OperationStepHandler() { - @Override - public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { - operationDeprecated(context, operation); - PathAddress address = translateProxyPath(context); - String type = operation.require(CustomLoadMetricResourceDefinition.Attribute.CLASS.getName()).asString(); - PathAddress metricPath = PathAddress.pathAddress(DynamicLoadProviderResourceDefinition.LEGACY_PATH, LoadMetricResourceDefinition.pathElement(type)); - PathAddress metricPathAddress = address.append(metricPath); - ModelNode metricOperation = Util.createRemoveOperation(metricPathAddress); - OperationEntry removeOperationEntry = context.getResourceRegistration().getOperationEntry(PathAddress.pathAddress(metricPath), ModelDescriptionConstants.REMOVE); - context.addStep(metricOperation, removeOperationEntry.getOperationHandler(), OperationContext.Stage.MODEL, true); - } - }; - - registration.registerOperationHandler(legacyRemoveCustomMetricOperation, legacyRemoveCustomMetricHandler); - } - - private static PathAddress translateProxyPath(OperationContext context) throws OperationFailedException { - return translateProxyPath(context, context.getCurrentAddress().getParent()); - } - - static PathAddress translateProxyPath(OperationContext context, PathAddress address) throws OperationFailedException { - Set children = context.readResourceFromRoot(address, false).getChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey()); - if (children.size() != 1) { - throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.legacyOperationsWithMultipleProxies()); - } - PathAddress proxyPath = PathAddress.pathAddress(ProxyConfigurationResourceDefinition.pathElement(children.iterator().next().getName())); - address = address.append(proxyPath); - return address; - } - - private static void operationDeprecated(OperationContext context, ModelNode operation) { - ControllerLogger.DEPRECATED_LOGGER.operationDeprecated(Operations.getName(operation), context.getCurrentAddress().toCLIStyleString()); - } - -} diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyProxyHandler.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyProxyHandler.java deleted file mode 100644 index d10a1480bea8..000000000000 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyProxyHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2019, Red Hat, Inc., and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.wildfly.extension.mod_cluster; - -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - -import org.jboss.as.clustering.controller.FunctionExecutor; -import org.jboss.as.clustering.controller.FunctionExecutorRegistry; -import org.jboss.as.clustering.controller.Operations; -import org.jboss.as.clustering.controller.Registration; -import org.jboss.as.controller.AbstractRuntimeOnlyHandler; -import org.jboss.as.controller.OperationContext; -import org.jboss.as.controller.OperationFailedException; -import org.jboss.as.controller.PathAddress; -import org.jboss.as.controller.registry.ManagementResourceRegistration; -import org.jboss.dmr.ModelNode; -import org.jboss.modcluster.ModClusterServiceMBean; -import org.jboss.msc.service.ServiceName; -import org.wildfly.common.function.ExceptionFunction; - -/** - * @author Paul Ferraro - */ -@Deprecated -public class LegacyProxyHandler extends AbstractRuntimeOnlyHandler implements Registration { - - private final FunctionExecutorRegistry executors; - private final Map operations = new HashMap<>(); - - LegacyProxyHandler(FunctionExecutorRegistry executors) { - this.executors = executors; - for (LegacyProxyOperation operation : EnumSet.allOf(LegacyProxyOperation.class)) { - this.operations.put(operation.getDefinition().getName(), operation); - } - } - - @Override - protected void executeRuntimeStep(OperationContext context, ModelNode op) throws OperationFailedException { - String name = Operations.getName(op); - LegacyProxyOperation operation = this.operations.get(name); - PathAddress proxyAddress = LegacyMetricOperationsRegistration.translateProxyPath(context, context.getCurrentAddress()); - ServiceName serviceName = ProxyConfigurationResourceDefinition.Capability.SERVICE.getServiceName(proxyAddress); - FunctionExecutor executor = this.executors.get(serviceName); - if (executor != null) { - executor.execute(new ExceptionFunction() { - @Override - public Void apply(ModClusterServiceMBean service) throws OperationFailedException { - operation.execute(context, op, service); - return null; - } - }); - } else { - context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); - } - } - - @Override - public void register(ManagementResourceRegistration registration) { - for (LegacyProxyOperation operation : this.operations.values()) { - registration.registerOperationHandler(operation.getDefinition(), this); - } - } -} diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyProxyOperation.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyProxyOperation.java deleted file mode 100644 index e127a8f5a2fd..000000000000 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LegacyProxyOperation.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2018, Red Hat, Inc., and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.wildfly.extension.mod_cluster; - -import static org.wildfly.extension.mod_cluster.ModClusterLogger.ROOT_LOGGER; -import static org.wildfly.extension.mod_cluster.ProxyOperationExecutor.CONTEXT; -import static org.wildfly.extension.mod_cluster.ProxyOperationExecutor.HOST; -import static org.wildfly.extension.mod_cluster.ProxyOperationExecutor.PORT; -import static org.wildfly.extension.mod_cluster.ProxyOperationExecutor.VIRTUAL_HOST; -import static org.wildfly.extension.mod_cluster.ProxyOperationExecutor.WAIT_TIME; - -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.jboss.as.clustering.controller.Definable; -import org.jboss.as.controller.OperationContext; -import org.jboss.as.controller.OperationDefinition; -import org.jboss.as.controller.OperationFailedException; -import org.jboss.as.controller.SimpleOperationDefinitionBuilder; -import org.jboss.dmr.ModelNode; -import org.jboss.dmr.ModelType; -import org.jboss.modcluster.ModClusterServiceMBean; - -/** - * These are legacy operations suffering from multiple issues such as WFLY-10442, WFLY-10445, WFLY-10444, WFLY-10441, etc. - * Operations are registered to support legacy workflow, thus, they can only be used when a single proxy configuration is - * defined. - * The class in its entirety is designed to be removed (plus couple of line for registration) once deprecated long enough. - * Deprecated since model version 6.0.0. - * - * @author Radoslav Husar - */ -@Deprecated -public enum LegacyProxyOperation implements Definable { - ADD_PROXY { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.ADD_PROXY.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(HOST) - .addParameter(PORT) - .setRuntimeOnly() - .addAccessConstraint(ModClusterExtension.MOD_CLUSTER_PROXIES_DEF) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - ROOT_LOGGER.debugf("add-proxy: %s", operation); - - String host = HOST.resolveModelAttribute(context, operation).asString(); - int port = PORT.resolveModelAttribute(context, operation).asInt(); - - // Keeping this test here to maintain same behavior as previous versions. - try { - InetAddress.getByName(host); - } catch (UnknownHostException e) { - throw new OperationFailedException(ROOT_LOGGER.couldNotResolveProxyIpAddress(), e); - } - - service.addProxy(host, port); - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - service.removeProxy(host, port); - } - }); - } - }, - DISABLE { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.DISABLE.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - service.disable(); - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - service.enable(); - } - }); - } - }, - DISABLE_CONTEXT { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.DISABLE_CONTEXT.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(VIRTUAL_HOST) - .addParameter(CONTEXT) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - ROOT_LOGGER.debugf("disable-context: %s", operation); - - String webHost = VIRTUAL_HOST.resolveModelAttribute(context, operation).asString(); - String webContext = CONTEXT.resolveModelAttribute(context, operation).asString(); - - try { - service.disableContext(webHost, webContext); - } catch (IllegalArgumentException e) { - throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.contextOrHostNotFound(webHost, webContext)); - } - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - service.enableContext(webHost, webContext); - } - }); - } - }, - ENABLE { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.ENABLE.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - service.enable(); - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - service.disable(); - } - }); - } - }, - ENABLE_CONTEXT { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.ENABLE_CONTEXT.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(VIRTUAL_HOST) - .addParameter(CONTEXT) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - ROOT_LOGGER.debugf("enable-context: %s", operation); - - String webHost = VIRTUAL_HOST.resolveModelAttribute(context, operation).asString(); - String webContext = CONTEXT.resolveModelAttribute(context, operation).asString(); - - try { - service.enableContext(webHost, webContext); - } catch (IllegalArgumentException e) { - throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.contextOrHostNotFound(webHost, webContext)); - } - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - service.disableContext(webHost, webContext); - } - }); - } - }, - LIST_PROXIES { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.LIST_PROXIES.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .setReadOnly() - .setRuntimeOnly() - .setReplyType(ModelType.LIST) - .setReplyValueType(ModelType.STRING) - .addAccessConstraint(ModClusterExtension.MOD_CLUSTER_PROXIES_DEF) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - Map map = service.getProxyInfo(); - ROOT_LOGGER.debugf("Mod_cluster ListProxies %s", map); - if (!map.isEmpty()) { - ModelNode result = new ModelNode(); - InetSocketAddress[] addr = map.keySet().toArray(new InetSocketAddress[map.size()]); - for (InetSocketAddress address : addr) { - result.add(address.getHostName() + ":" + address.getPort()); - } - context.getResult().set(result); - } - } - }, - READ_PROXIES_CONFIGURATION { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.READ_PROXIES_CONFIGURATION.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .setReadOnly() - .setRuntimeOnly() - .setReplyType(ModelType.LIST) - .setReplyValueType(ModelType.STRING) - .addAccessConstraint(ModClusterExtension.MOD_CLUSTER_PROXIES_DEF) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - Map map = service.getProxyConfiguration(); - ROOT_LOGGER.debugf("Mod_cluster ProxyConfiguration %s", map); - if (!map.isEmpty()) { - ModelNode result = new ModelNode(); - for (Map.Entry entry : map.entrySet()) { - result.add(entry.getKey().getHostName() + ":" + entry.getKey().getPort()); - if (entry.getValue() == null) { - result.add(); - } else { - result.add(entry.getValue()); - } - } - context.getResult().set(result); - } - } - }, - READ_PROXIES_INFO { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.READ_PROXIES_INFO.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .setReadOnly() - .setRuntimeOnly() - .setReplyType(ModelType.LIST) - .setReplyValueType(ModelType.STRING) - .addAccessConstraint(ModClusterExtension.MOD_CLUSTER_PROXIES_DEF) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - Map map = service.getProxyInfo(); - ROOT_LOGGER.debugf("Mod_cluster ProxyInfo %s", map); - if (!map.isEmpty()) { - ModelNode result = new ModelNode(); - for (Map.Entry entry : map.entrySet()) { - result.add(entry.getKey().getHostName() + ":" + entry.getKey().getPort()); - if (entry.getValue() == null) { - result.add(); - } else { - result.add(entry.getValue()); - } - } - context.getResult().set(result); - } - } - }, - REFRESH { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.REFRESH.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - service.refresh(); - context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); - } - }, - REMOVE_PROXY { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.REMOVE_PROXY.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(HOST) - .addParameter(PORT) - .setRuntimeOnly() - .addAccessConstraint(ModClusterExtension.MOD_CLUSTER_PROXIES_DEF) - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - ROOT_LOGGER.debugf("remove-proxy: %s", operation); - - String host = HOST.resolveModelAttribute(context, operation).asString(); - int port = PORT.resolveModelAttribute(context, operation).asInt(); - - // Keeping this test here to maintain same behavior as previous versions. - try { - InetAddress.getByName(host); - } catch (UnknownHostException e) { - throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.couldNotResolveProxyIpAddress(), e); - } - - service.removeProxy(host, port); - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - // TODO What if mod_cluster was never aware of this proxy? - service.addProxy(host, port); - } - }); - } - }, - RESET { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.RESET.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - service.reset(); - context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); - } - }, - STOP { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.STOP.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(WAIT_TIME) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - ROOT_LOGGER.debugf("stop: %s", operation); - - int waitTime = WAIT_TIME.resolveModelAttribute(context, operation).asInt(); - - boolean success = service.stop(waitTime, TimeUnit.SECONDS); - context.getResult().get(SESSION_DRAINING_COMPLETE).set(success); - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - // TODO We're assuming that the all contexts were previously enabled, but they could have been disabled - service.enable(); - } - }); - } - }, - STOP_CONTEXT { - @Override - public OperationDefinition getDefinition() { - return new SimpleOperationDefinitionBuilder(ProxyOperation.STOP_CONTEXT.getName(), ModClusterExtension.SUBSYSTEM_RESOLVER) - .addParameter(VIRTUAL_HOST) - .addParameter(CONTEXT) - .addParameter(WAIT_TIME) - .setRuntimeOnly() - .setDeprecated(ModClusterModel.VERSION_6_0_0.getVersion()) - .build(); - } - - @Override - void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException { - ROOT_LOGGER.debugf("stop-context: %s", operation); - - String webHost = VIRTUAL_HOST.resolveModelAttribute(context, operation).asString(); - String webContext = CONTEXT.resolveModelAttribute(context, operation).asString(); - int waitTime = WAIT_TIME.resolveModelAttribute(context, operation).asInt(); - - try { - boolean success = service.stopContext(webHost, webContext, waitTime, TimeUnit.SECONDS); - context.getResult().get(SESSION_DRAINING_COMPLETE).set(success); - } catch (IllegalArgumentException e) { - throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.contextOrHostNotFound(webHost, webContext)); - } - - context.completeStep(new OperationContext.RollbackHandler() { - @Override - public void handleRollback(OperationContext context, ModelNode operation) { - // TODO We're assuming that the context was previously enabled, but it could have been disabled - service.enableContext(webHost, webContext); - } - }); - } - }, - ; - - static final String SESSION_DRAINING_COMPLETE = "session-draining-complete"; - - abstract void execute(OperationContext context, ModelNode operation, ModClusterServiceMBean service) throws OperationFailedException; -} diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LoadMetricEnum.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LoadMetricEnum.java index ade5bc09fa20..7f262e604165 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LoadMetricEnum.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/LoadMetricEnum.java @@ -39,7 +39,6 @@ public enum LoadMetricEnum { CPU("cpu", AverageSystemLoadMetric.class), - @Deprecated SYSTEM_MEMORY("mem", null), HEAP_MEMORY("heap", HeapMemoryUsageLoadMetric.class), ACTIVE_SESSIONS("sessions", ActiveSessionsLoadMetric.class), RECEIVE_TRAFFIC("receive-traffic", ReceiveTrafficLoadMetric.class), diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterLogger.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterLogger.java index a207562cccd4..a34a66d8ec08 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterLogger.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterLogger.java @@ -25,7 +25,6 @@ import static org.jboss.logging.Logger.Level.ERROR; import static org.jboss.logging.Logger.Level.WARN; -import org.jboss.as.controller.OperationFailedException; import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.Cause; @@ -78,7 +77,7 @@ interface ModClusterLogger extends BasicLogger { * Logs an error message indicating ModCluster requires advertise, but no multi-cast interface is available. */ @LogMessage(level = ERROR) - @Message(id = 4, value = "Mod_cluster requires Advertise but Multicast interface is not available") + @Message(id = 4, value = "Mod_cluster requires Advertise but Multicast interface is not available.") void multicastInterfaceNotAvailable(); @LogMessage(level = WARN) @@ -95,14 +94,14 @@ interface ModClusterLogger extends BasicLogger { @Message(id = 6, value = "Error applying properties to load metric class '%s'. Metric will not be loaded.") void errorApplyingMetricProperties(@Cause Throwable cause, String metricClass); - /** - * Logs a warning message that this metric type is no longer supported. - * - * @param metricType name of the unsupported metric - */ - @LogMessage(level = WARN) - @Message(id = 7, value = "Metric of type '%s' is no longer supported and will be ignored.") - void unsupportedMetric(String metricType); +// /** +// * Logs a warning message that this metric type is no longer supported. +// * +// * @param metricType name of the unsupported metric +// */ +// @LogMessage(level = WARN) +// @Message(id = 7, value = "Metric of type '%s' is no longer supported and will be ignored.") +// void unsupportedMetric(String metricType); // /** // * A message indicating a class attribute is needed for the attribute represented by the {@code attributeName} @@ -140,24 +139,24 @@ interface ModClusterLogger extends BasicLogger { // @Message(id = 13, value = "'property' can not have more than one entry") // String propertyCanOnlyHaveOneEntry(); - /** - * A message indicating a valid port and host are needed. - * - * @return the message - */ - @Message(id = 14, value = "Need valid host and port in the form host:port, %s is not valid") - String needHostAndPort(String value); +// /** +// * A message indicating a valid port and host are needed. +// * +// * @return the message +// */ +// @Message(id = 14, value = "Need valid host and port in the form host:port, %s is not valid") +// String needHostAndPort(String value); // @Message(id = 15, value = "session-draining-strategy must either be undefined or have the value \"DEFAULT\"") // String sessionDrainingStrategyMustBeUndefinedOrDefault(); - /** - * A message indicating the host of the reverse proxy server could not be resolved. - * - * @return the message. - */ - @Message(id = 16, value = "No IP address could be resolved for the specified host of the proxy.") - String couldNotResolveProxyIpAddress(); +// /** +// * A message indicating the host of the reverse proxy server could not be resolved. +// * +// * @return the message. +// */ +// @Message(id = 16, value = "No IP address could be resolved for the specified host of the proxy.") +// String couldNotResolveProxyIpAddress(); // /** // * A message explaining that 'proxy-list' attribute has been deprecated and that 'proxies' attribute which is a list @@ -178,31 +177,38 @@ interface ModClusterLogger extends BasicLogger { // String proxyListAttributeUsage(); /** - * Logs a error message when excluded contexts are in a wrong format. + * Logs an error message when excluded contexts are in a wrong format. * * @param trimmedContexts value which is in the wrong format */ @Message(id = 19, value = "'%s' is not a valid value for excluded-contexts.") IllegalArgumentException excludedContextsWrongFormat(String trimmedContexts); - /** - * Exception thrown when user configures both 'ssl-context' attribute reference and the mod-cluster-config=configuration/ssl=configuration. - */ - @Message(id = 20, value = "Only one of 'ssl-context' attribute or 'ssl' resource can be defined!") - IllegalStateException bothElytronAndLegacySslContextDefined(); +// /** +// * Exception thrown when user configures both 'ssl-context' attribute reference and the proxy=X/ssl=configuration. +// */ +// @Message(id = 20, value = "Only one of 'ssl-context' attribute or 'ssl' resource can be defined!") +// IllegalStateException bothElytronAndLegacySslContextDefined(); @LogMessage(level = WARN) @Message(id = 21, value = "Value 'ROOT' for excluded-contexts is deprecated, to exclude the root context use '/' instead.") void excludedContextsUseSlashInsteadROOT(); - @Message(id = 22, value = "Legacy operations cannot be used with multiple proxy configurations. Use non-deprecated operations at the correct proxy address.") - String legacyOperationsWithMultipleProxies(); +// @Message(id = 22, value = "Legacy operations cannot be used with multiple proxy configurations. Use non-deprecated operations at the correct proxy address.") +// String legacyOperationsWithMultipleProxies(); @LogMessage(level = ERROR) @Message(id = 23, value = "Error loading module '%s' to load custom metric from.") void errorLoadingModuleForCustomMetric(String moduleName, @Cause Throwable cause); - @Message(id = 24, value = "Dynamic load factor provider is currently configured. A simple load factor provider needs to be configured first to read or write a static factor.") - OperationFailedException simpleLoadFactorProviderIsNotConfigured(); +// @Message(id = 24, value = "Dynamic load factor provider is currently configured. A simple load factor provider needs to be configured first to read or write a static factor.") +// OperationFailedException simpleLoadFactorProviderIsNotConfigured(); + @LogMessage(level = WARN) + @Message(id = 25, value = "The '%s' element is no longer supported and will be ignored.") + void ignoredElement(String element); + + @LogMessage(level = WARN) + @Message(id = 26, value = "Attribute '%s' of element '%s' is no longer supported and will be ignored.") + void ignoredAttribute(String attribute, String element); } diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterModel.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterModel.java index 3db02af9dfb9..17fd590c91db 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterModel.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterModel.java @@ -33,15 +33,17 @@ public enum ModClusterModel implements Model { /* Unsupported model versions - for reference only: VERSION_1_5_0(1, 5, 0), // EAP 6.3-6.4 -*/ VERSION_2_0_0(2, 0, 0), // WildFly 8 VERSION_3_0_0(3, 0, 0), // WildFly 9 VERSION_4_0_0(4, 0, 0), // WildFly 10, EAP 7.0 VERSION_5_0_0(5, 0, 0), // WildFly 11-13, EAP 7.1 VERSION_6_0_0(6, 0, 0), // WildFly 14-15, EAP 7.2 - VERSION_7_0_0(7, 0, 0), // WildFly 16-25, EAP 7.3-7.4 +*/ + VERSION_7_0_0(7, 0, 0), // WildFly 16-26, EAP 7.3-7.4 + VERSION_8_0_0(8, 0, 0), // WildFly 27-present ; - public static final ModClusterModel CURRENT = VERSION_7_0_0; + + public static final ModClusterModel CURRENT = VERSION_8_0_0; private final ModelVersion version; diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSchema.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSchema.java index 78da4899dcd2..aa2752c45f07 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSchema.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSchema.java @@ -32,15 +32,18 @@ */ public enum ModClusterSchema implements Schema { +/* Unsupported schema versions - for reference only MODCLUSTER_1_0(1, 0), // AS 7.0 - MODCLUSTER_1_1(1, 1), // EAP 6.0 & 6.1 & 6.2 - MODCLUSTER_1_2(1, 2), // EAP 6.3 & 6.4 + MODCLUSTER_1_1(1, 1), // EAP 6.0-6.2 + MODCLUSTER_1_2(1, 2), // EAP 6.3-6.4 MODCLUSTER_2_0(2, 0), // WildFly 10, EAP 7.0 - MODCLUSTER_3_0(3, 0), // WildFly 11 & 12 & 13, EAP 7.1 - MODCLUSTER_4_0(4, 0), // WildFly 14 & 15, EAP 7.2 - MODCLUSTER_5_0(5, 0), // WildFly 16 + MODCLUSTER_3_0(3, 0), // WildFly 11-13, EAP 7.1 + MODCLUSTER_4_0(4, 0), // WildFly 14-15, EAP 7.2 + */ + MODCLUSTER_5_0(5, 0), // WildFly 16-26, EAP 7.3-7.4 + MODCLUSTER_6_0(6, 0), // WildFly 27-present ; - public static final ModClusterSchema CURRENT = MODCLUSTER_5_0; + public static final ModClusterSchema CURRENT = MODCLUSTER_6_0; private final int major; private final int minor; diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemResourceDefinition.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemResourceDefinition.java index 0b1854dacd1c..7b0b5e22d015 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemResourceDefinition.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemResourceDefinition.java @@ -35,7 +35,6 @@ /** * Resource definition for mod_cluster subsystem resource, children of which are respective proxy configurations. - * Also registers wrong, legacy and deprecated proxy operations (WFLY-10439). * * @author Radoslav Husar */ @@ -47,7 +46,6 @@ class ModClusterSubsystemResourceDefinition extends SubsystemResourceDefinition< super(PATH, ModClusterExtension.SUBSYSTEM_RESOLVER); } - @SuppressWarnings("deprecation") @Override public void register(SubsystemRegistration parent) { ManagementResourceRegistration registration = parent.registerSubsystemModel(this); @@ -61,10 +59,5 @@ public void register(SubsystemRegistration parent) { new SimpleResourceRegistration(descriptor, handler).register(registration); new ProxyConfigurationResourceDefinition(registry).register(registration); - - // Deprecated legacy operations which are exposed at the wrong location - if (parent.isRuntimeOnlyRegistrationValid()) { - new LegacyProxyHandler(registry).register(registration); - } } } diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemServiceHandler.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemServiceHandler.java index 254f7ee9331b..94c4635d6c17 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemServiceHandler.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemServiceHandler.java @@ -158,13 +158,6 @@ private void addLoadMetrics(Set metrics, ModelNode nodes, final Oper Class loadMetricClass = null; if (node.hasDefined(LoadMetricResourceDefinition.Attribute.TYPE.getName())) { String type = LoadMetricResourceDefinition.Attribute.TYPE.resolveModelAttribute(context, node).asString(); - - // MODCLUSTER-288 Metric "mem" has been dropped, keep it in the model for versions prior to 8.0 - if (type.equals("mem")) { - ROOT_LOGGER.unsupportedMetric(type); - continue; - } - LoadMetricEnum metric = LoadMetricEnum.forType(type); loadMetricClass = (metric != null) ? metric.getLoadMetricClass() : null; } else { diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLReader.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLReader.java index 27f72c6d4460..2d02bafe3add 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLReader.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLReader.java @@ -25,6 +25,7 @@ import static org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute; import static org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute; import static org.jboss.as.controller.parsing.ParseUtils.unexpectedElement; +import static org.wildfly.extension.mod_cluster.ModClusterLogger.ROOT_LOGGER; import static org.wildfly.extension.mod_cluster.XMLAttribute.CLASS; import static org.wildfly.extension.mod_cluster.XMLAttribute.TYPE; @@ -53,7 +54,6 @@ final class ModClusterSubsystemXMLReader implements XMLElementReader list) throws XMLStreamException { ParseUtils.requireNoAttributes(reader); @@ -65,17 +65,9 @@ public void readElement(XMLExtendedStreamReader reader, List list) th while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { XMLElement element = XMLElement.forName(reader.getLocalName()); switch (element) { - case MOD_CLUSTER_CONFIG: { - if (!schema.since(ModClusterSchema.MODCLUSTER_4_0)) { - this.parseProxy(reader, list, subsystemAddress); - break; - } - } case PROXY: { - if (schema.since(ModClusterSchema.MODCLUSTER_4_0)) { - this.parseProxy(reader, list, subsystemAddress); - break; - } + this.parseProxy(reader, list, subsystemAddress); + break; } default: { throw unexpectedElement(reader); @@ -84,9 +76,8 @@ public void readElement(XMLExtendedStreamReader reader, List list) th } } - @SuppressWarnings("deprecation") private void parseProxy(XMLExtendedStreamReader reader, List list, PathAddress parent) throws XMLStreamException { - String name = schema.since(ModClusterSchema.MODCLUSTER_4_0) ? require(reader, XMLAttribute.NAME) : "default"; + String name = require(reader, XMLAttribute.NAME); PathAddress address = parent.append(ProxyConfigurationResourceDefinition.pathElement(name)); ModelNode operation = Util.createAddOperation(address); @@ -178,71 +169,39 @@ private void parseProxy(XMLExtendedStreamReader reader, List list, Pa break; } case PROXY_LIST: { - // The legacy PROXY_LIST is here to support EAP 6.x slaves - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.PROXY_LIST); - break; - } - // 1.0 - case DOMAIN: { - if (schema == ModClusterSchema.MODCLUSTER_1_0) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.LOAD_BALANCING_GROUP); - break; + if (this.schema.since(ModClusterSchema.MODCLUSTER_6_0)) { + throw ParseUtils.unexpectedAttribute(reader, i); } + ROOT_LOGGER.ignoredAttribute(attribute.getLocalName(), reader.getLocalName()); + break; } - // 1.1 case LOAD_BALANCING_GROUP: { - if (schema.since(ModClusterSchema.MODCLUSTER_1_1)) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.LOAD_BALANCING_GROUP); - break; - } - } - case CONNECTOR: { - if (schema.since(ModClusterSchema.MODCLUSTER_1_1) && !schema.since(ModClusterSchema.MODCLUSTER_4_0)) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.LISTENER); - break; - } else { - throw unexpectedAttribute(reader, i); - } + readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.LOAD_BALANCING_GROUP); + break; } - // 1.2 case SESSION_DRAINING_STRATEGY: { - if (schema.since(ModClusterSchema.MODCLUSTER_1_2)) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.SESSION_DRAINING_STRATEGY); - break; - } + readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.SESSION_DRAINING_STRATEGY); + break; } - // 2.0 case STATUS_INTERVAL: { - if (schema.since(ModClusterSchema.MODCLUSTER_2_0)) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.STATUS_INTERVAL); - break; - } + readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.STATUS_INTERVAL); + break; } case PROXIES: { - if (schema.since(ModClusterSchema.MODCLUSTER_2_0)) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.PROXIES); - break; - } + readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.PROXIES); + break; } - // 3.0 case SSL_CONTEXT: { - if (schema.since(ModClusterSchema.MODCLUSTER_3_0)) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.SSL_CONTEXT); - break; - } + readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.SSL_CONTEXT); + break; } - // 4.0 case NAME: { - if (schema.since(ModClusterSchema.MODCLUSTER_4_0)) { - // Ignore -- already parsed. - break; - } + // Ignore -- already parsed. + break; } case LISTENER: { - if (schema.since(ModClusterSchema.MODCLUSTER_4_0)) { - readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.LISTENER); - break; - } + readAttribute(reader, i, operation, ProxyConfigurationResourceDefinition.Attribute.LISTENER); + break; } default: { throw unexpectedAttribute(reader, i); @@ -250,11 +209,6 @@ private void parseProxy(XMLExtendedStreamReader reader, List list, Pa } } - if (schema == ModClusterSchema.MODCLUSTER_1_0) { - // This is a required attribute - so set it to something reasonable - setAttribute(reader, "ajp", operation, ProxyConfigurationResourceDefinition.Attribute.LISTENER); - } - while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { XMLElement element = XMLElement.forName(reader.getLocalName()); switch (element) { @@ -267,7 +221,8 @@ private void parseProxy(XMLExtendedStreamReader reader, List list, Pa break; } case SSL: { - this.parseSSL(reader, list, address); + ROOT_LOGGER.ignoredElement(element.getLocalName()); + ParseUtils.requireNoContent(reader); break; } default: { @@ -277,53 +232,6 @@ private void parseProxy(XMLExtendedStreamReader reader, List list, Pa } } - @SuppressWarnings("deprecation") - private void parseSSL(XMLExtendedStreamReader reader, List list, PathAddress parent) throws XMLStreamException { - PathAddress address = parent.append(SSLResourceDefinition.PATH); - ModelNode operation = Util.createAddOperation(address); - list.add(operation); - int count = reader.getAttributeCount(); - for (int i = 0; i < count; i++) { - requireNoNamespaceAttribute(reader, i); - XMLAttribute attribute = XMLAttribute.forName(reader.getAttributeLocalName(i)); - switch (attribute) { - // toto enum-ize - case KEY_ALIAS: { - readAttribute(reader, i, operation, SSLResourceDefinition.Attribute.KEY_ALIAS); - break; - } - case PASSWORD: { - readAttribute(reader, i, operation, SSLResourceDefinition.Attribute.PASSWORD); - break; - } - case CERTIFICATE_KEY_FILE: { - readAttribute(reader, i, operation, SSLResourceDefinition.Attribute.CERTIFICATE_KEY_FILE); - break; - } - case CIPHER_SUITE: { - readAttribute(reader, i, operation, SSLResourceDefinition.Attribute.CIPHER_SUITE); - break; - } - case PROTOCOL: { - readAttribute(reader, i, operation, SSLResourceDefinition.Attribute.PROTOCOL); - break; - } - case CA_CERTIFICATE_FILE: { - readAttribute(reader, i, operation, SSLResourceDefinition.Attribute.CA_CERTIFICATE_FILE); - break; - } - case CA_REVOCATION_URL: { - readAttribute(reader, i, operation, SSLResourceDefinition.Attribute.CA_REVOCATION_URL); - break; - } - default: { - throw unexpectedAttribute(reader, i); - } - } - } - ParseUtils.requireNoContent(reader); - } - private void parseSimpleLoadProvider(XMLExtendedStreamReader reader, List list, PathAddress parent) throws XMLStreamException { PathAddress address = parent.append(SimpleLoadProviderResourceDefinition.PATH); ModelNode operation = Util.createAddOperation(address); @@ -398,6 +306,10 @@ private void parseDynamicLoadProvider(XMLExtendedStreamReader reader, List list, PathAddress address) throws XMLStreamException { String type = require(reader, TYPE); + if ("mem".equalsIgnoreCase(type)) { + ROOT_LOGGER.ignoredElement(type); + ParseUtils.requireNoContent(reader); + } PathAddress opAddress = address.append(LoadMetricResourceDefinition.pathElement(type)); ModelNode operation = Util.createAddOperation(opAddress); diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLWriter.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLWriter.java index 04e148f66eb7..7abaa2adc0d3 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLWriter.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ModClusterSubsystemXMLWriter.java @@ -53,7 +53,6 @@ public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMa writer.writeEndElement(); } - @SuppressWarnings("deprecation") private static void writeProxy(XMLExtendedStreamWriter writer, String name, ModelNode model) throws XMLStreamException { writer.writeStartElement(XMLElement.PROXY.getLocalName()); @@ -91,11 +90,6 @@ private static void writeProxy(XMLExtendedStreamWriter writer, String name, Mode } writer.writeEndElement(); } - if (model.get(SSLResourceDefinition.PATH.getKeyValuePair()).isDefined()) { - writer.writeStartElement(XMLElement.SSL.getLocalName()); - writeAttributes(writer, model.get(SSLResourceDefinition.PATH.getKeyValuePair()), EnumSet.allOf(SSLResourceDefinition.Attribute.class)); - writer.writeEndElement(); - } writer.writeEndElement(); } diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationResourceDefinition.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationResourceDefinition.java index 8e3bf98470c9..d09ab45e0e8a 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationResourceDefinition.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationResourceDefinition.java @@ -22,14 +22,8 @@ package org.wildfly.extension.mod_cluster; -import static org.wildfly.extension.mod_cluster.ModClusterLogger.ROOT_LOGGER; - -import java.util.EnumSet; -import java.util.Set; import java.util.function.UnaryOperator; -import org.jboss.as.clustering.controller.AttributeTranslation; -import org.jboss.as.clustering.controller.AttributeValueTranslator; import org.jboss.as.clustering.controller.ChildResourceDefinition; import org.jboss.as.clustering.controller.CommonUnaryRequirement; import org.jboss.as.clustering.controller.FunctionExecutorRegistry; @@ -40,25 +34,16 @@ import org.jboss.as.clustering.controller.UnaryCapabilityNameResolver; import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.AttributeMarshaller; -import org.jboss.as.controller.OperationContext; -import org.jboss.as.controller.OperationFailedException; -import org.jboss.as.controller.OperationStepHandler; import org.jboss.as.controller.ParameterCorrector; -import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.PathElement; -import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; 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.client.helpers.Operations; import org.jboss.as.controller.operations.validation.EnumValidator; import org.jboss.as.controller.operations.validation.IntRangeValidator; -import org.jboss.as.controller.operations.validation.ParameterValidator; import org.jboss.as.controller.operations.validation.StringLengthValidator; -import org.jboss.as.controller.registry.AliasEntry; -import org.jboss.as.controller.registry.Resource; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; import org.jboss.modcluster.ModClusterServiceMBean; @@ -73,7 +58,6 @@ public class ProxyConfigurationResourceDefinition extends ChildResourceDefinitio private static final String UNDERTOW_LISTENER_CAPABILITY_NAME = "org.wildfly.undertow.listener"; - static final PathElement LEGACY_PATH = PathElement.pathElement("mod-cluster-config", "configuration"); static final PathElement WILDCARD_PATH = pathElement(PathElement.WILDCARD_VALUE); static PathElement pathElement(String name) { @@ -171,39 +155,6 @@ public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder b } }, PROXIES("proxies"), - PROXY_LIST("proxy-list", ModelType.STRING, null) { - @Override - public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) { - return builder - .setValidator(new ParameterValidator() { - @Override - public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { - if (value.isDefined()) { - String str = value.asString(); - String[] results = str.split(","); - for (String result : results) { - int i = result.lastIndexOf(":"); - try { - //validate that the port is >0 and that the host is not the empty string - //this also validates that both a host and port have been supplied - //<=1 as we want to make sure the host is not the empty string - if (i <= 1 || Integer.parseInt(result.substring(i + 1)) <= 0) { - throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.needHostAndPort(result)); - } - } catch (NumberFormatException e) { - throw new OperationFailedException(ModClusterLogger.ROOT_LOGGER.needHostAndPort(result)); - } - } - } - - } - }) - .addAccessConstraint(ModClusterExtension.MOD_CLUSTER_PROXIES_DEF) - .setDeprecated(ModClusterModel.VERSION_2_0_0.getVersion()) - .addAlternatives(PROXIES.getName()) - ; - } - }, PROXY_URL("proxy-url", ModelType.STRING, new ModelNode("/")) { @Override public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) { @@ -303,7 +254,6 @@ public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder b .setCapabilityReference(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getName()) .setAttributeMarshaller(AttributeMarshaller.STRING_LIST) .addAccessConstraint(ModClusterExtension.MOD_CLUSTER_PROXIES_DEF) - .addAlternatives("proxy-list") .build(); } @@ -318,23 +268,6 @@ public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder b } } - enum DeprecatedAttribute implements org.jboss.as.clustering.controller.Attribute { - CONNECTOR("connector", ModelType.STRING, ModClusterModel.VERSION_6_0_0), - SIMPLE_LOAD_PROVIDER("simple-load-provider", ModelType.INT, ModClusterModel.VERSION_6_0_0), - ; - - private final AttributeDefinition definition; - - DeprecatedAttribute(String name, ModelType type, ModClusterModel deprecation) { - this.definition = new SimpleAttributeDefinitionBuilder(name, type, true).setDeprecated(deprecation.getVersion()).build(); - } - - @Override - public AttributeDefinition getDefinition() { - return this.definition; - } - } - private final FunctionExecutorRegistry executors; public ProxyConfigurationResourceDefinition(FunctionExecutorRegistry executors) { @@ -342,124 +275,26 @@ public ProxyConfigurationResourceDefinition(FunctionExecutorRegistry children = aliasContext.readResourceFromRoot(rebuiltAddress, false).getChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey()); - if (children.size() > 1 && !Operations.getOperationName(aliasContext.getOperation()).equals(AliasContext.RECURSIVE_GLOBAL_OP)) { - throw new IllegalStateException(ModClusterLogger.ROOT_LOGGER.legacyOperationsWithMultipleProxies()); - } - PathAddress proxyPath = PathAddress.pathAddress(ProxyConfigurationResourceDefinition.pathElement(children.iterator().next().getName())); - rebuiltAddress = rebuiltAddress.append(proxyPath); - } else { - // handle :add - rebuiltAddress = rebuiltAddress.append(ProxyConfigurationResourceDefinition.pathElement("default")); - } - } catch (Resource.NoSuchResourceException ignore) { - // handle recursive-global-op - rebuiltAddress = rebuiltAddress.append(ProxyConfigurationResourceDefinition.WILDCARD_PATH); - } - } else { - rebuiltAddress = rebuiltAddress.append(pathElement); - } - } - return rebuiltAddress; - } - }); - if (registration.isRuntimeOnlyRegistrationValid()) { new OperationHandler<>(new ProxyOperationExecutor(this.executors), ProxyOperation.class).register(registration); } new ReloadRequiredResourceRegistration(descriptor).register(registration); - new LegacyMetricOperationsRegistration().register(registration); new SimpleLoadProviderResourceDefinition().register(registration); new DynamicLoadProviderResourceDefinition().register(registration); - new SSLResourceDefinition().register(registration); - return registration; } - private static final AttributeTranslation SIMPLE_LOAD_PROVIDER_TRANSLATION = new AttributeTranslation() { - @Override - public org.jboss.as.clustering.controller.Attribute getTargetAttribute() { - return SimpleLoadProviderResourceDefinition.Attribute.FACTOR; - } - - private final AttributeValueTranslator simpleLoadFactorDefinedValidator = new AttributeValueTranslator() { - @Override - public ModelNode translate(OperationContext context, ModelNode value) throws OperationFailedException { - // Skip if executed on the existing current resource - PathAddress currentAddress = context.getCurrentAddress(); - if (currentAddress.getLastElement().equals(SimpleLoadProviderResourceDefinition.PATH)) { - return value; - } - - try { - // Otherwise, fail if operation executed on the legacy resource if dynamic load provider is defined - PathAddress address = PathAddress.pathAddress(DynamicLoadProviderResourceDefinition.PATH); - context.readResource(address, false); - } catch (Resource.NoSuchResourceException ignore) { - return value; - } - throw ROOT_LOGGER.simpleLoadFactorProviderIsNotConfigured(); - } - }; - - @Override - public AttributeValueTranslator getReadTranslator() { - return simpleLoadFactorDefinedValidator; - } - - @Override - public AttributeValueTranslator getWriteTranslator() { - return simpleLoadFactorDefinedValidator; - } - - @Override - public UnaryOperator getPathAddressTransformation() { - return new UnaryOperator<>() { - @Override - public PathAddress apply(PathAddress pathAddress) { - return pathAddress.append(SimpleLoadProviderResourceDefinition.PATH); - } - }; - } - }; - } diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationServiceConfigurator.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationServiceConfigurator.java index 670a5376fda3..9e7a28519bf7 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationServiceConfigurator.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/ProxyConfigurationServiceConfigurator.java @@ -36,7 +36,6 @@ import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.NODE_TIMEOUT; import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.PING; import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.PROXIES; -import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.PROXY_LIST; import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.PROXY_URL; import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.SESSION_DRAINING_STRATEGY; import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.SMAX; @@ -49,12 +48,9 @@ import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.TTL; import static org.wildfly.extension.mod_cluster.ProxyConfigurationResourceDefinition.Attribute.WORKER_TIMEOUT; -import javax.net.ssl.SSLContext; import java.net.InetSocketAddress; import java.net.NetworkInterface; import java.net.SocketException; -import java.net.UnknownHostException; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -67,6 +63,7 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import javax.net.ssl.SSLContext; import org.jboss.as.clustering.controller.CapabilityServiceNameProvider; import org.jboss.as.clustering.controller.CommonUnaryRequirement; @@ -78,14 +75,10 @@ import org.jboss.as.network.OutboundSocketBinding; import org.jboss.as.network.SocketBinding; import org.jboss.dmr.ModelNode; -import org.jboss.modcluster.ModClusterService; -import org.jboss.modcluster.Utils; import org.jboss.modcluster.config.ModClusterConfiguration; import org.jboss.modcluster.config.ProxyConfiguration; import org.jboss.modcluster.config.builder.ModClusterConfigurationBuilder; -import org.jboss.modcluster.config.impl.ModClusterConfig; import org.jboss.modcluster.config.impl.SessionDrainingStrategyEnum; -import org.jboss.modcluster.mcmp.impl.JSSESocketFactory; import org.jboss.msc.Service; import org.jboss.msc.service.ServiceBuilder; import org.jboss.msc.service.ServiceController; @@ -118,7 +111,6 @@ public ServiceName getServiceName() { return super.getServiceName().append("configuration"); } - @SuppressWarnings("deprecation") @Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { @@ -226,36 +218,6 @@ public ServiceConfigurator configure(OperationContext context, ModelNode model) } } - String proxyList = PROXY_LIST.resolveModelAttribute(context, model).asStringOrNull(); - if (proxyList != null && proxyList.length() != 0) { - Collection proxyConfigurations; - - String[] tokens = proxyList.split(","); - proxyConfigurations = new ArrayList<>(tokens.length); - - for (String token : tokens) { - try { - final InetSocketAddress remoteAddress = Utils.parseSocketAddress(token.trim(), ModClusterService.DEFAULT_PORT); - proxyConfigurations.add(new ProxyConfiguration() { - @Override - public InetSocketAddress getRemoteAddress() { - return remoteAddress; - } - - @Override - public InetSocketAddress getLocalAddress() { - return null; - } - }); - } catch (UnknownHostException e) { - throw new IllegalArgumentException(e); - } - } - - builder.mcmp().setProxyConfigurations(proxyConfigurations); - } - - // Elytron-based security support node = SSL_CONTEXT.resolveModelAttribute(context, model); @@ -263,50 +225,6 @@ public InetSocketAddress getLocalAddress() { this.sslContextDependency = new ServiceSupplierDependency<>(CommonUnaryRequirement.SSL_CONTEXT.getServiceName(context, node.asString())); } - // Legacy security support - - if (model.get(SSLResourceDefinition.PATH.getKeyValuePair()).isDefined()) { - if (node.isDefined()) { - throw ROOT_LOGGER.bothElytronAndLegacySslContextDefined(); - } - ModelNode sslModel = model.get(SSLResourceDefinition.PATH.getKeyValuePair()); - - ModClusterConfig sslConfiguration = new ModClusterConfig(); - - node = SSLResourceDefinition.Attribute.KEY_ALIAS.resolveModelAttribute(context, sslModel); - if (node.isDefined()) { - sslConfiguration.setSslKeyAlias(node.asString()); - } - node = SSLResourceDefinition.Attribute.PASSWORD.resolveModelAttribute(context, sslModel); - if (node.isDefined()) { - String password = node.asString(); - sslConfiguration.setSslTrustStorePassword(password); - sslConfiguration.setSslKeyStorePassword(password); - } - node = SSLResourceDefinition.Attribute.CERTIFICATE_KEY_FILE.resolveModelAttribute(context, sslModel); - if (node.isDefined()) { - sslConfiguration.setSslKeyStore(node.asString()); - } - node = SSLResourceDefinition.Attribute.CIPHER_SUITE.resolveModelAttribute(context, sslModel); - if (node.isDefined()) { - sslConfiguration.setSslCiphers(node.asString()); - } - node = SSLResourceDefinition.Attribute.PROTOCOL.resolveModelAttribute(context, sslModel); - if (node.isDefined()) { - sslConfiguration.setSslProtocol(node.asString()); - } - node = SSLResourceDefinition.Attribute.CA_CERTIFICATE_FILE.resolveModelAttribute(context, sslModel); - if (node.isDefined()) { - sslConfiguration.setSslTrustStore(node.asString()); - } - node = SSLResourceDefinition.Attribute.CA_REVOCATION_URL.resolveModelAttribute(context, sslModel); - if (node.isDefined()) { - sslConfiguration.setSslCrlFile(node.asString()); - } - - builder.mcmp().setSocketFactory(new JSSESocketFactory(sslConfiguration)); - } - return this; } diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/SSLResourceDefinition.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/SSLResourceDefinition.java deleted file mode 100644 index e7fe887737cc..000000000000 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/SSLResourceDefinition.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2011, Red Hat, Inc., and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.wildfly.extension.mod_cluster; - -import static org.wildfly.extension.mod_cluster.ModClusterLogger.ROOT_LOGGER; - -import java.util.List; -import java.util.function.UnaryOperator; - -import org.jboss.as.clustering.controller.ChildResourceDefinition; -import org.jboss.as.clustering.controller.ReloadRequiredResourceRegistration; -import org.jboss.as.clustering.controller.ResourceDescriptor; -import org.jboss.as.controller.AttributeDefinition; -import org.jboss.as.controller.OperationContext; -import org.jboss.as.controller.OperationFailedException; -import org.jboss.as.controller.OperationStepHandler; -import org.jboss.as.controller.PathElement; -import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler; -import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; -import org.jboss.as.controller.access.management.AccessConstraintDefinition; -import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition; -import org.jboss.as.controller.registry.ManagementResourceRegistration; -import org.jboss.as.controller.registry.Resource; -import org.jboss.dmr.ModelNode; -import org.jboss.dmr.ModelType; -import org.jboss.dmr.ValueExpression; - -/** - * {@link org.jboss.as.controller.ResourceDefinition} implementation for the legacy mod_cluster SSL configuration resource. - * - * @author Brian Stansberry (c) 2011 Red Hat Inc. - * @author Radoslav Husar - */ -@Deprecated -class SSLResourceDefinition extends ChildResourceDefinition { - - static final PathElement PATH = PathElement.pathElement("ssl", "configuration"); - - enum Attribute implements org.jboss.as.clustering.controller.Attribute, UnaryOperator { - CA_CERTIFICATE_FILE("ca-certificate-file", ModelType.STRING, null), - CA_REVOCATION_URL("ca-revocation-url", ModelType.STRING, null), - CERTIFICATE_KEY_FILE("certificate-key-file", ModelType.STRING, new ModelNode().set(new ValueExpression("${user.home}/.keystore"))), - CIPHER_SUITE("cipher-suite", ModelType.STRING, null), - KEY_ALIAS("key-alias", ModelType.STRING, null) { - @Override - public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) { - return builder.addAccessConstraint(SensitiveTargetAccessConstraintDefinition.CREDENTIAL); - } - }, - PASSWORD("password", ModelType.STRING, new ModelNode("changeit")) { - @Override - public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) { - return builder.addAccessConstraint(SensitiveTargetAccessConstraintDefinition.CREDENTIAL); - } - }, - PROTOCOL("protocol", ModelType.STRING, new ModelNode("TLS")), - ; - - private final AttributeDefinition definition; - - Attribute(String name, ModelType type, ModelNode defaultValue) { - this.definition = this.apply(new SimpleAttributeDefinitionBuilder(name, type) - .setAllowExpression(true) - .setRequired(false) - .setDefaultValue(defaultValue) - .setRestartAllServices() - ).build(); - } - - @Override - public AttributeDefinition getDefinition() { - return this.definition; - } - - @Override - public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) { - return builder; - } - } - - SSLResourceDefinition() { - super(PATH, ModClusterExtension.SUBSYSTEM_RESOLVER.createChildResolver(PATH)); - - this.setDeprecated(ModClusterModel.VERSION_5_0_0.getVersion()); - } - - @Override - public ManagementResourceRegistration register(ManagementResourceRegistration parent) { - ManagementResourceRegistration registration = parent.registerSubModel(this); - - ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()) - .addExtraParameters(Attribute.class) - ; - - for (Attribute attribute : Attribute.values()) { - registration.registerReadWriteAttribute(attribute.getDefinition(), null, new ReloadRequiredWriteAttributeHandler(attribute.getDefinition()) { - @Override - protected void validateUpdatedModel(OperationContext context, Resource model) { - context.addStep(new OperationStepHandler() { - @Override - public void execute(OperationContext ctx, ModelNode op) throws OperationFailedException { - final ModelNode conf = ctx.readResourceFromRoot(ctx.getCurrentAddress().getParent(), false).getModel(); - if (conf.hasDefined(ProxyConfigurationResourceDefinition.Attribute.SSL_CONTEXT.getName())) { - throw new OperationFailedException(ROOT_LOGGER.bothElytronAndLegacySslContextDefined()); - } - } - }, OperationContext.Stage.MODEL); - } - }); - } - - new ReloadRequiredResourceRegistration(descriptor).register(registration); - - return registration; - } - - - @Override - public List getAccessConstraints() { - return ModClusterExtension.MOD_CLUSTER_SECURITY_DEF.wrapAsList(); - } - -} diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLAttribute.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLAttribute.java index dd6a4bd59cfa..7b7cf684da6c 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLAttribute.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLAttribute.java @@ -34,7 +34,6 @@ * @author Jean-Frederic Clere * @author Radoslav Husar */ -@SuppressWarnings("deprecation") enum XMLAttribute { UNKNOWN((String) null), @@ -44,8 +43,6 @@ enum XMLAttribute { ADVERTISE_SOCKET(ProxyConfigurationResourceDefinition.Attribute.ADVERTISE_SOCKET), AUTO_ENABLE_CONTEXTS(ProxyConfigurationResourceDefinition.Attribute.AUTO_ENABLE_CONTEXTS), BALANCER(ProxyConfigurationResourceDefinition.Attribute.BALANCER), - @Deprecated CONNECTOR(ProxyConfigurationResourceDefinition.DeprecatedAttribute.CONNECTOR), - @Deprecated DOMAIN("domain"), EXCLUDED_CONTEXTS(ProxyConfigurationResourceDefinition.Attribute.EXCLUDED_CONTEXTS), FLUSH_PACKETS(ProxyConfigurationResourceDefinition.Attribute.FLUSH_PACKETS), FLUSH_WAIT(ProxyConfigurationResourceDefinition.Attribute.FLUSH_WAIT), @@ -56,7 +53,7 @@ enum XMLAttribute { NODE_TIMEOUT(ProxyConfigurationResourceDefinition.Attribute.NODE_TIMEOUT), PING(ProxyConfigurationResourceDefinition.Attribute.PING), PROXIES(ProxyConfigurationResourceDefinition.Attribute.PROXIES), - PROXY_LIST(ProxyConfigurationResourceDefinition.Attribute.PROXY_LIST), + PROXY_LIST("proxy-list"), PROXY_URL(ProxyConfigurationResourceDefinition.Attribute.PROXY_URL), SESSION_DRAINING_STRATEGY(ProxyConfigurationResourceDefinition.Attribute.SESSION_DRAINING_STRATEGY), SMAX(ProxyConfigurationResourceDefinition.Attribute.SMAX), @@ -82,15 +79,6 @@ enum XMLAttribute { MODULE(CustomLoadMetricResourceDefinition.Attribute.MODULE), TYPE(LoadMetricResourceDefinition.Attribute.TYPE), WEIGHT(LoadMetricResourceDefinition.SharedAttribute.WEIGHT), - - // Legacy SSL - CA_CERTIFICATE_FILE(SSLResourceDefinition.Attribute.CA_CERTIFICATE_FILE), - CA_REVOCATION_URL(SSLResourceDefinition.Attribute.CA_REVOCATION_URL), - CERTIFICATE_KEY_FILE(SSLResourceDefinition.Attribute.CERTIFICATE_KEY_FILE), - CIPHER_SUITE(SSLResourceDefinition.Attribute.CIPHER_SUITE), - KEY_ALIAS(SSLResourceDefinition.Attribute.KEY_ALIAS), - PASSWORD(SSLResourceDefinition.Attribute.PASSWORD), - PROTOCOL(SSLResourceDefinition.Attribute.PROTOCOL), ; private final String name; diff --git a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLElement.java b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLElement.java index da721761e652..81e39de1d6a7 100644 --- a/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLElement.java +++ b/mod_cluster/extension/src/main/java/org/wildfly/extension/mod_cluster/XMLElement.java @@ -36,17 +36,16 @@ enum XMLElement { UNKNOWN((String) null), - @Deprecated MOD_CLUSTER_CONFIG(ProxyConfigurationResourceDefinition.LEGACY_PATH), PROXY(ProxyConfigurationResourceDefinition.WILDCARD_PATH), - SIMPLE_LOAD_PROVIDER(ProxyConfigurationResourceDefinition.DeprecatedAttribute.SIMPLE_LOAD_PROVIDER.getName()), - DYNAMIC_LOAD_PROVIDER(DynamicLoadProviderResourceDefinition.LEGACY_PATH), + SIMPLE_LOAD_PROVIDER("simple-load-provider"), + DYNAMIC_LOAD_PROVIDER("dynamic-load-provider"), CUSTOM_LOAD_METRIC(CustomLoadMetricResourceDefinition.WILDCARD_PATH), LOAD_METRIC(LoadMetricResourceDefinition.WILDCARD_PATH), PROPERTY(ModelDescriptionConstants.PROPERTY), - @Deprecated SSL(SSLResourceDefinition.PATH), + SSL("ssl"), ; private final String name; diff --git a/mod_cluster/extension/src/main/resources/org/wildfly/extension/mod_cluster/LocalDescriptions.properties b/mod_cluster/extension/src/main/resources/org/wildfly/extension/mod_cluster/LocalDescriptions.properties index abdad494e775..98cec2b8f5a3 100644 --- a/mod_cluster/extension/src/main/resources/org/wildfly/extension/mod_cluster/LocalDescriptions.properties +++ b/mod_cluster/extension/src/main/resources/org/wildfly/extension/mod_cluster/LocalDescriptions.properties @@ -4,7 +4,6 @@ modcluster.add=Add the mod_cluster subsystem leaving the server in 'reload-requi modcluster.remove=Remove the mod_cluster subsystem leaving the server in 'reload-required' state. # Proxy Configuration -modcluster.mod-cluster-config=Legacy configuration resource. modcluster.proxy=Proxy resource coupled with single Undertow listener (and server) specifying load balancer discovery, its configuration and load balance factor provider. Multiple proxy configuration can be specified. modcluster.proxy.add=Add a proxy resource requiring an Undertow listener reference leaving the server in 'reload-required' state. modcluster.proxy.remove=Remove a proxy resource leaving the server in 'reload-required' state. @@ -13,8 +12,6 @@ modcluster.proxy.advertise-security-key=If specified, reverse proxy advertisemen modcluster.proxy.advertise-socket=Name of socket binding to use for the advertise socket. modcluster.proxy.auto-enable-contexts=If false, the contexts are registered with the reverse proxy as disabled, they need to be enabled manually by 'enable-context' operation or via mod_cluster_manager console (if available). modcluster.proxy.balancer=The name of the balancer on the reverse proxy to register with. -modcluster.proxy.connector=The name of Undertow listener that will be registered with the reverse proxy. -modcluster.proxy.connector.deprecated=Deprecated. Functions as alias for the 'listener' attribute. modcluster.proxy.excluded-contexts=List of contexts to exclude from registration with the reverse proxies. modcluster.proxy.flush-packets=Whether to enable packet flushing on the reverse proxy. modcluster.proxy.flush-wait=Time to wait before flushing packets on the reverse proxy. @@ -24,11 +21,7 @@ modcluster.proxy.max-attempts=Maximum number of failover attempts by reverse pro modcluster.proxy.node-timeout=Timeout (in seconds) for proxy connections to a node. That is the time mod_cluster will wait for the back-end response before returning an error. modcluster.proxy.ping=Number of seconds for which to wait for a pong answer to a ping. modcluster.proxy.proxies=List of reverse proxies for mod_cluster to register with defined by 'outbound-socket-binding' in 'socket-binding-group'. -modcluster.proxy.proxy-list=List of reverse proxies to register with. Format (hostname:port) separated with commas. -modcluster.proxy.proxy-list.deprecated=The 'proxy-list' attribute has been deprecated in favor of proxies (list of references to outbound-socket-binding) modcluster.proxy.proxy-url=Base URL for MCMP requests. -modcluster.proxy.simple-load-provider=Simple load provider returns constant pre-configured load balancing factor. -modcluster.proxy.simple-load-provider.deprecated=Deprecated. Alias for child resource load-balancer=simple. modcluster.proxy.session-draining-strategy=Session draining strategy used during undeployment of a web application. modcluster.proxy.smax=Soft maximum idle connection count for reverse proxy. modcluster.proxy.socket-timeout=Timeout to wait for the reverse proxy to answer a MCMP message. @@ -68,73 +61,27 @@ modcluster.custom-load-metric=Custom load metric loaded from a specified Java cl # Runtime-only Operations modcluster.add-proxy=Add a reverse proxy to the list of proxies to register with. -modcluster.add-proxy.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.add-proxy.host=Host of the reverse proxy. modcluster.add-proxy.port=Port of the reverse proxy accepting MCMP commands. modcluster.disable=Tell reverse proxies that all contexts of the node can't process new requests. -modcluster.disable.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.disable-context=Tell reverse proxies that the context can't process new requests. -modcluster.disable-context.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.disable-context.context=Name of the context to disable. modcluster.disable-context.virtualhost=Name of the virtual host to disable context on. modcluster.enable=Tell reverse proxies that all contexts on the node are ready to receive requests. -modcluster.enable.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.enable-context=Tell reverse proxies that the context is ready to receive requests. -modcluster.enable-context.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.enable-context.context=Name of the context to enable. modcluster.enable-context.virtualhost=Name of the virtual host to enable context for. modcluster.list-proxies=List the reverse proxies this node is currently registered with. -modcluster.list-proxies.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.read-proxies-configuration=Send a DUMP command to the reverse proxies and display the result. -modcluster.read-proxies-configuration.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.read-proxies-info=Send an INFO command to the reverse proxies and display the result. -modcluster.read-proxies-info.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.refresh=Refresh the node sending a new CONFIG message to the reverse proxies. -modcluster.refresh.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.remove-proxy=Remove the reverse proxy from the list of proxies to register with. -modcluster.remove-proxy.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.remove-proxy.host=Host of the reverse proxy. modcluster.remove-proxy.port=Port of the reverse proxy. modcluster.reset=Reset the node's connection to the reverse proxies. -modcluster.reset.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.stop=Tell reverse proxies that all contexts on the node can't process requests. -modcluster.stop.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.stop.waittime=Number of seconds for which to wait for sessions to drain before stopping all contexts if session draining is in effect. Negative or zero timeout value will wait indefinitely. modcluster.stop-context=Tell reverse proxies that the context can't process requests. -modcluster.stop-context.deprecated=Deprecated. Use identical operation at an address of a specific proxy. modcluster.stop-context.context=Name of the context to stop. modcluster.stop-context.virtualhost=Name of the virtual host to stop the context on. modcluster.stop-context.waittime=Number of seconds for which to wait for sessions to drain before stopping the context if session draining is in effect. Negative or zero timeout value will wait indefinitely. - -# Deprecated/Legacy Metric Operations -modcluster.add-metric=Add new metric to the dynamic load balance factor provider. -modcluster.add-metric.deprecated=Deprecated. Use regular 'add' management operation. -modcluster.add-metric.type=Type of the metric. -modcluster.add-metric.weight=Weight of the metric. -modcluster.add-metric.capacity=Capacity of the metric. -modcluster.add-metric.property=Properties for the metric. -modcluster.remove-metric=Remove a metric from the dynamic load balance factor provider. -modcluster.remove-metric.deprecated=Deprecated. Use regular 'remove' management operation. -modcluster.remove-metric.type=Type of the metric. -modcluster.add-custom-metric=Add new custom metric to the dynamic load balance factor provider. -modcluster.add-custom-metric.deprecated=Deprecated. Use regular 'add' management operation. -modcluster.add-custom-metric.class=Class of custom metric. -modcluster.add-custom-metric.weight=Weight of the metric. -modcluster.add-custom-metric.capacity=Capacity of the metric. -modcluster.add-custom-metric.property=Properties for the metric. -modcluster.remove-custom-metric=Remove a custom metric from the dynamic load balance factor provider. -modcluster.remove-custom-metric.deprecated=Deprecated. Use regular 'remove' management operation. -modcluster.remove-custom-metric.class=Class of custom metric. - -# Deprecated/Legacy SSL resource -modcluster.ssl=The SSL configuration to client MCMP logic. -modcluster.ssl.configuration.deprecated=Deprecated. Use ssl-context attribute to reference Elytron-managed SSLContext. -modcluster.ssl.configuration.add=Add SSL default configuration to client MCMP logic. -modcluster.ssl.configuration.remove=Remove the SSL configuration from client MCMP logic. -modcluster.ssl.configuration.ca-certificate-file=Certificate authority. -modcluster.ssl.configuration.ca-revocation-url=Certificate authority revocation list. -modcluster.ssl.configuration.certificate-key-file=Key file for the certificate. -modcluster.ssl.configuration.cipher-suite=Comma separated list of encryption ciphers the configuration is allowed to use. -modcluster.ssl.configuration.key-alias=The alias of the key holding the client certificates in the key store. -modcluster.ssl.configuration.password=Password granting access to the key store and trust store. -modcluster.ssl.configuration.protocol=The SSL protocols that are enabled. diff --git a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_0.xsd b/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_0.xsd deleted file mode 100644 index 59206fc25e13..000000000000 --- a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_0.xsd +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Value which will be prepended to the URL of MCMP commands. - - - - - The balancer name. All nodes of a cluster have to use the same value. - - - - - - - - - - - - - - The amount of time in seconds for which to wait for clean shutdown of a context. - - - - - Number of seconds to wait for a response from an httpd proxy to MCMP commands before timing out, and flagging the proxy as in error. - - - - - Timeout (in seconds) for proxy connections to a node. That is the time mod_cluster will wait for the back-end response before returning error. - - - - - Maximum number of failover attempts by reverse proxy when sending the request to the backend server. - - - - - Enables/disables packet flushing. - - - - - Time to wait before flushing packets in milliseconds. - - - - - Time (in seconds) in which to wait for a pong answer to a ping. - - - - - Soft maximum idle connection count. - - - - - Time to live (in seconds) for idle connections above smax. - - - - - Load balancing group - - - - - - Number of seconds to wait for a worker to become available to handle a request. When no workers of a - balancer are usable, mod_cluster will retry after a while (workerTimeout/100). That is timeout in the - balancer mod_proxy documentation. A value of -1 indicates that the HTTPd will not wait - for a worker to be available and will return an error if none is available. - - - - - - - - - - Configuration information for one SSL configuration. - sslCertificateEncodingAlgorithm (default value only) - sslKeyStoreType/sslTrustStoreType (JKS: default value only) - sslKeyStoreProvider/sslTrustStoreProvider (only default value). - sslTrustAlgorithm (only default value). - sslTrustMaxCertLength (5: default value only) - - - - - sslKeyAlias The alias of the key holding the client certificates in the key store. - - - - - - sslKeyStorePassword/sslTrustStorePassword Password granting access to the key store and trust store. - - - - - - - sslKeyStore: That is the keystore name here. - - - - - - - sslCiphers: comma separated list of encryption ciphers the configuration is allowed to use, that MUST NOT be - the JVM default in of JSSE as contains weak ciphers. - that is SSLCipherSuite when using OpenSSL (APR). - - - - - - - sslProtocol: Overrides the default SSL socket protocol. - - - - - - - sslTrustStore location of the file containing the trust store. - - - - - - - sslCrlFile A file or URL to get the revocation list. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_1.xsd b/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_1.xsd deleted file mode 100644 index 921c7314ec95..000000000000 --- a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_1.xsd +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Value which will be prepended to the URL of MCMP commands. - - - - - The balancer name. All nodes of a cluster have to use the same value. - - - - - - - - - - - - - - The amount of time in seconds for which to wait for clean shutdown of a context. - - - - - Number of seconds to wait for a response from an httpd proxy to MCMP commands before timing out, and flagging the proxy as in error. - - - - - Timeout (in seconds) for proxy connections to a node. That is the time mod_cluster will wait for the back-end response before returning error. - - - - - Maximum number of failover attempts by reverse proxy when sending the request to the backend server. - - - - - Enables/disables packet flushing. - - - - - Time to wait before flushing packets in milliseconds. - - - - - Time (in seconds) in which to wait for a pong answer to a ping. - - - - - Soft maximum idle connection count. - - - - - Time to live (in seconds) for idle connections above smax. - - - - - Load balancing group - - - - - The web connector on which mod_cluster will operate. - - - - - - Number of seconds to wait for a worker to become available to handle a request. When no workers of a - balancer are usable, mod_cluster will retry after a while (workerTimeout/100). That is timeout in the - balancer mod_proxy documentation. A value of -1 indicates that the HTTPd will not wait - for a worker to be available and will return an error if none is available. - - - - - - - - - - Configuration information for one SSL configuration. - sslCertificateEncodingAlgorithm (default value only) - sslKeyStoreType/sslTrustStoreType (JKS: default value only) - sslKeyStoreProvider/sslTrustStoreProvider (only default value). - sslTrustAlgorithm (only default value). - sslTrustMaxCertLength (5: default value only) - - - - - sslKeyAlias The alias of the key holding the client certificates in the key store. - - - - - - sslKeyStorePassword/sslTrustStorePassword Password granting access to the key store and trust store. - - - - - - - sslKeyStore: That is the keystore name here. - - - - - - - sslCiphers: comma separated list of encryption ciphers the configuration is allowed to use, that MUST NOT be - the JVM default in of JSSE as contains weak ciphers. - that is SSLCipherSuite when using OpenSSL (APR). - - - - - - - sslProtocol: Overrides the default SSL socket protocol. - - - - - - - sslTrustStore location of the file containing the trust store. - - - - - - - sslCrlFile A file or URL to get the revocation list. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_2.xsd b/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_2.xsd deleted file mode 100644 index 1d8617c543da..000000000000 --- a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_1_2.xsd +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Value which will be prepended to the URL of MCMP commands. - - - - - The balancer name. All nodes of a cluster have to use the same value. - - - - - - - - - - - - - - The amount of time in seconds for which to wait for clean shutdown of a context. - - - - - Number of seconds to wait for a response from an httpd proxy to MCMP commands before timing out, and flagging the proxy as in error. - - - - - Timeout (in seconds) for proxy connections to a node. That is the time mod_cluster will wait for the back-end response before returning error. - - - - - Maximum number of failover attempts by reverse proxy when sending the request to the backend server. - - - - - Enables/disables packet flushing. - - - - - Time to wait before flushing packets in milliseconds. - - - - - Time (in seconds) in which to wait for a pong answer to a ping. - - - - - Soft maximum idle connection count. - - - - - Time to live (in seconds) for idle connections above smax. - - - - - Load balancing group - - - - - The name of Undertow listener that mod_cluster reverse proxy will connect to. - - - - - Session draining strategy used during undeployment of a web application. - - - - - - Number of seconds to wait for a worker to become available to handle a request. When no workers of a - balancer are usable, mod_cluster will retry after a while (workerTimeout/100). That is timeout in the - balancer mod_proxy documentation. A value of -1 indicates that the HTTPd will not wait - for a worker to be available and will return an error if none is available. - - - - - - - - - - Configuration information for one SSL configuration. - sslCertificateEncodingAlgorithm (default value only) - sslKeyStoreType/sslTrustStoreType (JKS: default value only) - sslKeyStoreProvider/sslTrustStoreProvider (only default value). - sslTrustAlgorithm (only default value). - sslTrustMaxCertLength (5: default value only) - - - - - sslKeyAlias The alias of the key holding the client certificates in the key store. - - - - - - sslKeyStorePassword/sslTrustStorePassword Password granting access to the key store and trust store. - - - - - - - sslKeyStore: That is the keystore name here. - - - - - - - sslCiphers: comma separated list of encryption ciphers the configuration is allowed to use, that MUST NOT be - the JVM default in of JSSE as contains weak ciphers. - that is SSLCipherSuite when using OpenSSL (APR). - - - - - - - sslProtocol: Overrides the default SSL socket protocol. - - - - - - - sslTrustStore location of the file containing the trust store. - - - - - - - sslCrlFile A file or URL to get the revocation list. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deprecated. - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_2_0.xsd b/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_2_0.xsd deleted file mode 100644 index e5e6308399f4..000000000000 --- a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_2_0.xsd +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - List of proxies for mod_cluster to register with defined by outbound-socket-binding in socket-binding-group. - - - - - - - - Value which will be prepended to the URL of MCMP commands. - - - - - The balancer name. All nodes of a cluster have to use the same value. - - - - - - - - - - - - - - The amount of time in seconds for which to wait for clean shutdown of a context. - - - - - Number of seconds to wait for a response from an httpd proxy to MCMP commands before timing out, and flagging the proxy as in error. - - - - - Timeout (in seconds) for proxy connections to a node. That is the time mod_cluster will wait for the back-end response before returning error. - - - - - Maximum number of failover attempts by reverse proxy when sending the request to the backend server. - - - - - Enables/disables packet flushing. - - - - - Time to wait before flushing packets in milliseconds. - - - - - Time (in seconds) in which to wait for a pong answer to a ping. - - - - - Soft maximum idle connection count. - - - - - Time to live (in seconds) for idle connections above smax. - - - - - Load balancing group - - - - - The name of Undertow listener that mod_cluster reverse proxy will connect to. - - - - - Session draining strategy used during undeployment of a web application. - - - - - - Number of seconds to wait for a worker to become available to handle a request. When no workers of a - balancer are usable, mod_cluster will retry after a while (workerTimeout/100). That is timeout in the - balancer mod_proxy documentation. A value of -1 indicates that the HTTPd will not wait - for a worker to be available and will return an error if none is available. - - - - - - - Number of seconds a STATUS message is sent from the application server to reverse proxy. - Default: 10 seconds. - - - - - - - - - - Configuration information for one SSL configuration. - sslCertificateEncodingAlgorithm (default value only) - sslKeyStoreType/sslTrustStoreType (JKS: default value only) - sslKeyStoreProvider/sslTrustStoreProvider (only default value). - sslTrustAlgorithm (only default value). - sslTrustMaxCertLength (5: default value only) - - - - - sslKeyAlias The alias of the key holding the client certificates in the key store. - - - - - - sslKeyStorePassword/sslTrustStorePassword Password granting access to the key store and trust store. - - - - - - - sslKeyStore: That is the keystore name here. - - - - - - - sslCiphers: comma separated list of encryption ciphers the configuration is allowed to use, that MUST NOT be - the JVM default in of JSSE as contains weak ciphers. - that is SSLCipherSuite when using OpenSSL (APR). - - - - - - - sslProtocol: Overrides the default SSL socket protocol. - - - - - - - sslTrustStore location of the file containing the trust store. - - - - - - - sslCrlFile A file or URL to get the revocation list. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deprecated. - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_3_0.xsd b/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_3_0.xsd deleted file mode 100644 index 8633a18b9064..000000000000 --- a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_3_0.xsd +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Deprecated. Use ssl-context attribute instead. - - - - - - - - List of proxies for mod_cluster to register with defined by outbound-socket-binding in socket-binding-group. - - - - - - - - Value which will be prepended to the URL of MCMP commands. - - - - - The balancer name. All nodes of a cluster have to use the same value. - - - - - - - - - - - - - - The amount of time in seconds for which to wait for clean shutdown of a context. - - - - - Number of seconds to wait for a response from an httpd proxy to MCMP commands before timing out, and flagging the proxy as in error. - - - - - - Reference to the SSLContext to be used by mod_cluster. - - - - - - Timeout (in seconds) for proxy connections to a node. That is the time mod_cluster will wait for the back-end response before returning error. - - - - - Maximum number of failover attempts by reverse proxy when sending the request to the backend server. - - - - - Enables/disables packet flushing. - - - - - Time to wait before flushing packets in milliseconds. - - - - - Time (in seconds) in which to wait for a pong answer to a ping. - - - - - Soft maximum idle connection count. - - - - - Time to live (in seconds) for idle connections above smax. - - - - - Load balancing group - - - - - The name of Undertow listener that mod_cluster reverse proxy will connect to. - - - - - Session draining strategy used during undeployment of a web application. - - - - - - Number of seconds to wait for a worker to become available to handle a request. When no workers of a - balancer are usable, mod_cluster will retry after a while (workerTimeout/100). That is timeout in the - balancer mod_proxy documentation. A value of -1 indicates that the HTTPd will not wait - for a worker to be available and will return an error if none is available. - - - - - - - Number of seconds a STATUS message is sent from the application server to reverse proxy. - Default: 10 seconds. - - - - - - - - - Deprecated. Configuration information for one SSL configuration. - sslCertificateEncodingAlgorithm (default value only) - sslKeyStoreType/sslTrustStoreType (JKS: default value only) - sslKeyStoreProvider/sslTrustStoreProvider (only default value). - sslTrustAlgorithm (only default value). - sslTrustMaxCertLength (5: default value only) - - - - - - Deprecated. sslKeyAlias The alias of the key holding the client certificates in the key store. - - - - - - - Deprecated. sslKeyStorePassword/sslTrustStorePassword Password granting access to the key store and trust store. - - - - - - - Deprecated. sslKeyStore: That is the keystore name here. - - - - - - - Deprecated. sslCiphers: comma separated list of encryption ciphers the configuration is allowed to use, that MUST NOT be - the JVM default in of JSSE as contains weak ciphers. - that is SSLCipherSuite when using OpenSSL (APR). - - - - - - - Deprecated. sslProtocol: Overrides the default SSL socket protocol. - - - - - - - Deprecated. sslTrustStore location of the file containing the trust store. - - - - - - - Deprecated. sslCrlFile A file or URL to get the revocation list. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deprecated. - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_4_0.xsd b/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_6_0.xsd similarity index 85% rename from mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_4_0.xsd rename to mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_6_0.xsd index 7549d65febd5..c3209b3e35d6 100644 --- a/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_4_0.xsd +++ b/mod_cluster/extension/src/main/resources/schema/jboss-as-mod-cluster_6_0.xsd @@ -1,7 +1,7 @@ - + @@ -57,13 +60,6 @@ - - - - Deprecated. Use 'ssl-context' attribute instead. - - - @@ -176,14 +172,6 @@ - - - - Deprecated in favor of proxies (list of references to outbound-socket-binding). List of reverse proxies to - register with. Format (hostname:port) separated with commas. - - - @@ -315,6 +303,14 @@ + + + + Initial load within the range [0..100] with which to prepopulate historical values. Used to gradually drive + load to the node. Value of 0 prepopulates with full load and value of -1 disables this behavior. + + + @@ -389,13 +385,6 @@ - - - - Deprecated. Will be ignored at runtime if specified. - - - @@ -447,61 +436,4 @@ - - - - Deprecated. The SSL configuration to client MCMP logic. - - - - - - Location of the file containing the trust store. - - - - - - - Certificate authority revocation list. - - - - - - - Key file for the certificate. - - - - - - - The alias of the key holding the client certificates in the key store. - - - - - - - Password granting access to the key store and trust store. - - - - - - - Comma separated list of encryption ciphers the configuration is allowed to use. - - - - - - - The SSL protocols that are enabled. - - - - - diff --git a/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterOperationsTestCase.java b/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterOperationsTestCase.java index 070ae6974bb8..3b511b0e8662 100644 --- a/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterOperationsTestCase.java +++ b/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterOperationsTestCase.java @@ -21,23 +21,15 @@ */ package org.wildfly.extension.mod_cluster; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPRECATED; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.FAILED; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.FAILURE_DESCRIPTION; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OUTCOME; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_DESCRIPTION_OPERATION; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_NAMES_OPERATION; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESULT; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUCCESS; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION; -import static org.jboss.as.domain.management.ModelDescriptionConstants.VALUE; import java.io.IOException; -import org.jboss.as.clustering.controller.Attribute; import org.jboss.as.clustering.controller.CommonUnaryRequirement; -import org.jboss.as.clustering.controller.Operations; import org.jboss.as.clustering.subsystem.AdditionalInitialization; import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.operations.common.Util; @@ -48,30 +40,16 @@ import org.junit.Test; /** - * Test case for testing individual management operations, especially useless and convoluted legacy operations. + * Test case for testing proxy operations. * * @author Radoslav Husar */ -@SuppressWarnings("SameParameterValue") public class ModClusterOperationsTestCase extends AbstractSubsystemTest { public ModClusterOperationsTestCase() { super(ModClusterExtension.SUBSYSTEM_NAME, new ModClusterExtension()); } - @Test - public void testLegacyPathOperations() throws Exception { - KernelServices services = this.buildKernelServices(); - - ModelNode op = createLegacyModClusterConfigWriteAttributeOperation(ProxyConfigurationResourceDefinition.Attribute.PING,new ModelNode(10)); - ModelNode result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - op = createLegacyModClusterConfigLoadMetricWriteAttributeOperation("mem",LoadMetricResourceDefinition.SharedAttribute.WEIGHT,new ModelNode(10)); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - } - @Test public void testProxyOperations() throws Exception { KernelServices services = this.buildKernelServices(); @@ -87,159 +65,16 @@ public void testProxyOperations() throws Exception { } } - /** - * Tests that legacy proxy operations are registered at the subsystem level. - */ - @Test - public void testLegacyProxyOperations() throws Exception { - KernelServices services = this.buildKernelServices(); - - ModelNode op = Util.createOperation(READ_OPERATION_NAMES_OPERATION, getSubsystemAddress()); - - ModelNode result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - for (ProxyOperation proxyOperation : ProxyOperation.values()) { - String operationName = proxyOperation.getDefinition().getName(); - Assert.assertTrue(String.format("'%s' legacy operation is not registered", operationName), result.get(RESULT).asList().contains(new ModelNode(operationName))); - - ModelNode rodOp = Util.createOperation(READ_OPERATION_DESCRIPTION_OPERATION, getSubsystemAddress()); - rodOp.get(NAME).set(operationName); - - ModelNode rodResult = services.executeOperation(rodOp); - Assert.assertEquals(rodResult.get(FAILURE_DESCRIPTION).asString(), SUCCESS, rodResult.get(OUTCOME).asString()); - Assert.assertTrue(rodResult.get(RESULT).hasDefined(DEPRECATED)); - } - } - - @Test - public void testLegacyMetricOperations() throws Exception { - KernelServices services = this.buildKernelServices(); - - ModelNode op = createLegacyRemoveMetricOperation("mem"); - ModelNode result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - op = createLegacyAddMetricOperation("mem"); - op.get("weight").set("5"); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - op = createLegacyAddMetricOperation("invalid-metric"); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), FAILED, result.get(OUTCOME).asString()); - } - - @Test - public void testLegacyConnectorOperations() throws Exception { - KernelServices services = this.buildKernelServices(); - - String testListenerName = "default"; - - ModelNode op = Operations.createWriteAttributeOperation(getLegacyModClusterConfigAddress(), ProxyConfigurationResourceDefinition.DeprecatedAttribute.CONNECTOR, new ModelNode(testListenerName)); - ModelNode result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - op = Operations.createReadAttributeOperation(getProxyAddress("default"), ProxyConfigurationResourceDefinition.Attribute.LISTENER); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - Assert.assertEquals(testListenerName, result.get(RESULT).asString()); - } - - @Test - public void testLegacyLoadProviderOperations() throws Exception { - KernelServices services = this.buildKernelServices(); - - String PROXY_NAME = "default"; - int testFactor = 66; - - // Test for WFLY-10872 - with dynamic load provider defined, check that a non-cryptic message is given to the user when - // they attempt to execute something like /subsystem=modcluster/mod-cluster-config=configuration/:write-attribute(name=simple-load-provider, value=0) - ModelNode op = Util.createOperation(WRITE_ATTRIBUTE_OPERATION, getProxyAddress(PROXY_NAME)); - op.get(NAME).set(ProxyConfigurationResourceDefinition.DeprecatedAttribute.SIMPLE_LOAD_PROVIDER.getName()); - op.get(VALUE).set(testFactor); - ModelNode result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), FAILED, result.get(OUTCOME).asString()); - Assert.assertTrue(result.get(FAILURE_DESCRIPTION).asString().contains("WFLYMODCLS0024")); - - op = Util.createRemoveOperation(getLegacyModClusterConfigDynamicLoadProviderAddress()); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - op = Util.createAddOperation(getSimpleLoadProviderAddress(PROXY_NAME)); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - // Write on legacy path - op = Util.createOperation(WRITE_ATTRIBUTE_OPERATION, getProxyAddress(PROXY_NAME)); - op.get(NAME).set(ProxyConfigurationResourceDefinition.DeprecatedAttribute.SIMPLE_LOAD_PROVIDER.getName()); - op.get(VALUE).set(testFactor); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - - // Check written value on current model path - op = Operations.createReadAttributeOperation(getSimpleLoadProviderAddress(PROXY_NAME), SimpleLoadProviderResourceDefinition.Attribute.FACTOR); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - Assert.assertEquals(testFactor, result.get(RESULT).asInt()); - - // Check written value on legacy path - op = Operations.createReadAttributeOperation(getProxyAddress(PROXY_NAME), ProxyConfigurationResourceDefinition.DeprecatedAttribute.SIMPLE_LOAD_PROVIDER); - result = services.executeOperation(op); - Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString()); - Assert.assertEquals(testFactor, result.get(RESULT).asInt()); - } - // Addresses private static PathAddress getSubsystemAddress() { return PathAddress.pathAddress(ModClusterSubsystemResourceDefinition.PATH); } - private static PathAddress getProxyAddress(String proxyName) { return getSubsystemAddress().append(ProxyConfigurationResourceDefinition.pathElement(proxyName)); } - private static PathAddress getSimpleLoadProviderAddress(String proxyName) { - return getProxyAddress(proxyName).append(SimpleLoadProviderResourceDefinition.PATH); - } - - private static PathAddress getLegacyModClusterConfigAddress() { - return getSubsystemAddress().append(ProxyConfigurationResourceDefinition.LEGACY_PATH); - } - - private static PathAddress getLegacyModClusterConfigDynamicLoadProviderAddress() { - return getLegacyModClusterConfigAddress().append(DynamicLoadProviderResourceDefinition.LEGACY_PATH); - } - - private static PathAddress getLegacyModClusterConfigLoadMetricAddress(String metric) { - return getLegacyModClusterConfigDynamicLoadProviderAddress().append(LoadMetricResourceDefinition.pathElement(metric)); - } - - - // Operations - - private static ModelNode createLegacyModClusterConfigWriteAttributeOperation(Attribute attribute, ModelNode value) { - return Operations.createWriteAttributeOperation(getLegacyModClusterConfigAddress(), attribute, value); - } - - private static ModelNode createLegacyModClusterConfigLoadMetricWriteAttributeOperation(String metric, Attribute attribute, ModelNode value) { - return Operations.createWriteAttributeOperation(getLegacyModClusterConfigLoadMetricAddress(metric), attribute, value); - } - - private static ModelNode createLegacyAddMetricOperation(String type) { - ModelNode operation = Util.createOperation("add-metric", getLegacyModClusterConfigAddress()); - operation.get("type").set(type); - return operation; - } - - private static ModelNode createLegacyRemoveMetricOperation(String type) { - ModelNode operation = Util.createOperation("remove-metric", getLegacyModClusterConfigAddress()); - operation.get("type").set(type); - return operation; - } - // Setup private String getSubsystemXml() throws IOException { diff --git a/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterTransformersTestCase.java b/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterTransformersTestCase.java index 696c3b770b8e..d14dcdbff9b0 100644 --- a/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterTransformersTestCase.java +++ b/mod_cluster/extension/src/test/java/org/wildfly/extension/mod_cluster/ModClusterTransformersTestCase.java @@ -28,11 +28,13 @@ import org.jboss.as.controller.ModelVersion; import org.jboss.as.model.test.FailedOperationTransformationConfig; +import org.jboss.as.model.test.ModelFixer; import org.jboss.as.model.test.ModelTestControllerVersion; import org.jboss.as.model.test.ModelTestUtils; import org.jboss.as.subsystem.test.AbstractSubsystemTest; import org.jboss.as.subsystem.test.KernelServices; import org.jboss.as.subsystem.test.KernelServicesBuilder; +import org.jboss.dmr.ModelNode; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -113,10 +115,21 @@ private void testTransformations(ModelTestControllerVersion controllerVersion) t Assert.assertTrue(mainServices.isSuccessfulBoot()); Assert.assertTrue(legacyServices.isSuccessfulBoot()); - checkSubsystemModelTransformation(mainServices, modelVersion, null, false); + checkSubsystemModelTransformation(mainServices, modelVersion, createModelFixer(modelVersion), false); } } + private static ModelFixer createModelFixer(ModelVersion version) { + return model -> { + if (ModClusterModel.VERSION_8_0_0.requiresTransformation(version)) { + Set.of("default", "with-floating-decay-load-provider").forEach( + proxy -> model.get(ProxyConfigurationResourceDefinition.pathElement(proxy).getKeyValuePair()).get("connector").set(new ModelNode()) + ); + } + return model; + }; + } + @Test public void testRejections() throws Exception { this.testRejections(version); diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-operations.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-operations.xml index 966921c3ebfd..9fdba20ed453 100644 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-operations.xml +++ b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-operations.xml @@ -20,10 +20,12 @@ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. --> - - + + - + diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-reject.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-reject.xml index 8ad4ce1009aa..590bce687701 100644 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-reject.xml +++ b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-reject.xml @@ -20,29 +20,30 @@ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. --> - - + @@ -59,7 +60,6 @@ type="receive-traffic"/> - @@ -78,13 +78,6 @@ - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-transform-7_0_0.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-transform-7_0_0.xml index a71d932ebe84..0110e8f63f57 100644 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-transform-7_0_0.xml +++ b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem-transform-7_0_0.xml @@ -20,17 +20,17 @@ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. --> - + - @@ -81,24 +80,6 @@ - - - - - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_0.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_0.xml deleted file mode 100644 index 48fd1716931d..000000000000 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_0.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_1.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_1.xml deleted file mode 100644 index bba97212feaa..000000000000 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_1.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_2.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_2.xml deleted file mode 100644 index 3251b7666a1c..000000000000 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_1_2.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_2_0.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_2_0.xml deleted file mode 100644 index 86369e17420b..000000000000 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_2_0.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_3_0.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_3_0.xml deleted file mode 100644 index a59986f9435a..000000000000 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_3_0.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_5_0.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_5_0.xml index 3e4b96a3365f..84eff88d8a00 100644 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_5_0.xml +++ b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_5_0.xml @@ -61,7 +61,6 @@ capacity="1024.1"/> - @@ -86,13 +85,6 @@ - diff --git a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_4_0.xml b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_6_0.xml similarity index 75% rename from mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_4_0.xml rename to mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_6_0.xml index acd17c8a1498..a05de7669252 100644 --- a/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_4_0.xml +++ b/mod_cluster/extension/src/test/resources/org/wildfly/extension/mod_cluster/subsystem_6_0.xml @@ -1,6 +1,6 @@ - + + worker-timeout="${modcluster.worker-timeout:2}"> + history="${modcluster.dynamic-load-provider.history:10}" + initial-load="${modcluster.dynamic-load-provider.initial-load:50}"> @@ -60,7 +61,6 @@ capacity="1024.1"/> - @@ -69,26 +69,27 @@ - + capacity="${modcluster.custom-load-metric.capacity:1.1}" + module="my.custom.package" + /> - + + + + + - - + diff --git a/testsuite/domain/src/test/resources/domain-configs/domain-jvm-properties.xml b/testsuite/domain/src/test/resources/domain-configs/domain-jvm-properties.xml index 59e48be61166..69605f6f2b21 100644 --- a/testsuite/domain/src/test/resources/domain-configs/domain-jvm-properties.xml +++ b/testsuite/domain/src/test/resources/domain-configs/domain-jvm-properties.xml @@ -334,8 +334,12 @@ true ${jboss.bind.address:127.0.0.1} - - + + + + + + diff --git a/testsuite/domain/src/test/resources/domain-configs/domain-standard-ee.xml b/testsuite/domain/src/test/resources/domain-configs/domain-standard-ee.xml index e9f48bb6793e..2e5f2a28058c 100644 --- a/testsuite/domain/src/test/resources/domain-configs/domain-standard-ee.xml +++ b/testsuite/domain/src/test/resources/domain-configs/domain-standard-ee.xml @@ -286,8 +286,12 @@ - - + + + + + + @@ -628,8 +632,12 @@ true ${jboss.bind.address:127.0.0.1} - - + + + + + + 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 e919689f3c42..f48f8254ead8 100644 --- a/testsuite/domain/src/test/resources/domain-configs/domain-standard.xml +++ b/testsuite/domain/src/test/resources/domain-configs/domain-standard.xml @@ -349,8 +349,12 @@ true ${jboss.bind.address:127.0.0.1} - - + + + + + + @@ -693,8 +697,8 @@ true ${jboss.bind.address:127.0.0.1} - - + + diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/mod_cluster/ModClusterSubsystemTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/mod_cluster/ModClusterSubsystemTestCase.java deleted file mode 100644 index 2dfcc084c07c..000000000000 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/mod_cluster/ModClusterSubsystemTestCase.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2013, Red Hat, Inc., and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.as.test.integration.mod_cluster; - - -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUCCESS; - -import org.jboss.arquillian.container.test.api.RunAsClient; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.as.arquillian.api.ContainerResource; -import org.jboss.as.arquillian.container.ManagementClient; -import org.jboss.as.cli.CommandContext; -import org.jboss.as.cli.batch.Batch; -import org.jboss.as.controller.client.ModelControllerClient; -import org.jboss.as.test.integration.management.util.CLITestUtil; -import org.jboss.as.test.shared.ServerReload; -import org.jboss.dmr.ModelNode; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -/** - * Tests that adding and subsequent removing of mod_cluster subsystem works. - * - * @author Radoslav Husar - */ -@RunWith(Arquillian.class) -@RunAsClient -public class ModClusterSubsystemTestCase { - - @ContainerResource - private ManagementClient managementClient; - - @Test - public void testModClusterAddAndRemoveSequence() throws Exception { - final CommandContext ctx = CLITestUtil.getCommandContext(); - final ModelControllerClient controllerClient = managementClient.getControllerClient(); - - try { - ctx.connectController(); - - // Add the mod_cluster extension first (not in this profile by default) - // n.b. extensions cannot be added in a batch - ModelNode request = ctx.buildRequest("/extension=org.jboss.as.modcluster:add"); - ModelNode response = controllerClient.execute(request); - String outcome = response.get("outcome").asString(); - Assert.assertEquals("Adding mod_cluster extension failed! " + response.toJSONString(false), SUCCESS, outcome); - - // Now lets execute subsystem add operation but we need to specify a connector - ctx.getBatchManager().activateNewBatch(); - Batch b = ctx.getBatchManager().getActiveBatch(); - b.add(ctx.toBatchedCommand("/socket-binding-group=standard-sockets/socket-binding=modcluster:add(multicast-port=23364, multicast-address=224.0.1.105)")); - b.add(ctx.toBatchedCommand("/subsystem=modcluster:add")); - b.add(ctx.toBatchedCommand("/subsystem=modcluster/mod-cluster-config=configuration:add(connector=default, advertise-socket=modcluster)")); - request = b.toRequest(); - b.clear(); - ctx.getBatchManager().discardActiveBatch(); - - response = controllerClient.execute(request); - outcome = response.get("outcome").asString(); - Assert.assertEquals("Adding mod_cluster subsystem failed! " + response.toJSONString(false), SUCCESS, outcome); - - // We need to reload the server here since the add operation leaves the server in 'reload-required' state - ServerReload.executeReloadAndWaitForCompletion(managementClient); - - // Test subsystem remove - request = ctx.buildRequest("/subsystem=modcluster:remove"); - response = controllerClient.execute(request); - outcome = response.get("outcome").asString(); - Assert.assertEquals("Removing mod_cluster subsystem failed! " + response.toJSONString(false), SUCCESS, outcome); - - // Cleanup and remove the extension - request = ctx.buildRequest("/extension=org.jboss.as.modcluster:remove"); - response = controllerClient.execute(request); - outcome = response.get("outcome").asString(); - Assert.assertEquals("Removing mod_cluster extension failed! " + response.toJSONString(false), SUCCESS, outcome); - - // Cleanup socket binding - request = ctx.buildRequest("/socket-binding-group=standard-sockets/socket-binding=modcluster:remove"); - response = controllerClient.execute(request); - outcome = response.get("outcome").asString(); - Assert.assertEquals("Removing socket binding failed! " + response.toJSONString(false), SUCCESS, outcome); - - // Remove leaves the server in 'reload-required' state, we need to reload the server in order not to leave running services - // around for subsequent tests - ServerReload.executeReloadAndWaitForCompletion(managementClient); - } finally { - ctx.terminateSession(); - } - } -} - diff --git a/testsuite/integration/clustering/src/test/java/org/jboss/as/test/clustering/cluster/modcluster/ModClusterProxyListOptionTestCase.java b/testsuite/integration/clustering/src/test/java/org/jboss/as/test/clustering/cluster/modcluster/ModClusterProxyListOptionTestCase.java deleted file mode 100644 index 4a1f3b4f669b..000000000000 --- a/testsuite/integration/clustering/src/test/java/org/jboss/as/test/clustering/cluster/modcluster/ModClusterProxyListOptionTestCase.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2020, Red Hat, Inc., and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.as.test.clustering.cluster.modcluster; - -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.utils.HttpClientUtils; -import org.apache.http.impl.client.CloseableHttpClient; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.container.test.api.OperateOnDeployment; -import org.jboss.arquillian.container.test.api.TargetsContainer; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.as.arquillian.api.ServerSetup; -import org.jboss.as.test.clustering.cluster.AbstractClusteringTestCase; -import org.jboss.as.test.http.util.TestHttpClientUtils; -import org.jboss.as.test.shared.CLIServerSetupTask; -import org.jboss.shrinkwrap.api.Archive; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.StringAsset; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; - -import javax.servlet.http.HttpServletResponse; -import java.net.URI; -import java.net.URL; - -@RunWith(Arquillian.class) -@ServerSetup(ModClusterProxyListOptionTestCase.ServerSetupTask.class) -public class ModClusterProxyListOptionTestCase extends AbstractClusteringTestCase { - private static final String MODULE_NAME = ModClusterProxyListOptionTestCase.class.getSimpleName(); - private static final String DEPLOYMENT_NAME = MODULE_NAME + ".war"; - - public ModClusterProxyListOptionTestCase() { - super(new String[] { NODE_1, LOAD_BALANCER_1 }, new String[]{DEPLOYMENT_1}); - } - - @Deployment(name = DEPLOYMENT_1, managed = false, testable = false) - @TargetsContainer(NODE_1) - public static Archive deployment1() { - return deployment(); - } - - private static Archive deployment() { - WebArchive war = ShrinkWrap.create(WebArchive.class, DEPLOYMENT_NAME) - .add(new StringAsset("

Hello World

"), "index.html"); - return war; - } - - @Test - public void testProxyList(@ArquillianResource @OperateOnDeployment(DEPLOYMENT_1) URL baseURL) throws Exception { - URL lbURL = new URL(baseURL.getProtocol(), baseURL.getHost(), baseURL.getPort() + 500, baseURL.getFile()); - URI lbURI = lbURL.toURI().resolve("index.html"); - - try (CloseableHttpClient client = TestHttpClientUtils.promiscuousCookieHttpClient()) { - // use timeout to allow for the modcluster registration - long startTime = System.currentTimeMillis(); - HttpResponse response = null; - while (System.currentTimeMillis() < startTime + 5000) { - response = client.execute(new HttpGet(lbURI)); - try { - if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) { - break; - } - } finally { - HttpClientUtils.closeQuietly(response); - } - } - Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode()); - } - } - - static class ServerSetupTask extends CLIServerSetupTask { - public ServerSetupTask() { - - /* - Set up balancer using deprecated proxy-list option in modcluster subsystem - */ - this.builder - .node(NODE_1) - .setup("/subsystem=modcluster/proxy=default:write-attribute(name=proxy-list,value=\"localhost:8590\")") - .setup("/subsystem=modcluster/proxy=default:write-attribute(name=status-interval,value=1)") - .setup("/subsystem=distributable-web/infinispan-session-management=default/affinity=ranked:add") - .teardown("/subsystem=distributable-web/infinispan-session-management=default/affinity=primary-owner:add") - .teardown("/subsystem=modcluster/proxy=default:undefine-attribute(name=status-interval)") - .teardown("/subsystem=modcluster/proxy=default:undefine-attribute(name=proxy-list)") - ; - } - } -} diff --git a/testsuite/integration/vdx/src/test/resources/configurations/domain/domain-to-damage.xml b/testsuite/integration/vdx/src/test/resources/configurations/domain/domain-to-damage.xml index 5d0f41fca2bb..06d42e8b2163 100644 --- a/testsuite/integration/vdx/src/test/resources/configurations/domain/domain-to-damage.xml +++ b/testsuite/integration/vdx/src/test/resources/configurations/domain/domain-to-damage.xml @@ -591,12 +591,12 @@
- - + + - +
@@ -1312,12 +1312,12 @@ - - + + - +
diff --git a/testsuite/integration/vdx/src/test/resources/configurations/domain/duplicate-attribute.xml b/testsuite/integration/vdx/src/test/resources/configurations/domain/duplicate-attribute.xml index 3758d5a66bdc..40f3cbb59360 100644 --- a/testsuite/integration/vdx/src/test/resources/configurations/domain/duplicate-attribute.xml +++ b/testsuite/integration/vdx/src/test/resources/configurations/domain/duplicate-attribute.xml @@ -592,12 +592,12 @@ - - + + - +
@@ -1313,12 +1313,12 @@ - - + + - + diff --git a/testsuite/integration/vdx/src/test/resources/configurations/standalone/standalone-full-ha-to-damage.xml b/testsuite/integration/vdx/src/test/resources/configurations/standalone/standalone-full-ha-to-damage.xml index b218ed19f325..5c4d35a317f3 100644 --- a/testsuite/integration/vdx/src/test/resources/configurations/standalone/standalone-full-ha-to-damage.xml +++ b/testsuite/integration/vdx/src/test/resources/configurations/standalone/standalone-full-ha-to-damage.xml @@ -397,12 +397,12 @@ - - + + - +