This commit is contained in:
David Turanski
2011-04-29 11:47:23 -04:00
parent e36af28bd2
commit 6c4af186dc
3 changed files with 39 additions and 11 deletions

View File

@@ -32,6 +32,7 @@ import org.w3c.dom.Element;
*
* @author Oleg Zhurakousky
* @author Mark Fisher
* @author David Turanski
* @since 2.0
*/
public class GlobalChannelInterceptorParser extends AbstractBeanDefinitionParser {
@@ -51,17 +52,13 @@ public class GlobalChannelInterceptorParser extends AbstractBeanDefinitionParser
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
this.createAndRegisterGlobalPostProcessorIfNecessary(parserContext);
BeanDefinitionBuilder globalChannelInterceptorBuilder =
BeanDefinitionBuilder.genericBeanDefinition(BASE_PACKAGE + "GlobalChannelInterceptorWrapper");
BeanComponentDefinition interceptorBeanDefinition = IntegrationNamespaceUtils.parseInnerHandlerDefinition(element, parserContext);
if (interceptorBeanDefinition != null) {
globalChannelInterceptorBuilder.addConstructorArgValue(interceptorBeanDefinition);
}
else {
String beanName = element.getAttribute(REF_ATTRIBUTE);
globalChannelInterceptorBuilder.addConstructorArgValue(new RuntimeBeanReference(beanName));
}
BeanDefinitionBuilder.genericBeanDefinition(BASE_PACKAGE + "GlobalChannelInterceptorWrapper");
globalChannelInterceptorBuilder.addConstructorArgValue(getBeanDefinitionBuilderConstructorValue(element, parserContext));
IntegrationNamespaceUtils.setValueIfAttributeDefined(globalChannelInterceptorBuilder, element, "order");
IntegrationNamespaceUtils.setValueIfAttributeDefined(globalChannelInterceptorBuilder, element, CHANNEL_NAME_PATTERN_ATTRIBUTE, "patterns");
@@ -84,5 +81,15 @@ public class GlobalChannelInterceptorParser extends AbstractBeanDefinitionParser
this.postProcessorCreated = true;
}
}
protected Object getBeanDefinitionBuilderConstructorValue(Element element, ParserContext parserContext){
BeanComponentDefinition interceptorBeanDefinition = IntegrationNamespaceUtils.parseInnerHandlerDefinition(element, parserContext);
if (interceptorBeanDefinition != null) {
return interceptorBeanDefinition;
}
else {
String beanName = element.getAttribute(REF_ATTRIBUTE);
return new RuntimeBeanReference(beanName);
}
}
}

View File

@@ -22,6 +22,7 @@ package org.springframework.integration.config.xml;
* @author Mark Fisher
* @author Marius Bogoevici
* @author Oleg Zhurakousky
* @author David Turanski
*/
public class IntegrationNamespaceHandler extends AbstractIntegrationNamespaceHandler {
@@ -67,6 +68,7 @@ public class IntegrationNamespaceHandler extends AbstractIntegrationNamespaceHan
registerBeanDefinitionParser("converter", new ConverterParser());
registerBeanDefinitionParser("message-history", new MessageHistoryParser());
registerBeanDefinitionParser("control-bus", new ControlBusParser());
registerBeanDefinitionParser("wire-tap", new GlobalWireTapParser());
}
}

View File

@@ -2577,7 +2577,7 @@ Name of the header whose value will be used to route messages
<xsd:annotation>
<xsd:documentation>
Alows you to configure a Wire Tap interceptor that will send a copy of the message to a
channel identified by 'ref' attribute.
channel identified by 'channel' attribute.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
@@ -2786,6 +2786,25 @@ Name of the header whose value will be used to route messages
</xsd:complexType>
</xsd:element>
<xsd:element name="wire-tap">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="wireTapType">
<xsd:attribute name="pattern" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation>
[REQUIRED] Channel name(s) or patterns. To specify more than one channel use
',' 
(e.g.,
channel-name-pattern="input*, foo, bar")
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="channel-interceptor">
<xsd:annotation>
<xsd:documentation>