Class IntegrationNamespaceUtils
java.lang.Object
org.springframework.integration.config.xml.IntegrationNamespaceUtils
public abstract class IntegrationNamespaceUtils
extends java.lang.Object
Shared utility methods for integration namespace parsers.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
AUTO_STARTUP
static java.lang.String
EXPRESSION_ATTRIBUTE
static java.lang.String
METHOD_ATTRIBUTE
static java.lang.String
ORDER
static java.lang.String
PHASE
static java.lang.String
REF_ATTRIBUTE
static java.lang.String
REQUEST_HANDLER_ADVICE_CHAIN
static java.lang.String
ROLE
-
Constructor Summary
Constructors Constructor Description IntegrationNamespaceUtils()
-
Method Summary
Modifier and Type Method Description static void
checkAndConfigureFixedSubscriberChannel(org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.String channelName, java.lang.String handlerBeanName)
static org.springframework.beans.factory.support.ManagedList
configureAdviceChain(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, boolean handleMessageAdvice, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext)
static org.springframework.beans.factory.support.ManagedList
configureAdviceChain(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext)
static void
configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, boolean handleMessageAdvice, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext)
static void
configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, boolean handleMessageAdvice, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.String propertyName)
static void
configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext)
static void
configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.String propertyName)
static void
configureHeaderMapper(org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder rootBuilder, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.Class<?> headerMapperClass, java.lang.String replyHeaderValue)
Utility method to configure a HeaderMapper for Inbound and Outbound channel adapters/gateway.static void
configureHeaderMapper(org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder rootBuilder, org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder headerMapperBuilder, java.lang.String replyHeaderValueArg)
Utility method to configure a HeaderMapper for Inbound and Outbound channel adapters/gateway.static void
configurePollerMetadata(org.w3c.dom.Element pollerElement, org.springframework.beans.factory.support.BeanDefinitionBuilder targetBuilder, org.springframework.beans.factory.xml.ParserContext parserContext)
Parse a "poller" element to provide a reference for the target BeanDefinitionBuilder.static org.springframework.beans.factory.config.BeanDefinition
configureTransactionAttributes(org.w3c.dom.Element txElement)
Parse a "transactional" element and configure aTransactionInterceptor
with "transactionManager" and other "transactionDefinition" properties.static org.springframework.beans.factory.config.BeanDefinition
configureTransactionAttributes(org.w3c.dom.Element txElement, boolean handleMessageAdvice)
Parse a "transactional" element and configure aTransactionInterceptor
orTransactionHandleMessageAdvice
with "transactionManager" and other "transactionDefinition" properties.static org.springframework.beans.factory.config.BeanDefinition
configureTransactionDefinition(org.w3c.dom.Element txElement)
Parse attributes of "transactional" element and configure aDefaultTransactionAttribute
with provided "transactionDefinition" properties.static java.lang.String
createDirectChannel(org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext)
static java.lang.String
createElementDescription(org.w3c.dom.Element element)
Provides a user friendly description of an element based on its node name and, if available, its "id" attribute value.static org.springframework.beans.factory.config.BeanDefinition
createExpressionDefIfAttributeDefined(java.lang.String expressionElementName, org.w3c.dom.Element element)
static org.springframework.beans.factory.config.BeanDefinition
createExpressionDefinitionFromValueOrExpression(java.lang.String valueElementName, java.lang.String expressionElementName, org.springframework.beans.factory.xml.ParserContext parserContext, org.w3c.dom.Element element, boolean oneRequired)
static java.lang.String[]
generateAlias(org.w3c.dom.Element element)
static java.lang.String
getTextFromAttributeOrNestedElement(org.w3c.dom.Element element, java.lang.String name, org.springframework.beans.factory.xml.ParserContext parserContext)
Get a text value from a named attribute if it exists, otherwise check for a nested element of the same name.static void
injectConstructorWithAdapter(java.lang.String beanRefAttribute, java.lang.String methodRefAttribute, java.lang.String expressionAttribute, java.lang.String adapterClass, org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.springframework.beans.BeanMetadataElement processor, org.springframework.beans.factory.xml.ParserContext parserContext)
static void
injectPropertyWithAdapter(java.lang.String beanRefAttribute, java.lang.String methodRefAttribute, java.lang.String expressionAttribute, java.lang.String beanProperty, java.lang.String adapterClass, org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.springframework.beans.BeanMetadataElement processor, org.springframework.beans.factory.xml.ParserContext parserContext)
static org.springframework.beans.factory.parsing.BeanComponentDefinition
parseInnerHandlerDefinition(org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext)
static void
setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName)
Configures the provided bean definition builder with a property reference to a bean.static void
setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, boolean emptyStringAllowed)
static void
setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.String propertyName)
Configures the provided bean definition builder with a property reference to a bean.static void
setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.String propertyName, boolean emptyStringAllowed)
static void
setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.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 void
setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.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 void
setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.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 void
setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.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
public static final java.lang.String REF_ATTRIBUTE- See Also:
- Constant Field Values
-
METHOD_ATTRIBUTE
public static final java.lang.String METHOD_ATTRIBUTE- See Also:
- Constant Field Values
-
ORDER
public static final java.lang.String ORDER- See Also:
- Constant Field Values
-
EXPRESSION_ATTRIBUTE
public static final java.lang.String EXPRESSION_ATTRIBUTE- See Also:
- Constant Field Values
-
REQUEST_HANDLER_ADVICE_CHAIN
public static final java.lang.String REQUEST_HANDLER_ADVICE_CHAIN- See Also:
- Constant Field Values
-
AUTO_STARTUP
public static final java.lang.String AUTO_STARTUP- See Also:
- Constant Field Values
-
PHASE
public static final java.lang.String PHASE- See Also:
- Constant Field Values
-
ROLE
public static final java.lang.String ROLE- See Also:
- Constant Field Values
-
-
Constructor Details
-
IntegrationNamespaceUtils
public IntegrationNamespaceUtils()
-
-
Method Details
-
setValueIfAttributeDefined
public static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.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 configuredelement
- the XML element where the attribute should be definedattributeName
- the name of the attribute whose value will be used to populate the propertypropertyName
- the name of the property to be populated
-
setValueIfAttributeDefined
public static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.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 configuredelement
- - the XML element where the attribute should be definedattributeName
- - the name of the attribute whose value will be set on the property- See Also:
Conventions.attributeNameToPropertyName(String)
-
setValueIfAttributeDefined
public static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.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 configuredelement
- the XML element where the attribute should be definedattributeName
- the name of the attribute whose value will be used to populate the propertypropertyName
- the name of the property to be populatedemptyStringAllowed
- - 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.
-
setValueIfAttributeDefined
public static void setValueIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.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 configuredelement
- - the XML element where the attribute should be definedattributeName
- - the name of the attribute whose value will be set on the propertyemptyStringAllowed
- - 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:
Conventions.attributeNameToPropertyName(String)
-
setReferenceIfAttributeDefined
public static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.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 configuredelement
- the XML element where the attribute should be definedattributeName
- the name of the attribute whose value will be used as a bean reference to populate the propertypropertyName
- the name of the property to be populated
-
setReferenceIfAttributeDefined
public static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, java.lang.String propertyName, boolean emptyStringAllowed) -
setReferenceIfAttributeDefined
public static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.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 configuredelement
- - the XML element where the attribute should be definedattributeName
- - the name of the attribute whose value will be used as a bean reference to populate the property- See Also:
Conventions.attributeNameToPropertyName(String)
-
setReferenceIfAttributeDefined
public static void setReferenceIfAttributeDefined(org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.w3c.dom.Element element, java.lang.String attributeName, boolean emptyStringAllowed) -
createElementDescription
public static java.lang.String createElementDescription(org.w3c.dom.Element element)Provides 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.
-
configurePollerMetadata
public static void configurePollerMetadata(org.w3c.dom.Element pollerElement, org.springframework.beans.factory.support.BeanDefinitionBuilder targetBuilder, org.springframework.beans.factory.xml.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 parsetargetBuilder
- the builder that expects the "trigger" propertyparserContext
- the parserContext for the target builder
-
getTextFromAttributeOrNestedElement
public static java.lang.String getTextFromAttributeOrNestedElement(org.w3c.dom.Element element, java.lang.String name, org.springframework.beans.factory.xml.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 nodename
- the name of the property (attribute or child element)parserContext
- the current context- Returns:
- the text from the attribute or element or null
-
parseInnerHandlerDefinition
public static org.springframework.beans.factory.parsing.BeanComponentDefinition parseInnerHandlerDefinition(org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext) -
configureHeaderMapper
public static void configureHeaderMapper(org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder rootBuilder, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.Class<?> headerMapperClass, java.lang.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.
-
configureHeaderMapper
public static void configureHeaderMapper(org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder rootBuilder, org.springframework.beans.factory.xml.ParserContext parserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder headerMapperBuilder, @Nullable java.lang.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.
-
configureTransactionAttributes
public static org.springframework.beans.factory.config.BeanDefinition configureTransactionAttributes(org.w3c.dom.Element txElement)Parse a "transactional" element and configure aTransactionInterceptor
with "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:
AbstractPollingEndpoint
-
configureTransactionAttributes
public static org.springframework.beans.factory.config.BeanDefinition configureTransactionAttributes(org.w3c.dom.Element txElement, boolean handleMessageAdvice)Parse a "transactional" element and configure aTransactionInterceptor
orTransactionHandleMessageAdvice
with "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 useTransactionHandleMessageAdvice
or regularTransactionInterceptor
- Returns:
- The bean definition.
- See Also:
AbstractPollingEndpoint
-
configureTransactionDefinition
public static org.springframework.beans.factory.config.BeanDefinition configureTransactionDefinition(org.w3c.dom.Element txElement)Parse attributes of "transactional" element and configure aDefaultTransactionAttribute
with provided "transactionDefinition" properties.- Parameters:
txElement
- The transactional element.- Returns:
- The bean definition.
-
generateAlias
public static java.lang.String[] generateAlias(org.w3c.dom.Element element) -
configureAndSetAdviceChainIfPresent
public static void configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext) -
configureAndSetAdviceChainIfPresent
public static void configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, boolean handleMessageAdvice, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext) -
configureAndSetAdviceChainIfPresent
public static void configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.String propertyName) -
configureAndSetAdviceChainIfPresent
public static void configureAndSetAdviceChainIfPresent(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, boolean handleMessageAdvice, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.String propertyName) -
configureAdviceChain
public static org.springframework.beans.factory.support.ManagedList configureAdviceChain(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext) -
configureAdviceChain
public static org.springframework.beans.factory.support.ManagedList configureAdviceChain(org.w3c.dom.Element adviceChainElement, org.w3c.dom.Element txElement, boolean handleMessageAdvice, org.springframework.beans.factory.config.BeanDefinition parentBeanDefinition, org.springframework.beans.factory.xml.ParserContext parserContext) -
createExpressionDefinitionFromValueOrExpression
public static org.springframework.beans.factory.config.BeanDefinition createExpressionDefinitionFromValueOrExpression(java.lang.String valueElementName, java.lang.String expressionElementName, org.springframework.beans.factory.xml.ParserContext parserContext, org.w3c.dom.Element element, boolean oneRequired) -
createExpressionDefIfAttributeDefined
public static org.springframework.beans.factory.config.BeanDefinition createExpressionDefIfAttributeDefined(java.lang.String expressionElementName, org.w3c.dom.Element element) -
createDirectChannel
public static java.lang.String createDirectChannel(org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext) -
checkAndConfigureFixedSubscriberChannel
public static void checkAndConfigureFixedSubscriberChannel(org.w3c.dom.Element element, org.springframework.beans.factory.xml.ParserContext parserContext, java.lang.String channelName, java.lang.String handlerBeanName) -
injectPropertyWithAdapter
public static void injectPropertyWithAdapter(java.lang.String beanRefAttribute, java.lang.String methodRefAttribute, java.lang.String expressionAttribute, java.lang.String beanProperty, java.lang.String adapterClass, org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.springframework.beans.BeanMetadataElement processor, org.springframework.beans.factory.xml.ParserContext parserContext) -
injectConstructorWithAdapter
public static void injectConstructorWithAdapter(java.lang.String beanRefAttribute, java.lang.String methodRefAttribute, java.lang.String expressionAttribute, java.lang.String adapterClass, org.w3c.dom.Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder builder, org.springframework.beans.BeanMetadataElement processor, org.springframework.beans.factory.xml.ParserContext parserContext)
-