Class IntegrationNamespaceUtils
java.lang.Object
org.springframework.integration.config.xml.IntegrationNamespaceUtils
Shared utility methods for integration namespace parsers.
- Author:
- Mark Fisher, Marius Bogoevici, Alex Peters, Oleg Zhurakousky, Gary Russell, Artem Bilan, Gunnar Hillert
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidcheckAndConfigureFixedSubscriberChannel(Element element, ParserContext parserContext, String channelName, String handlerBeanName) static ManagedListconfigureAdviceChain(Element adviceChainElement, Element txElement, boolean handleMessageAdvice, BeanDefinition parentBeanDefinition, ParserContext parserContext) static ManagedListconfigureAdviceChain(Element adviceChainElement, Element txElement, BeanDefinition parentBeanDefinition, ParserContext parserContext) static voidconfigureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, boolean handleMessageAdvice, BeanDefinition parentBeanDefinition, ParserContext parserContext) static voidconfigureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, boolean handleMessageAdvice, BeanDefinition parentBeanDefinition, ParserContext parserContext, String propertyName) static voidconfigureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, BeanDefinition parentBeanDefinition, ParserContext parserContext) static voidconfigureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, BeanDefinition parentBeanDefinition, ParserContext parserContext, String propertyName) static voidconfigureHeaderMapper(Element element, BeanDefinitionBuilder rootBuilder, ParserContext parserContext, Class<?> headerMapperClass, String replyHeaderValue) Utility method to configure a HeaderMapper for Inbound and Outbound channel adapters/gateway.static voidconfigureHeaderMapper(Element element, BeanDefinitionBuilder rootBuilder, ParserContext parserContext, BeanDefinitionBuilder headerMapperBuilder, String replyHeaderValueArg) Utility method to configure a HeaderMapper for Inbound and Outbound channel adapters/gateway.static voidconfigurePollerMetadata(Element pollerElement, BeanDefinitionBuilder targetBuilder, ParserContext parserContext) Parse a "poller" element to provide a reference for the target BeanDefinitionBuilder.static BeanDefinitionconfigureTransactionAttributes(Element txElement) Parse a "transactional" element and configure aTransactionInterceptorwith "transactionManager" and other "transactionDefinition" properties.static BeanDefinitionconfigureTransactionAttributes(Element txElement, boolean handleMessageAdvice) Parse a "transactional" element and configure aTransactionInterceptororTransactionHandleMessageAdvicewith "transactionManager" and other "transactionDefinition" properties.static BeanDefinitionconfigureTransactionDefinition(Element txElement) Parse attributes of "transactional" element and configure aDefaultTransactionAttributewith provided "transactionDefinition" properties.static StringcreateDirectChannel(Element element, ParserContext parserContext) static StringcreateElementDescription(Element element) Provides a user friendly description of an element based on its node name and, if available, its "id" attribute value.static BeanDefinitioncreateExpressionDefIfAttributeDefined(String expressionElementName, Element element) static BeanDefinitioncreateExpressionDefinitionFromValueOrExpression(String valueElementName, String expressionElementName, ParserContext parserContext, Element element, boolean oneRequired) static String[]generateAlias(Element element) static StringgetTextFromAttributeOrNestedElement(Element element, String name, ParserContext parserContext) Get a text value from a named attribute if it exists, otherwise check for a nested element of the same name.static voidinjectConstructorWithAdapter(String beanRefAttribute, String methodRefAttribute, String expressionAttribute, String adapterClass, Element element, BeanDefinitionBuilder builder, BeanMetadataElement processor, ParserContext parserContext) static voidinjectPropertyWithAdapter(String beanRefAttribute, String methodRefAttribute, String expressionAttribute, String beanProperty, String adapterClass, Element element, BeanDefinitionBuilder builder, BeanMetadataElement processor, ParserContext parserContext) static BeanComponentDefinitionparseInnerHandlerDefinition(Element element, ParserContext parserContext) static voidsetReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName) Configures the provided bean definition builder with a property reference to a bean.static voidsetReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, boolean emptyStringAllowed) static voidsetReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName) Configures the provided bean definition builder with a property reference to a bean.static voidsetReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName, boolean emptyStringAllowed) static voidsetValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.static voidsetValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, boolean emptyStringAllowed) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.static voidsetValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.static voidsetValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName, boolean emptyStringAllowed) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.
- 
Field Details- 
REF_ATTRIBUTE- See Also:
 
- 
VALUE_ATTRIBUTE- See Also:
 
- 
METHOD_ATTRIBUTE- See Also:
 
- 
ORDER- See Also:
 
- 
EXPRESSION_ATTRIBUTE- See Also:
 
