formatting and removing unused method arg
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,11 +38,9 @@ import org.w3c.dom.Element;
|
||||
* @author David Turanski
|
||||
* @since 2.0
|
||||
*/
|
||||
public class GlobalChannelInterceptorParser extends
|
||||
AbstractBeanDefinitionParser {
|
||||
public class GlobalChannelInterceptorParser extends AbstractBeanDefinitionParser {
|
||||
|
||||
private static final String BASE_PACKAGE = IntegrationNamespaceUtils.BASE_PACKAGE
|
||||
+ ".channel.interceptor.";
|
||||
private static final String BASE_PACKAGE = IntegrationNamespaceUtils.BASE_PACKAGE + ".channel.interceptor.";
|
||||
|
||||
private static final String CHANNEL_NAME_PATTERN_ATTRIBUTE = "pattern";
|
||||
|
||||
@@ -50,83 +48,66 @@ public class GlobalChannelInterceptorParser extends
|
||||
|
||||
private static final String GLOBAL_POST_PROCESSOR_CLASSNAME = "GlobalChannelInterceptorBeanPostProcessor";
|
||||
|
||||
|
||||
private final ManagedList<RuntimeBeanReference> globalInterceptors = new ManagedList<RuntimeBeanReference>();
|
||||
|
||||
private volatile boolean postProcessorCreated;
|
||||
|
||||
int ICOUNT = 0;
|
||||
|
||||
protected AbstractBeanDefinition parseInternal(Element element,
|
||||
ParserContext parserContext) {
|
||||
|
||||
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
|
||||
this.createAndRegisterGlobalPostProcessorIfNecessary(parserContext);
|
||||
BeanDefinitionBuilder globalChannelInterceptorBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(BASE_PACKAGE
|
||||
+ "GlobalChannelInterceptorWrapper");
|
||||
|
||||
Object childBeanDefinition = getBeanDefinitionBuilderConstructorValue(
|
||||
element, parserContext, globalChannelInterceptorBuilder);
|
||||
globalChannelInterceptorBuilder
|
||||
.addConstructorArgValue(childBeanDefinition);
|
||||
|
||||
BeanDefinitionBuilder globalChannelInterceptorBuilder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
BASE_PACKAGE + "GlobalChannelInterceptorWrapper");
|
||||
Object childBeanDefinition = getBeanDefinitionBuilderConstructorValue(element, parserContext);
|
||||
globalChannelInterceptorBuilder.addConstructorArgValue(childBeanDefinition);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(globalChannelInterceptorBuilder, element, "order");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(
|
||||
globalChannelInterceptorBuilder, element, "order");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(
|
||||
globalChannelInterceptorBuilder, element,
|
||||
CHANNEL_NAME_PATTERN_ATTRIBUTE, "patterns");
|
||||
|
||||
globalChannelInterceptorBuilder, element, CHANNEL_NAME_PATTERN_ATTRIBUTE, "patterns");
|
||||
String beanName = BeanDefinitionReaderUtils.generateBeanName(
|
||||
globalChannelInterceptorBuilder.getBeanDefinition(),
|
||||
parserContext.getRegistry());
|
||||
parserContext.registerBeanComponent(new BeanComponentDefinition(
|
||||
globalChannelInterceptorBuilder.getBeanDefinition(), beanName));
|
||||
globalChannelInterceptorBuilder.getBeanDefinition(), parserContext.getRegistry());
|
||||
parserContext.registerBeanComponent(new BeanComponentDefinition(globalChannelInterceptorBuilder.getBeanDefinition(), beanName));
|
||||
this.globalInterceptors.add(new RuntimeBeanReference(beanName));
|
||||
return null;
|
||||
}
|
||||
|
||||
private void createAndRegisterGlobalPostProcessorIfNecessary(
|
||||
ParserContext parserContext) {
|
||||
private void createAndRegisterGlobalPostProcessorIfNecessary(ParserContext parserContext) {
|
||||
if (!this.postProcessorCreated) {
|
||||
BeanDefinitionBuilder postProcessorBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(BASE_PACKAGE
|
||||
+ GLOBAL_POST_PROCESSOR_CLASSNAME);
|
||||
postProcessorBuilder
|
||||
.addConstructorArgValue(this.globalInterceptors);
|
||||
BeanDefinitionBuilder postProcessorBuilder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
BASE_PACKAGE + GLOBAL_POST_PROCESSOR_CLASSNAME);
|
||||
postProcessorBuilder.addConstructorArgValue(this.globalInterceptors);
|
||||
BeanDefinition beanDef = postProcessorBuilder.getBeanDefinition();
|
||||
String beanName = BeanDefinitionReaderUtils.generateBeanName(
|
||||
beanDef, parserContext.getRegistry());
|
||||
parserContext.registerBeanComponent(new BeanComponentDefinition(
|
||||
beanDef, beanName));
|
||||
String beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
|
||||
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, beanName));
|
||||
this.postProcessorCreated = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Object getBeanDefinitionBuilderConstructorValue(Element element,
|
||||
ParserContext parserContext, BeanDefinitionBuilder parentBuilder) {
|
||||
BeanComponentDefinition interceptorBeanDefinition = IntegrationNamespaceUtils
|
||||
.parseInnerHandlerDefinition(element, parserContext);
|
||||
protected Object getBeanDefinitionBuilderConstructorValue(Element element, ParserContext parserContext) {
|
||||
BeanComponentDefinition interceptorBeanDefinition = IntegrationNamespaceUtils.parseInnerHandlerDefinition(element, parserContext);
|
||||
if (interceptorBeanDefinition != null) {
|
||||
return interceptorBeanDefinition;
|
||||
} else {
|
||||
String beanName = null;
|
||||
if (element.hasAttribute(REF_ATTRIBUTE)) {
|
||||
beanName = element.getAttribute(REF_ATTRIBUTE);
|
||||
|
||||
} else {
|
||||
List<Element> els = DomUtils.getChildElements(element);
|
||||
if (els.isEmpty()) {
|
||||
parserContext.getReaderContext().error("child BeanDefinition must not be null", element);
|
||||
} else {
|
||||
Element child = els.get(0);
|
||||
if ("wire-tap".equals(child.getLocalName())){
|
||||
beanName = new WireTapParser().parse(child, parserContext);
|
||||
}else {
|
||||
BeanDefinition beanDef = parserContext.getDelegate().parseCustomElement(child);
|
||||
beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
|
||||
}
|
||||
}
|
||||
}
|
||||
return new RuntimeBeanReference(beanName);
|
||||
}
|
||||
String beanName = null;
|
||||
if (element.hasAttribute(REF_ATTRIBUTE)) {
|
||||
beanName = element.getAttribute(REF_ATTRIBUTE);
|
||||
}
|
||||
else {
|
||||
List<Element> els = DomUtils.getChildElements(element);
|
||||
if (els.isEmpty()) {
|
||||
parserContext.getReaderContext().error("child BeanDefinition must not be null", element);
|
||||
}
|
||||
else {
|
||||
Element child = els.get(0);
|
||||
if ("wire-tap".equals(child.getLocalName())) {
|
||||
beanName = new WireTapParser().parse(child, parserContext);
|
||||
}
|
||||
else {
|
||||
BeanDefinition beanDef = parserContext.getDelegate().parseCustomElement(child);
|
||||
beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
|
||||
}
|
||||
}
|
||||
}
|
||||
return new RuntimeBeanReference(beanName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.config.xml;
|
||||
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
|
||||
/**
|
||||
* Parser for the top level 'wire-tap' element
|
||||
* @author David Turanski
|
||||
@@ -24,9 +25,11 @@ import org.w3c.dom.Element;
|
||||
*
|
||||
*/
|
||||
public class GlobalWireTapParser extends GlobalChannelInterceptorParser {
|
||||
|
||||
@Override
|
||||
protected Object getBeanDefinitionBuilderConstructorValue(Element element, ParserContext parserContext, BeanDefinitionBuilder parentBuilder){
|
||||
protected Object getBeanDefinitionBuilderConstructorValue(Element element, ParserContext parserContext) {
|
||||
String wireTapBeanName = new WireTapParser().parse(element, parserContext);
|
||||
return new RuntimeBeanReference(wireTapBeanName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user