From 81ac7e56be6dd47ec414aab0457d67caea1af41d Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 3 Sep 2013 18:49:54 -0400 Subject: [PATCH] INT-3124 JMX Check Mutually Exclusive Attributes Only one of query-name and query-name-ref Only one of query-expression and query-expression-ref --- .../config/MBeanTreePollingChannelAdapterParser.java | 8 ++++++++ .../jmx/config/spring-integration-jmx-3.0.xsd | 12 ++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParser.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParser.java index 305da25ed2..e75783458e 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParser.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/config/MBeanTreePollingChannelAdapterParser.java @@ -53,6 +53,14 @@ public class MBeanTreePollingChannelAdapterParser extends AbstractPollingInbound IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "query-name", "queryName"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "query-expression", "queryExpression"); + if (StringUtils.hasText(element.getAttribute("query-name")) + && StringUtils.hasText(element.getAttribute("query-name-ref"))) { + parserContext.getReaderContext().error("Cannot have both `query-name' and 'query-name-ref'", element); + } + if (StringUtils.hasText(element.getAttribute("query-expression")) + && StringUtils.hasText(element.getAttribute("query-expression-ref"))) { + parserContext.getReaderContext().error("Cannot have both `query-expression' and 'query-expression-ref'", element); + } BeanComponentDefinition innerBeanDef = IntegrationNamespaceUtils.parseInnerHandlerDefinition(element, parserContext); String beanName = element.getAttribute("converter"); diff --git a/spring-integration-jmx/src/main/resources/org/springframework/integration/jmx/config/spring-integration-jmx-3.0.xsd b/spring-integration-jmx/src/main/resources/org/springframework/integration/jmx/config/spring-integration-jmx-3.0.xsd index 65b2ff0920..cbe7ed26a2 100644 --- a/spring-integration-jmx/src/main/resources/org/springframework/integration/jmx/config/spring-integration-jmx-3.0.xsd +++ b/spring-integration-jmx/src/main/resources/org/springframework/integration/jmx/config/spring-integration-jmx-3.0.xsd @@ -223,14 +223,16 @@ - A string to be parsed into an ObjectName object + A string to be parsed into an ObjectName object. If this + attribute is specified you cannot specify `query-name-ref`. - A reference to an ObjectName instance + A reference to an ObjectName instance. If this + attribute is specified you cannot specify `query-name`. @@ -242,14 +244,16 @@ - A string to be parsed into a QueryExp object + A string to be parsed into a QueryExp object. If this + attribute is specified you cannot specify `query-expression-ref`. - A reference to a QueryExp instance + A reference to a QueryExp instance. If this + attribute is specified you cannot specify `query-expression`.