- 
REQUEST_HANDLER_ADVICE_CHAIN- See Also:
 
- 
AUTO_STARTUP- See Also:
 
- 
PHASE- See Also:
 
- 
ROLE- See Also:
 
 
- 
- 
Constructor Details- 
IntegrationNamespaceUtilspublic IntegrationNamespaceUtils()
 
- 
- 
Method Details- 
setValueIfAttributeDefinedpublic static void setValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.- Parameters:
- builder- the bean definition builder to be configured
- element- the XML element where the attribute should be defined
- attributeName- the name of the attribute whose value will be used to populate the property
- propertyName- the name of the property to be populated
 
- 
setValueIfAttributeDefinedpublic static void setValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.The property name will be the camel-case equivalent of the lower case hyphen separated attribute (e.g. the "foo-bar" attribute would match the "fooBar" property). - Parameters:
- builder- the bean definition builder to be configured
- element- - the XML element where the attribute should be defined
- attributeName- - the name of the attribute whose value will be set on the property
- See Also:
 
- 
setValueIfAttributeDefinedpublic static void setValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName, boolean emptyStringAllowed) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.- Parameters:
- builder- the bean definition builder to be configured
- element- the XML element where the attribute should be defined
- attributeName- the name of the attribute whose value will be used to populate the property
- propertyName- the name of the property to be populated
- emptyStringAllowed- - if true, the value is set, even if an empty String (""); if false, an empty String is treated as if the attribute wasn't provided.
 
- 
setValueIfAttributeDefinedpublic static void setValueIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, boolean emptyStringAllowed) Configures the provided bean definition builder with a property value corresponding to the attribute whose name is provided if that attribute is defined in the given element.The property name will be the camel-case equivalent of the lower case hyphen separated attribute (e.g. the "foo-bar" attribute would match the "fooBar" property). - Parameters:
- builder- the bean definition builder to be configured
- element- - the XML element where the attribute should be defined
- attributeName- - the name of the attribute whose value will be set on the property
- emptyStringAllowed- - if true, the value is set, even if an empty String (""); if false, an empty String is treated as if the attribute wasn't provided.
- See Also:
 
- 
setReferenceIfAttributeDefinedpublic static void setReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName) Configures the provided bean definition builder with a property reference to a bean. The bean reference is identified by the value from the attribute whose name is provided if that attribute is defined in the given element.- Parameters:
- builder- the bean definition builder to be configured
- element- the XML element where the attribute should be defined
- attributeName- the name of the attribute whose value will be used as a bean reference to populate the property
- propertyName- the name of the property to be populated
 
- 
setReferenceIfAttributeDefinedpublic static void setReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, String propertyName, boolean emptyStringAllowed) 
- 
setReferenceIfAttributeDefinedpublic static void setReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName) Configures the provided bean definition builder with a property reference to a bean. The bean reference is identified by the value from the attribute whose name is provided if that attribute is defined in the given element.The property name will be the camel-case equivalent of the lower case hyphen separated attribute (e.g. the "foo-bar" attribute would match the "fooBar" property). - Parameters:
- builder- the bean definition builder to be configured
- element- - the XML element where the attribute should be defined
- attributeName- - the name of the attribute whose value will be used as a bean reference to populate the property
- See Also:
 
- 
setReferenceIfAttributeDefinedpublic static void setReferenceIfAttributeDefined(BeanDefinitionBuilder builder, Element element, String attributeName, boolean emptyStringAllowed) 
- 
createElementDescriptionProvides a user friendly description of an element based on its node name and, if available, its "id" attribute value. This is useful for creating error messages from within bean definition parsers.- Parameters:
- element- The element.
- Returns:
- The description.
 
- 
configurePollerMetadatapublic static void configurePollerMetadata(Element pollerElement, BeanDefinitionBuilder targetBuilder, ParserContext parserContext) Parse a "poller" element to provide a reference for the target BeanDefinitionBuilder. If the poller element does not contain a "ref" attribute, this will create and register a PollerMetadata instance and then add it as a property reference of the target builder.- Parameters:
- pollerElement- the "poller" element to parse
- targetBuilder- the builder that expects the "trigger" property
- parserContext- the parserContext for the target builder
 
- 
getTextFromAttributeOrNestedElementpublic static String getTextFromAttributeOrNestedElement(Element element, String name, ParserContext parserContext) Get a text value from a named attribute if it exists, otherwise check for a nested element of the same name. If both are specified it is an error, but if neither is specified, just returns null.- Parameters:
- element- a DOM node
- name- the name of the property (attribute or child element)
- parserContext- the current context
- Returns:
- the text from the attribute or element or null
 
