INT-3384: Rework JMS/XML Module XSD Enumerations
JIRA: https://jira.spring.io/browse/INT-3384 Polishing
This commit is contained in:
@@ -22,6 +22,7 @@ import javax.jms.Destination;
|
||||
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.jms.util.JmsAdapterUtils;
|
||||
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
@@ -40,6 +41,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class JmsDestinationPollingSource extends IntegrationObjectSupport implements MessageSource<Object> {
|
||||
|
||||
|
||||
private final JmsTemplate jmsTemplate;
|
||||
|
||||
private volatile Destination destination;
|
||||
@@ -50,12 +52,12 @@ public class JmsDestinationPollingSource extends IntegrationObjectSupport implem
|
||||
|
||||
private volatile JmsHeaderMapper headerMapper = new DefaultJmsHeaderMapper();
|
||||
|
||||
private volatile String sessionAcknowledgeMode;
|
||||
|
||||
public JmsDestinationPollingSource(JmsTemplate jmsTemplate) {
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
}
|
||||
|
||||
|
||||
public void setDestination(Destination destination) {
|
||||
Assert.isNull(this.destinationName, "The 'destination' and 'destinationName' properties are mutually exclusive.");
|
||||
this.destination = destination;
|
||||
@@ -84,6 +86,10 @@ public class JmsDestinationPollingSource extends IntegrationObjectSupport implem
|
||||
this.headerMapper = headerMapper;
|
||||
}
|
||||
|
||||
public void setSessionAcknowledgeMode(String sessionAcknowledgeMode) {
|
||||
this.sessionAcknowledgeMode = sessionAcknowledgeMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will receive a JMS {@link javax.jms.Message} converting and returning it as
|
||||
* a Spring Integration {@link Message}. This method will also use the current
|
||||
@@ -127,4 +133,19 @@ public class JmsDestinationPollingSource extends IntegrationObjectSupport implem
|
||||
return jmsMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
if (this.sessionAcknowledgeMode != null) {
|
||||
Integer acknowledgeMode = JmsAdapterUtils.parseAcknowledgeMode(this.sessionAcknowledgeMode);
|
||||
if (acknowledgeMode != null) {
|
||||
if (JmsAdapterUtils.SESSION_TRANSACTED == acknowledgeMode) {
|
||||
this.jmsTemplate.setSessionTransacted(true);
|
||||
}
|
||||
else {
|
||||
this.jmsTemplate.setSessionAcknowledgeMode(acknowledgeMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.integration.jms;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.integration.context.OrderlyShutdownCapable;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.jms.util.JmsAdapterUtils;
|
||||
import org.springframework.jms.listener.AbstractMessageListenerContainer;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -35,8 +36,9 @@ public class JmsMessageDrivenEndpoint extends AbstractEndpoint implements Dispos
|
||||
private final AbstractMessageListenerContainer listenerContainer;
|
||||
|
||||
private final ChannelPublishingJmsMessageListener listener;
|
||||
|
||||
|
||||
|
||||
private volatile String sessionAcknowledgeMode;
|
||||
|
||||
public JmsMessageDrivenEndpoint(AbstractMessageListenerContainer listenerContainer,
|
||||
ChannelPublishingJmsMessageListener listener) {
|
||||
Assert.notNull(listenerContainer, "listener container must not be null");
|
||||
@@ -51,7 +53,10 @@ public class JmsMessageDrivenEndpoint extends AbstractEndpoint implements Dispos
|
||||
setPhase(Integer.MAX_VALUE / 2);
|
||||
}
|
||||
|
||||
|
||||
public void setSessionAcknowledgeMode(String sessionAcknowledgeMode) {
|
||||
this.sessionAcknowledgeMode = sessionAcknowledgeMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return "jms:message-driven-channel-adapter";
|
||||
@@ -63,6 +68,15 @@ public class JmsMessageDrivenEndpoint extends AbstractEndpoint implements Dispos
|
||||
if (!this.listenerContainer.isActive()) {
|
||||
this.listenerContainer.afterPropertiesSet();
|
||||
}
|
||||
Integer acknowledgeMode = JmsAdapterUtils.parseAcknowledgeMode(this.sessionAcknowledgeMode);
|
||||
if (acknowledgeMode != null) {
|
||||
if (acknowledgeMode.intValue() == JmsAdapterUtils.SESSION_TRANSACTED) {
|
||||
this.listenerContainer.setSessionTransacted(true);
|
||||
}
|
||||
else {
|
||||
this.listenerContainer.setSessionAcknowledgeMode(acknowledgeMode);
|
||||
}
|
||||
}
|
||||
listener.setComponentName(this.getComponentName());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
import org.springframework.integration.MessageTimeoutException;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
|
||||
import org.springframework.integration.jms.util.JmsAdapterUtils;
|
||||
import org.springframework.jms.connection.ConnectionFactoryUtils;
|
||||
import org.springframework.jms.listener.DefaultMessageListenerContainer;
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
@@ -593,9 +594,28 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
if (this.replyContainerProperties.getRecoveryInterval() != null) {
|
||||
container.setRecoveryInterval(this.replyContainerProperties.getRecoveryInterval());
|
||||
}
|
||||
if (this.replyContainerProperties.getSessionAcknowledgeMode() != null) {
|
||||
container.setSessionAcknowledgeMode(this.replyContainerProperties.getSessionAcknowledgeMode());
|
||||
if (StringUtils.hasText(this.replyContainerProperties.getSessionAcknowledgeModeName())) {
|
||||
Integer acknowledgeMode = JmsAdapterUtils.parseAcknowledgeMode(this.replyContainerProperties.getSessionAcknowledgeModeName());
|
||||
if (acknowledgeMode != null) {
|
||||
if (JmsAdapterUtils.SESSION_TRANSACTED == acknowledgeMode) {
|
||||
container.setSessionTransacted(true);
|
||||
}
|
||||
else {
|
||||
container.setSessionAcknowledgeMode(acknowledgeMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.replyContainerProperties.getSessionAcknowledgeMode() != null) {
|
||||
Integer sessionAcknowledgeMode = this.replyContainerProperties.getSessionAcknowledgeMode();
|
||||
if (Session.SESSION_TRANSACTED == sessionAcknowledgeMode) {
|
||||
container.setSessionTransacted(true);
|
||||
}
|
||||
else {
|
||||
container.setSessionAcknowledgeMode(sessionAcknowledgeMode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.replyContainerProperties.getTaskExecutor() != null) {
|
||||
container.setTaskExecutor(this.replyContainerProperties.getTaskExecutor());
|
||||
}
|
||||
@@ -610,6 +630,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
synchronized (this.lifeCycleMonitor) {
|
||||
@@ -1209,11 +1230,12 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
}
|
||||
|
||||
public static class ReplyContainerProperties {
|
||||
|
||||
private volatile Boolean sessionTransacted;
|
||||
|
||||
private volatile Integer sessionAcknowledgeMode;
|
||||
|
||||
private volatile String sessionAcknowledgeModeName;
|
||||
|
||||
private volatile Long receiveTimeout;
|
||||
|
||||
private volatile Long recoveryInterval;
|
||||
@@ -1232,6 +1254,14 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
|
||||
private volatile Executor taskExecutor;
|
||||
|
||||
public String getSessionAcknowledgeModeName() {
|
||||
return sessionAcknowledgeModeName;
|
||||
}
|
||||
|
||||
public void setSessionAcknowledgeModeName(String sessionAcknowledgeModeName) {
|
||||
this.sessionAcknowledgeModeName = sessionAcknowledgeModeName;
|
||||
}
|
||||
|
||||
public Boolean isSessionTransacted() {
|
||||
return sessionTransacted;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.integration.jms.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
@@ -68,21 +67,6 @@ abstract class JmsAdapterParserUtils {
|
||||
"receive-timeout", "session-transacted"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* The following constants match those of javax.jms.Session.
|
||||
* They are duplicated here to avoid a dependency in tooling.
|
||||
*/
|
||||
|
||||
static final int SESSION_TRANSACTED = 0;
|
||||
|
||||
private static final int AUTO_ACKNOWLEDGE = 1;
|
||||
|
||||
private static final int CLIENT_ACKNOWLEDGE = 2;
|
||||
|
||||
private static final int DUPS_OK_ACKNOWLEDGE = 3;
|
||||
|
||||
|
||||
static String determineConnectionFactoryBeanName(Element element, ParserContext parserContext) {
|
||||
String connectionFactoryBeanName = "connectionFactory";
|
||||
if (element.hasAttribute(CONNECTION_FACTORY_ATTRIBUTE)) {
|
||||
@@ -95,30 +79,6 @@ abstract class JmsAdapterParserUtils {
|
||||
return connectionFactoryBeanName;
|
||||
}
|
||||
|
||||
static Integer parseAcknowledgeMode(Element element, ParserContext parserContext) {
|
||||
String acknowledge = element.getAttribute("acknowledge");
|
||||
if (StringUtils.hasText(acknowledge)) {
|
||||
int acknowledgeMode = AUTO_ACKNOWLEDGE;
|
||||
if ("transacted".equals(acknowledge)) {
|
||||
acknowledgeMode = SESSION_TRANSACTED;
|
||||
}
|
||||
else if ("dups-ok".equals(acknowledge)) {
|
||||
acknowledgeMode = DUPS_OK_ACKNOWLEDGE;
|
||||
}
|
||||
else if ("client".equals(acknowledge)) {
|
||||
acknowledgeMode = CLIENT_ACKNOWLEDGE;
|
||||
}
|
||||
else if (!"auto".equals(acknowledge)) {
|
||||
parserContext.getReaderContext().error("Invalid JMS 'acknowledge' setting: " +
|
||||
"only \"auto\", \"client\", \"dups-ok\" and \"transacted\" supported.", element);
|
||||
}
|
||||
return acknowledgeMode;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static BeanDefinition parseJmsTemplateBeanDefinition(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DynamicJmsTemplate.class);
|
||||
builder.addPropertyReference(JmsAdapterParserUtils.CONNECTION_FACTORY_PROPERTY,
|
||||
@@ -137,17 +97,7 @@ abstract class JmsAdapterParserUtils {
|
||||
else {
|
||||
builder.addPropertyValue("receiveTimeout", JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT);
|
||||
}
|
||||
Integer acknowledgeMode = parseAcknowledgeMode(element, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
if (acknowledgeMode == SESSION_TRANSACTED) {
|
||||
parserContext.getReaderContext().error(
|
||||
"'transacted' is not a valid 'acknowledge-mode' here, use 'session-transacted'" +
|
||||
" to enable transactions", element);
|
||||
}
|
||||
builder.addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "session-transacted");
|
||||
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ public class JmsInboundChannelAdapterParser extends AbstractPollingInboundChanne
|
||||
else {
|
||||
builder.addConstructorArgValue(JmsAdapterParserUtils.parseJmsTemplateBeanDefinition(element, parserContext));
|
||||
}
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge", "sessionAcknowledgeMode");
|
||||
if (hasDestinationRef || hasDestinationName) {
|
||||
if (hasDestinationRef) {
|
||||
if (hasDestinationName) {
|
||||
|
||||
@@ -116,6 +116,8 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
builder.addConstructorArgReference(listenerBeanName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.AUTO_STARTUP);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.PHASE);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge", "sessionAcknowledgeMode");
|
||||
|
||||
}
|
||||
|
||||
private String parseMessageListenerContainer(Element element, ParserContext parserContext) {
|
||||
@@ -161,15 +163,7 @@ public class JmsMessageDrivenEndpointParser extends AbstractSingleBeanDefinition
|
||||
builder.addPropertyValue("destinationName", destinationName);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, pubSubDomainAttribute, "pubSubDomain");
|
||||
}
|
||||
Integer acknowledgeMode = JmsAdapterParserUtils.parseAcknowledgeMode(element, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
if (acknowledgeMode.intValue() == JmsAdapterParserUtils.SESSION_TRANSACTED) {
|
||||
builder.addPropertyValue("sessionTransacted", Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
builder.addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
}
|
||||
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "destination-resolver");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "transaction-manager");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-executor");
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.integration.jms.JmsOutboundGateway;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
@@ -73,6 +72,7 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
builder.addPropertyValue("deliveryPersistent", deliveryPersistent);
|
||||
}
|
||||
Element container = DomUtils.getChildElementByTagName(element, "reply-listener");
|
||||
|
||||
if (container != null) {
|
||||
this.parseReplyContainer(builder, parserContext, container);
|
||||
}
|
||||
@@ -119,15 +119,7 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
private void parseReplyContainer(BeanDefinitionBuilder gatewayBuilder, ParserContext parserContext, Element element) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JmsOutboundGateway.ReplyContainerProperties.class);
|
||||
Integer acknowledgeMode = JmsAdapterParserUtils.parseAcknowledgeMode(element, parserContext);
|
||||
if (acknowledgeMode != null) {
|
||||
if (JmsAdapterParserUtils.SESSION_TRANSACTED == acknowledgeMode) {
|
||||
builder.addPropertyValue("sessionTransacted", Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
builder.addPropertyValue("sessionAcknowledgeMode", acknowledgeMode);
|
||||
}
|
||||
}
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge", "sessionAcknowledgeModeName");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "concurrent-consumers");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-concurrent-consumers");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-messages-per-task");
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on 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.jms.util;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Liujiong
|
||||
* @since 4.1
|
||||
*
|
||||
*/
|
||||
public abstract class JmsAdapterUtils {
|
||||
|
||||
public static final int SESSION_TRANSACTED = 0;
|
||||
|
||||
public static final int AUTO_ACKNOWLEDGE = 1;
|
||||
|
||||
public static final int CLIENT_ACKNOWLEDGE = 2;
|
||||
|
||||
public static final int DUPS_OK_ACKNOWLEDGE = 3;
|
||||
|
||||
public static Integer parseAcknowledgeMode(String acknowledge) {
|
||||
if (StringUtils.hasText(acknowledge)) {
|
||||
int acknowledgeMode = AUTO_ACKNOWLEDGE;
|
||||
if ("transacted".equals(acknowledge)) {
|
||||
acknowledgeMode = SESSION_TRANSACTED;
|
||||
}
|
||||
else if ("dups-ok".equals(acknowledge)) {
|
||||
acknowledgeMode = DUPS_OK_ACKNOWLEDGE;
|
||||
}
|
||||
else if ("client".equals(acknowledge)) {
|
||||
acknowledgeMode = CLIENT_ACKNOWLEDGE;
|
||||
}
|
||||
else if (!"auto".equals(acknowledge)) {
|
||||
throw new IllegalStateException("Invalid JMS 'acknowledge' setting: " +
|
||||
"only \"auto\", \"client\", \"dups-ok\" and \"transacted\" supported.");
|
||||
}
|
||||
return acknowledgeMode;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,10 +170,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="default"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="listenerContainerEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="container-class" type="xsd:string">
|
||||
@@ -264,13 +261,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="connection"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="consumer"/>
|
||||
<xsd:enumeration value="auto"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="cacheLevelEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="acknowledge" default="transacted">
|
||||
@@ -283,12 +274,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="jsmAcknowledgeModeEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="transaction-manager" type="xsd:string">
|
||||
@@ -755,12 +741,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="jsmAcknowledgeModeEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attributeGroup ref="dmlcAttributeGroup" />
|
||||
@@ -1269,12 +1250,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="jsmAcknowledgeModeEnumeration xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="selector" type="xsd:string">
|
||||
@@ -1502,5 +1478,31 @@
|
||||
</xsd:attribute>
|
||||
|
||||
</xsd:attributeGroup>
|
||||
|
||||
|
||||
<xsd:simpleType name="cacheLevelEnumeration">
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="connection"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="consumer"/>
|
||||
<xsd:enumeration value="auto"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="listenerContainerEnumeration">
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="default"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="jsmAcknowledgeModeEnumeration">
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="auto"/>
|
||||
<xsd:enumeration value="client"/>
|
||||
<xsd:enumeration value="dups-ok"/>
|
||||
<xsd:enumeration value="transacted"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
</xsd:schema>
|
||||
|
||||
@@ -3,13 +3,23 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="jmsAcknowledgeModeTransacted">transacted</prop>
|
||||
</util:properties>
|
||||
|
||||
<int-jms:inbound-channel-adapter channel="out" session-transacted="true"
|
||||
connection-factory="connectionFactory" destination-name="incatQ"
|
||||
receive-timeout="500">
|
||||
receive-timeout="500" acknowledge="${jmsAcknowledgeModeTransacted}">
|
||||
<int:poller fixed-delay="500"/>
|
||||
</int-jms:inbound-channel-adapter>
|
||||
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<int:channel id="receiveChannel">
|
||||
<int:queue/>
|
||||
|
||||
@@ -3,16 +3,28 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="CACHELEVEL">none</prop>
|
||||
<prop key="listenerContainer">simple</prop>
|
||||
<prop key="jsmAcknowledgeMode">auto</prop>
|
||||
</util:properties>
|
||||
|
||||
<int:channel-interceptor pattern="jmsChannel">
|
||||
<bean class="org.springframework.integration.jms.config.GlobalChannelInterceptorTests.SampleInterceptor"/>
|
||||
</int:channel-interceptor>
|
||||
|
||||
<int-jms:channel id="jmsChannel" queue="jmsQueue"/>
|
||||
|
||||
<int-jms:channel id="jmsChannel" cache="${CACHELEVEL}" queue="jmsQueue" container-type="${listenerContainer}"/>
|
||||
|
||||
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
|
||||
<property name="targetConnectionFactory">
|
||||
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
|
||||
@@ -4,15 +4,26 @@
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/task
|
||||
http://www.springframework.org/schema/task/spring-task.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="jmsAcknowledgeModeTransacted">transacted</prop>
|
||||
<prop key="jmsAcknowledgeModeDupsOk">dups-ok</prop>
|
||||
</util:properties>
|
||||
|
||||
<si:channel id="requestChannel"/>
|
||||
|
||||
<jms:outbound-gateway id="jmsGateway"
|
||||
@@ -21,7 +32,7 @@
|
||||
delivery-persistent="true"
|
||||
auto-startup="false">
|
||||
<jms:reply-listener
|
||||
acknowledge="transacted"
|
||||
acknowledge="${jmsAcknowledgeModeTransacted}"
|
||||
concurrent-consumers="4"
|
||||
max-concurrent-consumers="5"
|
||||
max-messages-per-task="10"
|
||||
@@ -53,7 +64,7 @@
|
||||
<bean class="org.springframework.integration.jms.config.JmsOutboundGatewayParserTests$FooAdvice" />
|
||||
</jms:request-handler-advice-chain>
|
||||
<jms:reply-listener
|
||||
acknowledge="dups-ok"
|
||||
acknowledge="${jmsAcknowledgeModeDupsOk}"
|
||||
concurrent-consumers="3"
|
||||
max-concurrent-consumers="5"
|
||||
max-messages-per-task="10"
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
package org.springframework.integration.xml.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.AbstractTransformerParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -38,8 +38,8 @@ public class MarshallingTransformerParser extends AbstractTransformerParser {
|
||||
@Override
|
||||
protected void parseTransformer(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
String resultTransformer = element.getAttribute("result-transformer");
|
||||
String resultFactory = element.getAttribute("result-factory");
|
||||
String resultType = element.getAttribute("result-type");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "result-type", "resultType");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "result-factory", "resultFactoryName");
|
||||
String marshaller = element.getAttribute("marshaller");
|
||||
Assert.hasText(marshaller, "the 'marshaller' attribute is required");
|
||||
builder.addConstructorArgReference(marshaller);
|
||||
@@ -50,7 +50,6 @@ public class MarshallingTransformerParser extends AbstractTransformerParser {
|
||||
if (StringUtils.hasText(extractPayload)) {
|
||||
builder.addPropertyValue("extractPayload", extractPayload);
|
||||
}
|
||||
XmlNamespaceUtils.configureResultFactory(builder, resultType, resultFactory);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on 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.xml.config;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.integration.xml.result.DomResultFactory;
|
||||
import org.springframework.integration.xml.result.ResultFactory;
|
||||
import org.springframework.integration.xml.result.StringResultFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Utility methods for the XML namespace.
|
||||
*
|
||||
* @author Jonas Partner
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
abstract class XmlNamespaceUtils {
|
||||
|
||||
private static final String DOM_RESULT = "DOMResult";
|
||||
|
||||
private static final String STRING_RESULT = "StringResult";
|
||||
|
||||
|
||||
/**
|
||||
* Helper method that encapsulates common logic for validating and building
|
||||
* a bean definition for a {@link ResultFactory} based on either the
|
||||
* 'result-factory' or 'result-type' attributes.
|
||||
*/
|
||||
static void configureResultFactory(BeanDefinitionBuilder builder, String resultType, String resultFactory) {
|
||||
boolean bothHaveText = StringUtils.hasText(resultFactory) && StringUtils.hasText(resultType);
|
||||
Assert.state(!bothHaveText, "Only one of 'result-factory' or 'result-type' should be specified.");
|
||||
if (StringUtils.hasText(resultType)) {
|
||||
Assert.state(resultType.equals(DOM_RESULT) || resultType.equals(STRING_RESULT),
|
||||
"Result type must be either 'DOMResult' or 'StringResult'");
|
||||
}
|
||||
if (StringUtils.hasText(resultFactory)) {
|
||||
builder.addPropertyReference("resultFactory", resultFactory);
|
||||
}
|
||||
else if (resultType.equals(STRING_RESULT)) {
|
||||
builder.addPropertyValue("resultFactory", new StringResultFactory());
|
||||
}
|
||||
else if (resultType.equals(DOM_RESULT)) {
|
||||
builder.addPropertyValue("resultFactory", new DomResultFactory());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,12 +34,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class XmlPayloadValidatingFilterParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
/** Constant that defines a W3C XML Schema. */
|
||||
public static final String SCHEMA_W3C_XML = "http://www.w3.org/2001/XMLSchema";
|
||||
|
||||
/** Constant that defines a RELAX NG Schema. */
|
||||
public static final String SCHEMA_RELAX_NG = "http://relaxng.org/ns/structure/1.0";
|
||||
|
||||
@Override
|
||||
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder filterBuilder = BeanDefinitionBuilder.genericBeanDefinition(FilterFactoryBean.class);
|
||||
@@ -58,7 +52,7 @@ public class XmlPayloadValidatingFilterParser extends AbstractConsumerEndpointPa
|
||||
selectorBuilder.addConstructorArgValue(schemaLocation);
|
||||
// it is a restriction with the default value of 'xml-schema' which
|
||||
// corresponds to 'http://www.w3.org/2001/XMLSchema'
|
||||
String schemaType = "xml-schema".equals(element.getAttribute("schema-type")) ? SCHEMA_W3C_XML : SCHEMA_RELAX_NG;
|
||||
String schemaType = element.getAttribute("schema-type");
|
||||
selectorBuilder.addConstructorArgValue(schemaType);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.util.xml.DomUtils;
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Mike Bazos
|
||||
* @author liujiong
|
||||
*/
|
||||
public class XsltPayloadTransformerParser extends AbstractTransformerParser {
|
||||
|
||||
@@ -50,8 +51,8 @@ public class XsltPayloadTransformerParser extends AbstractTransformerParser {
|
||||
String xslResource = element.getAttribute("xsl-resource");
|
||||
String xslTemplates = element.getAttribute("xsl-templates");
|
||||
String resultTransformer = element.getAttribute("result-transformer");
|
||||
String resultFactory = element.getAttribute("result-factory");
|
||||
String resultType = element.getAttribute("result-type");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "result-type");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "result-factory", "resultFactoryName");
|
||||
String transformerFactoryClass = element.getAttribute("transformer-factory-class");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "xslt-param-headers");
|
||||
Assert.isTrue(StringUtils.hasText(xslResource) ^ StringUtils.hasText(xslTemplates),
|
||||
@@ -62,11 +63,6 @@ public class XsltPayloadTransformerParser extends AbstractTransformerParser {
|
||||
else if (StringUtils.hasText(xslTemplates)) {
|
||||
builder.addConstructorArgReference(xslTemplates);
|
||||
}
|
||||
XmlNamespaceUtils.configureResultFactory(builder, resultType, resultFactory);
|
||||
boolean resultFactorySpecified = StringUtils.hasText(resultFactory) || StringUtils.hasText(resultType);
|
||||
if(resultFactorySpecified){
|
||||
builder.addPropertyValue("alwaysUseResultFactory", true);
|
||||
}
|
||||
if (StringUtils.hasText(resultTransformer)) {
|
||||
builder.addConstructorArgReference(resultTransformer);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,29 @@ import org.springframework.xml.validation.XmlValidatorFactory;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
* @author Liujiong
|
||||
* @since 2.0
|
||||
*/
|
||||
public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
|
||||
public enum SchemaType {
|
||||
|
||||
XML_SCHEMA(XmlValidatorFactory.SCHEMA_W3C_XML),
|
||||
|
||||
RELAX_NG(XmlValidatorFactory.SCHEMA_RELAX_NG);
|
||||
|
||||
private final String url;
|
||||
|
||||
private SchemaType(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
private final XmlValidator xmlValidator;
|
||||
@@ -58,6 +77,7 @@ public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
this.xmlValidator = xmlValidator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a selector with a default {@link XmlValidator}. The validator will be initialized with
|
||||
* the provided 'schema' location {@link Resource} and 'schemaType'. The valid options for schema
|
||||
@@ -69,12 +89,17 @@ public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
*
|
||||
* @throws IOException if the XmlValidatorFactory fails to create a validator
|
||||
*/
|
||||
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException {
|
||||
public XmlValidatingMessageSelector(Resource schema, SchemaType schemaType) throws IOException {
|
||||
Assert.notNull(schema, "You must provide XML schema location to perform validation");
|
||||
if (!StringUtils.hasText(schemaType)) {
|
||||
schemaType = XmlValidatorFactory.SCHEMA_W3C_XML;
|
||||
if (schemaType == null) {
|
||||
schemaType = SchemaType.XML_SCHEMA;
|
||||
}
|
||||
this.xmlValidator = XmlValidatorFactory.createValidator(schema, schemaType);
|
||||
this.xmlValidator = XmlValidatorFactory.createValidator(schema, schemaType.getUrl());
|
||||
}
|
||||
|
||||
public XmlValidatingMessageSelector(Resource schema, String schemaType) throws IOException {
|
||||
this(schema, StringUtils.isEmpty(schemaType) ? null :
|
||||
SchemaType.valueOf(schemaType.toUpperCase().replaceFirst("-", "_")));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +131,7 @@ public class XmlValidatingMessageSelector implements MessageSelector {
|
||||
if (this.throwExceptionOnRejection) {
|
||||
throw new MessageRejectedException(message, "Message was rejected due to XML Validation errors",
|
||||
new AggregatedXmlMessageValidationException(
|
||||
Arrays.<Throwable> asList(validationExceptions)));
|
||||
Arrays.<Throwable>asList(validationExceptions)));
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Message was rejected due to XML Validation errors");
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on 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.xml.transformer;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.transformer.AbstractTransformer;
|
||||
import org.springframework.integration.xml.result.DomResultFactory;
|
||||
import org.springframework.integration.xml.result.ResultFactory;
|
||||
import org.springframework.integration.xml.result.StringResultFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* super class for XmlTransformer
|
||||
*
|
||||
* @author Jonas Partner
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
* @author Liujiong
|
||||
*/
|
||||
public abstract class AbstractXmlTransformer extends AbstractTransformer {
|
||||
|
||||
public static final String DOM_RESULT = "DOMResult";
|
||||
|
||||
public static final String STRING_RESULT = "StringResult";
|
||||
|
||||
private volatile String resultType;
|
||||
|
||||
private volatile String resultFactoryName;
|
||||
|
||||
private volatile ResultFactory resultFactory = new DomResultFactory();
|
||||
|
||||
public void setResultFactoryName(String resultFactoryName) {
|
||||
this.resultFactoryName = resultFactoryName;
|
||||
}
|
||||
|
||||
public void setResultType(String resultType) {
|
||||
this.resultType = resultType;
|
||||
}
|
||||
|
||||
public void setResultFactory(ResultFactory resultFactory) {
|
||||
Assert.notNull(resultFactory, "ResultFactory must not be null");
|
||||
this.resultFactory = resultFactory;
|
||||
}
|
||||
|
||||
public String getResultType() {
|
||||
return resultType;
|
||||
}
|
||||
|
||||
public String getResultFactoryName() {
|
||||
return resultFactoryName;
|
||||
}
|
||||
|
||||
public ResultFactory getResultFactory() {
|
||||
return resultFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() throws Exception {
|
||||
super.onInit();
|
||||
ResultFactory generatedResultFactory = configureResultFactory(resultType, resultFactoryName, this.getBeanFactory());
|
||||
if (generatedResultFactory != null) {
|
||||
resultFactory = generatedResultFactory;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method that encapsulates common logic for validating and building
|
||||
* a bean definition for a {@link ResultFactory} based on either the
|
||||
* 'result-factory' or 'result-type' attributes.
|
||||
*/
|
||||
private ResultFactory configureResultFactory(String resultType, String resultFactoryName, BeanFactory beanFactory) {
|
||||
boolean bothHaveText = StringUtils.hasText(resultFactoryName) && StringUtils.hasText(resultType);
|
||||
ResultFactory resultFactory = null;
|
||||
Assert.state(!bothHaveText, "Only one of 'result-factory' or 'result-type' should be specified.");
|
||||
if (StringUtils.hasText(resultType)) {
|
||||
Assert.state(resultType.equals(DOM_RESULT) || resultType.equals(STRING_RESULT),
|
||||
"Result type must be either 'DOMResult' or 'StringResult'");
|
||||
}
|
||||
if (StringUtils.hasText(resultFactoryName)) {
|
||||
resultFactory = (ResultFactory) beanFactory.getBean(resultFactoryName);
|
||||
}
|
||||
else if (STRING_RESULT.equals(resultType)) {
|
||||
resultFactory = new StringResultFactory();
|
||||
}
|
||||
else if (DOM_RESULT.equals(resultType)) {
|
||||
resultFactory = new DomResultFactory();
|
||||
}
|
||||
return resultFactory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,8 +22,6 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Result;
|
||||
|
||||
import org.springframework.integration.transformer.AbstractTransformer;
|
||||
import org.springframework.integration.xml.result.DomResultFactory;
|
||||
import org.springframework.integration.xml.result.ResultFactory;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.oxm.Marshaller;
|
||||
@@ -35,12 +33,10 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
* @author Jonas Partner
|
||||
*/
|
||||
public class MarshallingTransformer extends AbstractTransformer {
|
||||
public class MarshallingTransformer extends AbstractXmlTransformer {
|
||||
|
||||
private final Marshaller marshaller;
|
||||
|
||||
private volatile ResultFactory resultFactory;
|
||||
|
||||
private final ResultTransformer resultTransformer;
|
||||
|
||||
private volatile boolean extractPayload = true;
|
||||
@@ -50,7 +46,6 @@ public class MarshallingTransformer extends AbstractTransformer {
|
||||
Assert.notNull(marshaller, "a marshaller is required");
|
||||
this.marshaller = marshaller;
|
||||
this.resultTransformer = resultTransformer;
|
||||
this.resultFactory = new DomResultFactory();
|
||||
}
|
||||
|
||||
public MarshallingTransformer(Marshaller marshaller) throws ParserConfigurationException {
|
||||
@@ -58,11 +53,6 @@ public class MarshallingTransformer extends AbstractTransformer {
|
||||
}
|
||||
|
||||
|
||||
public void setResultFactory(ResultFactory resultFactory) {
|
||||
Assert.notNull(resultFactory, "ResultFactory must not be null");
|
||||
this.resultFactory = resultFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether the source Message's payload should be extracted prior
|
||||
* to marshalling. This value is set to "true" by default. To send the
|
||||
@@ -79,11 +69,12 @@ public class MarshallingTransformer extends AbstractTransformer {
|
||||
return "xml:marshalling-transformer";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object doTransform(Message<?> message) {
|
||||
Object source = (this.extractPayload) ? message.getPayload() : message;
|
||||
Object transformedPayload = null;
|
||||
Result result = this.resultFactory.createResult(source);
|
||||
Result result = this.getResultFactory().createResult(source);
|
||||
if (result == null) {
|
||||
throw new MessagingException(
|
||||
"Unable to marshal payload, ResultFactory returned null.");
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.springframework.core.io.Resource;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.transformer.AbstractTransformer;
|
||||
import org.springframework.integration.xml.result.DomResultFactory;
|
||||
import org.springframework.integration.xml.result.ResultFactory;
|
||||
import org.springframework.integration.xml.source.DomSourceFactory;
|
||||
@@ -47,6 +46,7 @@ import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.transform.StringResult;
|
||||
import org.springframework.xml.transform.StringSource;
|
||||
|
||||
@@ -77,7 +77,7 @@ import org.springframework.xml.transform.StringSource;
|
||||
* @author Mike Bazos
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class XsltPayloadTransformer extends AbstractTransformer implements BeanClassLoaderAware {
|
||||
public class XsltPayloadTransformer extends AbstractXmlTransformer implements BeanClassLoaderAware {
|
||||
|
||||
private final ResultTransformer resultTransformer;
|
||||
|
||||
@@ -93,8 +93,6 @@ public class XsltPayloadTransformer extends AbstractTransformer implements BeanC
|
||||
|
||||
private volatile SourceFactory sourceFactory = new DomSourceFactory();
|
||||
|
||||
private volatile ResultFactory resultFactory = new DomResultFactory();
|
||||
|
||||
private volatile boolean resultFactoryExplicitlySet;
|
||||
|
||||
private volatile boolean alwaysUseSourceFactory = false;
|
||||
@@ -155,8 +153,7 @@ public class XsltPayloadTransformer extends AbstractTransformer implements BeanC
|
||||
* @param resultFactory The result factory.
|
||||
*/
|
||||
public void setResultFactory(ResultFactory resultFactory) {
|
||||
Assert.notNull(sourceFactory, "ResultFactory must not be null");
|
||||
this.resultFactory = resultFactory;
|
||||
super.setResultFactory(resultFactory);
|
||||
this.resultFactoryExplicitlySet = true;
|
||||
}
|
||||
|
||||
@@ -192,6 +189,21 @@ public class XsltPayloadTransformer extends AbstractTransformer implements BeanC
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResultType(String resultType) {
|
||||
super.setResultType(resultType);
|
||||
if (StringUtils.hasText(resultType)) {
|
||||
this.alwaysUseResultFactory = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResultFactoryName(String resultFactoryName) {
|
||||
super.setResultFactoryName(resultFactoryName);
|
||||
if (StringUtils.hasText(resultFactoryName)) {
|
||||
this.alwaysUseResultFactory = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
@@ -270,7 +282,7 @@ public class XsltPayloadTransformer extends AbstractTransformer implements BeanC
|
||||
result = new StringResult();
|
||||
}
|
||||
else {
|
||||
result = this.resultFactory.createResult(payload);
|
||||
result = this.getResultFactory().createResult(payload);
|
||||
}
|
||||
transformer.transform(source, result);
|
||||
if (this.resultTransformer != null) {
|
||||
@@ -300,7 +312,7 @@ public class XsltPayloadTransformer extends AbstractTransformer implements BeanC
|
||||
else {
|
||||
source = new DOMSource(documentPayload);
|
||||
}
|
||||
Result result = this.resultFactory.createResult(documentPayload);
|
||||
Result result = this.getResultFactory().createResult(documentPayload);
|
||||
if (!DOMResult.class.isAssignableFrom(result.getClass())) {
|
||||
throw new MessagingException(
|
||||
"Document to Document conversion requires a DOMResult-producing ResultFactory implementation.");
|
||||
|
||||
@@ -38,10 +38,7 @@
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="result-type" use="optional">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="DOMResult"/>
|
||||
<xsd:enumeration value="StringResult"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="resultType xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="result-factory" type="xsd:string" use="optional">
|
||||
@@ -211,10 +208,7 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="DOMResult"/>
|
||||
<xsd:enumeration value="StringResult"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="resultType xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="result-transformer" type="xsd:string" use="optional">
|
||||
@@ -294,13 +288,7 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="BOOLEAN_RESULT"/>
|
||||
<xsd:enumeration value="STRING_RESULT"/>
|
||||
<xsd:enumeration value="NUMBER_RESULT"/>
|
||||
<xsd:enumeration value="NODE_RESULT"/>
|
||||
<xsd:enumeration value="NODE_LIST_RESULT"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="evaluationType xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="node-mapper">
|
||||
@@ -421,13 +409,7 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="BOOLEAN_RESULT"/>
|
||||
<xsd:enumeration value="STRING_RESULT"/>
|
||||
<xsd:enumeration value="NUMBER_RESULT"/>
|
||||
<xsd:enumeration value="NODE_RESULT"/>
|
||||
<xsd:enumeration value="NODE_LIST_RESULT"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="evaluationType xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="overwrite">
|
||||
@@ -796,10 +778,7 @@
|
||||
<xsd:attribute name="schema-location"/>
|
||||
<xsd:attribute name="schema-type" default="xml-schema">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="xml-schema"/>
|
||||
<xsd:enumeration value="relax-ng"/>
|
||||
</xsd:restriction>
|
||||
<xsd:union memberTypes="schemaType xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
@@ -883,5 +862,29 @@
|
||||
<xsd:attribute name="expression" type="xsd:string" use="optional"/>
|
||||
<xsd:attribute name="value" type="xsd:string" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:simpleType name="resultType">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="DOMResult"/>
|
||||
<xsd:enumeration value="StringResult"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="evaluationType">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="BOOLEAN_RESULT"/>
|
||||
<xsd:enumeration value="STRING_RESULT"/>
|
||||
<xsd:enumeration value="NUMBER_RESULT"/>
|
||||
<xsd:enumeration value="NODE_RESULT"/>
|
||||
<xsd:enumeration value="NODE_LIST_RESULT"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="schemaType">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="xml-schema"/>
|
||||
<xsd:enumeration value="relax-ng"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
</xsd:schema>
|
||||
|
||||
@@ -3,24 +3,38 @@
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/xml
|
||||
http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<beans:prop key="booleanResult">BOOLEAN_RESULT</beans:prop>
|
||||
<beans:prop key="stringResult">STRING_RESULT</beans:prop>
|
||||
<beans:prop key="numberResult">NUMBER_RESULT</beans:prop>
|
||||
<beans:prop key="nodeResult">NODE_RESULT</beans:prop>
|
||||
<beans:prop key="nodeListResult">NODE_LIST_RESULT</beans:prop>
|
||||
</util:properties>
|
||||
|
||||
<si:channel id="output">
|
||||
<si:queue/>
|
||||
</si:channel>
|
||||
|
||||
<xpath-header-enricher input-channel="input" output-channel="output">
|
||||
<header name="name" xpath-expression="/person/@name" />
|
||||
<header name="age" xpath-expression="/person/@age" evaluation-type="NUMBER_RESULT" header-type="int"/>
|
||||
<header name="married" xpath-expression="/person/@married = 'true'" evaluation-type="BOOLEAN_RESULT" />
|
||||
<header name="node-test" xpath-expression="/person/@age" evaluation-type="NODE_RESULT" />
|
||||
<header name="node-list-test" xpath-expression="/person/@*" evaluation-type="NODE_LIST_RESULT" />
|
||||
<header name="ref-test" xpath-expression-ref="testExpression" evaluation-type="NUMBER_RESULT" />
|
||||
<header name="age" xpath-expression="/person/@age" evaluation-type="${numberResult}" header-type="int"/>
|
||||
<header name="married" xpath-expression="/person/@married = 'true'" evaluation-type="${booleanResult}" />
|
||||
<header name="node-test" xpath-expression="/person/@age" evaluation-type="${nodeResult}" />
|
||||
<header name="node-list-test" xpath-expression="/person/@*" evaluation-type="${nodeListResult}" />
|
||||
<header name="ref-test" xpath-expression-ref="testExpression" evaluation-type="${numberResult}" />
|
||||
</xpath-header-enricher>
|
||||
|
||||
<xpath-expression id="testExpression" expression="/person/@age * 2"/>
|
||||
|
||||
@@ -3,32 +3,46 @@
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/xml
|
||||
http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<beans:prop key="booleanResult">BOOLEAN_RESULT</beans:prop>
|
||||
<beans:prop key="stringResult">STRING_RESULT</beans:prop>
|
||||
<beans:prop key="numberResult">NUMBER_RESULT</beans:prop>
|
||||
<beans:prop key="nodeResult">NODE_RESULT</beans:prop>
|
||||
<beans:prop key="nodeListResult">NODE_LIST_RESULT</beans:prop>
|
||||
</util:properties>
|
||||
|
||||
<si:channel id="output">
|
||||
<si:queue/>
|
||||
</si:channel>
|
||||
|
||||
<xpath-transformer input-channel="defaultInput" xpath-expression="/person/@name" output-channel="output"/>
|
||||
|
||||
<xpath-transformer input-channel="numberInput" xpath-expression="/person/@age" evaluation-type="NUMBER_RESULT" output-channel="output"/>
|
||||
<xpath-transformer input-channel="numberInput" xpath-expression="/person/@age" evaluation-type="${numberResult}" output-channel="output"/>
|
||||
|
||||
<xpath-transformer input-channel="booleanInput" xpath-expression="/person/@married = 'true'" evaluation-type="BOOLEAN_RESULT" output-channel="output"/>
|
||||
<xpath-transformer input-channel="booleanInput" xpath-expression="/person/@married = 'true'" evaluation-type="${booleanResult}" output-channel="output"/>
|
||||
|
||||
<xpath-transformer input-channel="nodeInput" xpath-expression="/person/@age" evaluation-type="NODE_RESULT" output-channel="output"/>
|
||||
<xpath-transformer input-channel="nodeInput" xpath-expression="/person/@age" evaluation-type="${nodeResult}" output-channel="output"/>
|
||||
|
||||
<xpath-transformer input-channel="nodeListInput" xpath-expression="/person/@*" evaluation-type="NODE_LIST_RESULT" output-channel="output"/>
|
||||
<xpath-transformer input-channel="nodeListInput" xpath-expression="/person/@*" evaluation-type="${nodeListResult}" output-channel="output"/>
|
||||
|
||||
<xpath-transformer input-channel="nodeMapperInput" xpath-expression="/person/@age" node-mapper="testNodeMapper" output-channel="output"/>
|
||||
|
||||
<xpath-transformer input-channel="customConverterInput" xpath-expression="/test/@type" converter="testXmlPayloadConverter" output-channel="output"/>
|
||||
|
||||
<xpath-transformer input-channel="expressionRefInput" xpath-expression-ref="testExpression" evaluation-type="NUMBER_RESULT" output-channel="output"/>
|
||||
<xpath-transformer input-channel="expressionRefInput" xpath-expression-ref="testExpression" evaluation-type="${numberResult}" output-channel="output"/>
|
||||
|
||||
<xpath-expression id="testExpression" expression="/person/@age * 2"/>
|
||||
|
||||
|
||||
@@ -3,11 +3,22 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="xmlSchema">xml-schema</prop>
|
||||
</util:properties>
|
||||
|
||||
<int-xml:validating-filter id="filterA"
|
||||
schema-type="${xmlSchema}"
|
||||
input-channel="inputChannelA"
|
||||
output-channel="validOutputChannel"
|
||||
discard-channel="invalidOutputChannel"
|
||||
@@ -38,4 +49,5 @@
|
||||
<int:channel id="invalidOutputChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -23,17 +23,20 @@ import static org.junit.Assert.fail;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.MessageRejectedException;
|
||||
import org.springframework.integration.xml.AggregatedXmlMessageValidationException;
|
||||
import org.springframework.integration.xml.util.XmlTestUtil;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Jonas Partner
|
||||
@@ -42,11 +45,15 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class XmlPayloadValidatingFilterParserTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext ac;
|
||||
|
||||
@Test
|
||||
public void testValidMessage() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmlPayloadValidatingFilterParserTests-context.xml", this.getClass());
|
||||
Document doc = XmlTestUtil.getDocumentForString("<greeting>hello</greeting>");
|
||||
GenericMessage<Document> docMessage = new GenericMessage<Document>(doc);
|
||||
PollableChannel validChannel = ac.getBean("validOutputChannel", PollableChannel.class);
|
||||
@@ -56,7 +63,6 @@ public class XmlPayloadValidatingFilterParserTests {
|
||||
}
|
||||
@Test
|
||||
public void testInvalidMessageWithDiscardChannel() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmlPayloadValidatingFilterParserTests-context.xml", this.getClass());
|
||||
Document doc = XmlTestUtil.getDocumentForString("<greeting><other/></greeting>");
|
||||
GenericMessage<Document> docMessage = new GenericMessage<Document>(doc);
|
||||
PollableChannel validChannel = ac.getBean("validOutputChannel", PollableChannel.class);
|
||||
@@ -68,7 +74,6 @@ public class XmlPayloadValidatingFilterParserTests {
|
||||
}
|
||||
@Test
|
||||
public void testInvalidMessageWithThrowException() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmlPayloadValidatingFilterParserTests-context.xml", this.getClass());
|
||||
Document doc = XmlTestUtil.getDocumentForString("<greeting ping=\"pong\"><other/></greeting>");
|
||||
GenericMessage<Document> docMessage = new GenericMessage<Document>(doc);
|
||||
MessageChannel inputChannel = ac.getBean("inputChannelB", MessageChannel.class);
|
||||
@@ -88,7 +93,6 @@ public class XmlPayloadValidatingFilterParserTests {
|
||||
}
|
||||
@Test
|
||||
public void testValidMessageWithValidator() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmlPayloadValidatingFilterParserTests-context.xml", this.getClass());
|
||||
Document doc = XmlTestUtil.getDocumentForString("<greeting>hello</greeting>");
|
||||
GenericMessage<Document> docMessage = new GenericMessage<Document>(doc);
|
||||
PollableChannel validChannel = ac.getBean("validOutputChannel", PollableChannel.class);
|
||||
@@ -96,16 +100,15 @@ public class XmlPayloadValidatingFilterParserTests {
|
||||
inputChannel.send(docMessage);
|
||||
assertNotNull(validChannel.receive(100));
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@Test
|
||||
public void testInvalidMessageWithValidatorAndDiscardChannel() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("XmlPayloadValidatingFilterParserTests-context.xml", this.getClass());
|
||||
Document doc = XmlTestUtil.getDocumentForString("<greeting><other/></greeting>");
|
||||
GenericMessage<Document> docMessage = new GenericMessage<Document>(doc);
|
||||
PollableChannel validChannel = ac.getBean("validOutputChannel", PollableChannel.class);
|
||||
PollableChannel invalidChannel = ac.getBean("invalidOutputChannel", PollableChannel.class);
|
||||
MessageChannel inputChannel = ac.getBean("inputChannelC", MessageChannel.class);
|
||||
inputChannel.send(docMessage);
|
||||
assertNotNull(invalidChannel.receive(100));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,32 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:si-xml="http://www.springframework.org/schema/integration/xml"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:si-xml="http://www.springframework.org/schema/integration/xml"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/integration/xml
|
||||
http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="domResult">DOMResult</prop>
|
||||
<prop key="stringResult">StringResult</prop>
|
||||
</util:properties>
|
||||
|
||||
<si:channel id="output">
|
||||
<si:queue capacity="1"/>
|
||||
</si:channel>
|
||||
|
||||
<si:channel id="withResourceIn"/>
|
||||
|
||||
<si-xml:xslt-transformer id="xsltTransformerWithResource"
|
||||
input-channel="withResourceIn"
|
||||
output-channel="output"
|
||||
xsl-resource="org/springframework/integration/xml/config/test.xsl"/>
|
||||
|
||||
<si:channel id="withTemplatesIn"/>
|
||||
|
||||
<si-xml:xslt-transformer id="xsltTransformerWithTemplates"
|
||||
input-channel="withTemplatesIn"
|
||||
output-channel="output"
|
||||
xsl-templates="templates"/>
|
||||
|
||||
<si:channel id="withTemplatesAndResultTransformerIn"/>
|
||||
|
||||
<si-xml:xslt-transformer id="xsltTransformerWithTemplatesAndResultTransformer"
|
||||
input-channel="withTemplatesAndResultTransformerIn"
|
||||
output-channel="output"
|
||||
@@ -34,6 +48,7 @@
|
||||
result-transformer="resultTransformer"/>
|
||||
|
||||
<si:channel id="withTemplatesAndResultFactoryIn"/>
|
||||
|
||||
<si-xml:xslt-transformer id="xsltTransformerWithTemplatesAndResultFactory"
|
||||
input-channel="withTemplatesAndResultFactoryIn"
|
||||
output-channel="output"
|
||||
@@ -41,23 +56,24 @@
|
||||
result-factory="stubResultFactory"/>
|
||||
|
||||
<si:channel id="withTemplatesAndStringResultTypeIn"/>
|
||||
|
||||
<si-xml:xslt-transformer id="xsltTransformerWithTemplatesAndStringResultType"
|
||||
input-channel="withTemplatesAndStringResultTypeIn"
|
||||
output-channel="output"
|
||||
xsl-templates="templates"
|
||||
result-type="StringResult"/>
|
||||
result-type="${stringResult}"/>
|
||||
|
||||
|
||||
<si-xml:xslt-transformer id="docInStringResultOutTransformer"
|
||||
input-channel="docinStringResultOutTransformerChannel"
|
||||
output-channel="output" result-type="StringResult"
|
||||
output-channel="output" result-type="${stringResult}"
|
||||
xsl-resource="classpath:org/springframework/integration/xml/transformer/transformer.xslt">
|
||||
</si-xml:xslt-transformer>
|
||||
|
||||
|
||||
<si-xml:xslt-transformer id="stringResultOutTransformer"
|
||||
input-channel="stringResultOutTransformerChannel"
|
||||
output-channel="output" result-type="DOMResult"
|
||||
output-channel="output" result-type="${domResult}"
|
||||
xsl-resource="classpath:org/springframework/integration/xml/transformer/transform.xsl">
|
||||
</si-xml:xslt-transformer>
|
||||
|
||||
@@ -80,5 +96,4 @@
|
||||
|
||||
<bean id="stubResultFactory" class="org.springframework.integration.xml.config.StubResultFactory"/>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -47,109 +47,104 @@ import org.springframework.xml.transform.StringResult;
|
||||
*/
|
||||
public class XsltPayloadTransformerParserTests {
|
||||
|
||||
private final String doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><order><orderItem>test</orderItem></order>";
|
||||
private final String doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><order><orderItem>test</orderItem></order>";
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private PollableChannel output;
|
||||
private PollableChannel output;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
applicationContext = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
|
||||
output = (PollableChannel) applicationContext.getBean("output");
|
||||
}
|
||||
@Before
|
||||
public void setUp() {
|
||||
applicationContext = new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
|
||||
output = (PollableChannel) applicationContext.getBean("output");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResourceProvided() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withResourceIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a DOMResult", result.getPayload() instanceof DOMResult);
|
||||
Document doc = (Document) ((DOMResult) result.getPayload()).getNode();
|
||||
assertEquals("Wrong payload", "test", doc.getDocumentElement().getTextContent());
|
||||
assertNotNull(TestUtils.getPropertyValue(applicationContext.getBean("xsltTransformerWithResource.handler"),
|
||||
"transformer.evaluationContext.beanResolver"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResourceProvided() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withResourceIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a DOMResult", result.getPayload() instanceof DOMResult);
|
||||
Document doc = (Document) ((DOMResult) result.getPayload()).getNode();
|
||||
assertEquals("Wrong payload", "test", doc.getDocumentElement().getTextContent());
|
||||
assertNotNull(TestUtils.getPropertyValue(applicationContext.getBean("xsltTransformerWithResource.handler"),
|
||||
"transformer.evaluationContext.beanResolver"));
|
||||
}
|
||||
@Test
|
||||
public void testWithTemplatesProvided() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a DOMResult", result.getPayload() instanceof DOMResult);
|
||||
Document doc = (Document) ((DOMResult) result.getPayload()).getNode();
|
||||
assertEquals("Wrong payload", "test", doc.getDocumentElement().getTextContent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithTemplatesProvided() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a DOMResult", result.getPayload() instanceof DOMResult);
|
||||
Document doc = (Document) ((DOMResult) result.getPayload()).getNode();
|
||||
assertEquals("Wrong payload", "test", doc.getDocumentElement().getTextContent());
|
||||
}
|
||||
@Test
|
||||
public void testWithTemplatesAndResultTransformer() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesAndResultTransformerIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertEquals("Wrong payload type", String.class, result.getPayload().getClass());
|
||||
String strResult = (String) result.getPayload();
|
||||
assertEquals("Wrong payload", "testReturn", strResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithTemplatesAndResultTransformer() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesAndResultTransformerIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertEquals("Wrong payload type", String.class, result.getPayload().getClass());
|
||||
String strResult = (String) result.getPayload();
|
||||
assertEquals("Wrong payload", "testReturn", strResult);
|
||||
}
|
||||
@Test
|
||||
public void testWithResourceProvidedAndStubResultFactory() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesAndResultFactoryIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a StubStringResult", result.getPayload() instanceof StubStringResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResourceProvidedAndStubResultFactory() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesAndResultFactoryIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a StubStringResult", result.getPayload() instanceof StubStringResult);
|
||||
}
|
||||
@Test
|
||||
public void testWithResourceAndStringResultType() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesAndStringResultTypeIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a StringResult", result.getPayload() instanceof StringResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResourceAndStringResultType() throws Exception {
|
||||
MessageChannel input = (MessageChannel) applicationContext.getBean("withTemplatesAndStringResultTypeIn");
|
||||
GenericMessage<Object> message = new GenericMessage<Object>(XmlTestUtil.getDomSourceForString(doc));
|
||||
input.send(message);
|
||||
Message<?> result = output.receive(0);
|
||||
assertTrue("Payload was not a StringResult", result.getPayload() instanceof StringResult);
|
||||
}
|
||||
@Test
|
||||
public void docInStringResultOut() throws Exception {
|
||||
MessageChannel input = applicationContext.getBean("docinStringResultOutTransformerChannel",
|
||||
MessageChannel.class);
|
||||
Message<?> message = MessageBuilder.withPayload(XmlTestUtil.getDocumentForString(this.doc)).build();
|
||||
input.send(message);
|
||||
Message<?> resultMessage = output.receive();
|
||||
Assert.assertEquals("Wrong payload type", StringResult.class, resultMessage.getPayload().getClass());
|
||||
String payload = resultMessage.getPayload().toString();
|
||||
Assert.assertTrue(payload.contains("<bob>test</bob>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringInDocResultOut() throws Exception {
|
||||
MessageChannel input = applicationContext.getBean("stringResultOutTransformerChannel", MessageChannel.class);
|
||||
Message<?> message = MessageBuilder.withPayload(this.doc).build();
|
||||
input.send(message);
|
||||
Message<?> resultMessage = output.receive();
|
||||
Assert.assertEquals("Wrong payload type", DOMResult.class, resultMessage.getPayload().getClass());
|
||||
Document payload = (Document) ((DOMResult) resultMessage.getPayload()).getNode();
|
||||
Assert.assertTrue(XmlTestUtil.docToString(payload).contains("<bob>test</bob>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void docInStringResultOut() throws Exception {
|
||||
MessageChannel input = applicationContext.getBean("docinStringResultOutTransformerChannel", MessageChannel.class);
|
||||
Message<?> message = MessageBuilder.withPayload(XmlTestUtil.getDocumentForString(this.doc)).
|
||||
build();
|
||||
input.send(message);
|
||||
Message<?> resultMessage = output.receive();
|
||||
Assert.assertEquals("Wrong payload type", StringResult.class, resultMessage.getPayload().getClass());
|
||||
String payload = resultMessage.getPayload().toString();
|
||||
Assert.assertTrue(payload.contains("<bob>test</bob>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringInDocResultOut() throws Exception {
|
||||
MessageChannel input = applicationContext.getBean("stringResultOutTransformerChannel", MessageChannel.class);
|
||||
Message<?> message = MessageBuilder.withPayload(this.doc).
|
||||
build();
|
||||
input.send(message);
|
||||
Message<?> resultMessage = output.receive();
|
||||
Assert.assertEquals("Wrong payload type", DOMResult.class, resultMessage.getPayload().getClass());
|
||||
Document payload = (Document) ((DOMResult) resultMessage.getPayload()).getNode();
|
||||
Assert.assertTrue(XmlTestUtil.docToString(payload).contains("<bob>test</bob>"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void stringInAndCustomResultFactory() throws Exception {
|
||||
MessageChannel input = applicationContext.getBean("stringInCustomResultFactoryChannel", MessageChannel.class);
|
||||
Message<?> message = MessageBuilder.withPayload(XmlTestUtil.getDocumentForString(this.doc)).
|
||||
build();
|
||||
input.send(message);
|
||||
Message<?> resultMessage = output.receive();
|
||||
Assert.assertEquals("Wrong payload type", CustomTestResultFactory.FixedStringResult.class, resultMessage.getPayload().getClass());
|
||||
String payload = resultMessage.getPayload().toString();
|
||||
Assert.assertTrue(payload.contains("fixedStringForTesting"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringInAndCustomResultFactory() throws Exception {
|
||||
MessageChannel input = applicationContext.getBean("stringInCustomResultFactoryChannel", MessageChannel.class);
|
||||
Message<?> message = MessageBuilder.withPayload(XmlTestUtil.getDocumentForString(this.doc)).build();
|
||||
input.send(message);
|
||||
Message<?> resultMessage = output.receive();
|
||||
Assert.assertEquals("Wrong payload type", CustomTestResultFactory.FixedStringResult.class, resultMessage
|
||||
.getPayload().getClass());
|
||||
String payload = resultMessage.getPayload().toString();
|
||||
Assert.assertTrue(payload.contains("fixedStringForTesting"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="xmlValidatingMessageSelector" class="org.springframework.integration.xml.selector.XmlValidatingMessageSelector">
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.core.io.ByteArrayResource">
|
||||
<constructor-arg value="#{new byte[] { 0x03 } }"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg value="foo"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -13,12 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.xml.selector;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.xml.validation.XmlValidatorFactory;
|
||||
import org.springframework.integration.xml.selector.XmlValidatingMessageSelector.SchemaType;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
@@ -29,23 +35,34 @@ public class XmlValidatingMessageSelectorTests {
|
||||
@Test
|
||||
public void validateCreationWithSchemaAndDefaultSchemaType() throws Exception{
|
||||
Resource resource = new ByteArrayResource("<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'/>".getBytes());
|
||||
new XmlValidatingMessageSelector(resource, null);
|
||||
new XmlValidatingMessageSelector(resource, (SchemaType) null);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void validateCreationWithSchemaAndProvidedSchemaType() throws Exception{
|
||||
Resource resource = new ByteArrayResource("<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'/>".getBytes());
|
||||
new XmlValidatingMessageSelector(resource, XmlValidatorFactory.SCHEMA_W3C_XML);
|
||||
new XmlValidatingMessageSelector(resource, SchemaType.XML_SCHEMA);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
|
||||
@Test
|
||||
public void validateFailureInvalidSchemaLanguage() throws Exception{
|
||||
Resource resource = new ByteArrayResource("<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'/>".getBytes());
|
||||
new XmlValidatingMessageSelector(resource, "foo");
|
||||
ConfigurableApplicationContext context = null;
|
||||
try {
|
||||
context = new ClassPathXmlApplicationContext("XmlValidatingMessageSelectorTests-context.xml", this.getClass());
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertTrue(e.getMessage().contains("java.lang.IllegalArgumentException: No enum constant"));
|
||||
}
|
||||
finally {
|
||||
if(context != null) {
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void validateFailureWhenNoSchemaResourceProvided() throws Exception{
|
||||
new XmlValidatingMessageSelector(null, null);
|
||||
new XmlValidatingMessageSelector(null, (SchemaType) null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,22 +4,29 @@
|
||||
xmlns:si-xml="http://www.springframework.org/schema/integration/xml"
|
||||
xmlns:si="http://www.springframework.org/schema/integration"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/xml
|
||||
http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder properties-ref="props"/>
|
||||
|
||||
<util:properties id="props">
|
||||
<prop key="result">DOMResult</prop>
|
||||
</util:properties>
|
||||
|
||||
<context:annotation-config/>
|
||||
|
||||
<si:channel id="marshallIn"/>
|
||||
|
||||
<si:channel id="unmarshallIn"/>
|
||||
|
||||
|
||||
<si:channel id="unmarshallOut">
|
||||
<si:queue capacity="10" />
|
||||
</si:channel>
|
||||
@@ -28,12 +35,10 @@
|
||||
<si:queue capacity="10" />
|
||||
</si:channel>
|
||||
|
||||
<si-xml:marshalling-transformer id="marshaller" input-channel="marshallIn" output-channel="marshallOut" marshaller="marshallerUnmarshaller" />
|
||||
|
||||
<si-xml:marshalling-transformer id="marshaller" input-channel="marshallIn" output-channel="marshallOut" marshaller="marshallerUnmarshaller" result-type="${result}" />
|
||||
|
||||
<si-xml:unmarshalling-transformer id="unmarshaller" input-channel="unmarshallIn" output-channel="unmarshallOut" unmarshaller="marshallerUnmarshaller" />
|
||||
|
||||
|
||||
<bean id="marshallerUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller" >
|
||||
<property name="classesToBeBound">
|
||||
<list>
|
||||
@@ -42,4 +47,4 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user