- 
parseInnerHandlerDefinitionpublic static BeanComponentDefinition parseInnerHandlerDefinition(Element element, ParserContext parserContext) 
- 
configureHeaderMapperpublic static void configureHeaderMapper(Element element, BeanDefinitionBuilder rootBuilder, ParserContext parserContext, Class<?> headerMapperClass, String replyHeaderValue) Utility method to configure a HeaderMapper for Inbound and Outbound channel adapters/gateway.- Parameters:
- element- The element.
- rootBuilder- The root builder.
- parserContext- The parser context.
- headerMapperClass- The header mapper class.
- replyHeaderValue- The reply header value.
 
- 
configureHeaderMapperpublic static void configureHeaderMapper(Element element, BeanDefinitionBuilder rootBuilder, ParserContext parserContext, BeanDefinitionBuilder headerMapperBuilder, @Nullable String replyHeaderValueArg) Utility method to configure a HeaderMapper for Inbound and Outbound channel adapters/gateway.- Parameters:
- element- The element.
- rootBuilder- The root builder.
- parserContext- The parser context.
- headerMapperBuilder- The header mapper builder.
- replyHeaderValueArg- The reply header value.
 
- 
configureTransactionAttributesParse a "transactional" element and configure aTransactionInterceptorwith "transactionManager" and other "transactionDefinition" properties. For example, this advisor will be applied on the Polling Task proxy.- Parameters:
- txElement- The transactional element.
- Returns:
- The bean definition.
- See Also:
 
- 
configureTransactionAttributespublic static BeanDefinition configureTransactionAttributes(Element txElement, boolean handleMessageAdvice) Parse a "transactional" element and configure aTransactionInterceptororTransactionHandleMessageAdvicewith "transactionManager" and other "transactionDefinition" properties. For example, this advisor will be applied on the Polling Task proxy.- Parameters:
- txElement- The transactional element.
- handleMessageAdvice- flag if to use- TransactionHandleMessageAdviceor regular- TransactionInterceptor
- Returns:
- The bean definition.
- See Also:
 
- 
configureTransactionDefinitionParse attributes of "transactional" element and configure aDefaultTransactionAttributewith provided "transactionDefinition" properties.- Parameters:
- txElement- The transactional element.
- Returns:
- The bean definition.
 
- 
generateAlias
- 
configureAndSetAdviceChainIfPresentpublic static void configureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, BeanDefinition parentBeanDefinition, ParserContext parserContext) 
- 
configureAndSetAdviceChainIfPresentpublic static void configureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, boolean handleMessageAdvice, BeanDefinition parentBeanDefinition, ParserContext parserContext) 
- 
configureAndSetAdviceChainIfPresentpublic static void configureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, BeanDefinition parentBeanDefinition, ParserContext parserContext, String propertyName) 
- 
configureAndSetAdviceChainIfPresentpublic static void configureAndSetAdviceChainIfPresent(Element adviceChainElement, Element txElement, boolean handleMessageAdvice, BeanDefinition parentBeanDefinition, ParserContext parserContext, String propertyName) 
- 
configureAdviceChainpublic static ManagedList configureAdviceChain(Element adviceChainElement, Element txElement, BeanDefinition parentBeanDefinition, ParserContext parserContext) 
- 
configureAdviceChainpublic static ManagedList configureAdviceChain(Element adviceChainElement, Element txElement, boolean handleMessageAdvice, BeanDefinition parentBeanDefinition, ParserContext parserContext) 
- 
createExpressionDefinitionFromValueOrExpressionpublic static BeanDefinition createExpressionDefinitionFromValueOrExpression(String valueElementName, String expressionElementName, ParserContext parserContext, Element element, boolean oneRequired) 
- 
createExpressionDefIfAttributeDefinedpublic static BeanDefinition createExpressionDefIfAttributeDefined(String expressionElementName, Element element) 
- 
createDirectChannel
- 
checkAndConfigureFixedSubscriberChannelpublic static void checkAndConfigureFixedSubscriberChannel(Element element, ParserContext parserContext, String channelName, String handlerBeanName) 
- 
injectPropertyWithAdapterpublic static void injectPropertyWithAdapter(String beanRefAttribute, String methodRefAttribute, String expressionAttribute, String beanProperty, String adapterClass, Element element, BeanDefinitionBuilder builder, BeanMetadataElement processor, ParserContext parserContext) 
- 
injectConstructorWithAdapterpublic static void injectConstructorWithAdapter(String beanRefAttribute, String methodRefAttribute, String expressionAttribute, String adapterClass, Element element, BeanDefinitionBuilder builder, BeanMetadataElement processor, ParserContext parserContext) 
 
-