INT-3228: Remove Previous versions' Deprecations
JIRA: https://jira.springsource.org/browse/INT-3228 Remove elements that were deprecated in earlier versions; see the migration guide for more information https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-2.2-to-3.0-Migration-Guide INT-3228: Revert FileTransferMH#setTempDirectory
This commit is contained in:
committed by
Gary Russell
parent
3e9d0158eb
commit
c2004f1ab3
@@ -15,9 +15,6 @@ package org.springframework.integration.config;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
@@ -26,7 +23,6 @@ import org.springframework.integration.router.AbstractMappingMessageRouter;
|
||||
import org.springframework.integration.router.AbstractMessageRouter;
|
||||
import org.springframework.integration.router.ExpressionEvaluatingRouter;
|
||||
import org.springframework.integration.router.MethodInvokingRouter;
|
||||
import org.springframework.integration.support.channel.ChannelResolver;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -41,8 +37,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class RouterFactoryBean extends AbstractStandardMessageHandlerFactoryBean {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
private volatile Map<String, String> channelMappings;
|
||||
|
||||
private volatile MessageChannel defaultOutputChannel;
|
||||
@@ -55,13 +49,6 @@ public class RouterFactoryBean extends AbstractStandardMessageHandlerFactoryBean
|
||||
|
||||
private volatile Boolean ignoreSendFailures;
|
||||
|
||||
private volatile ChannelResolver channelResolver;
|
||||
|
||||
|
||||
public void setChannelResolver(ChannelResolver channelResolver) {
|
||||
this.channelResolver = channelResolver;
|
||||
}
|
||||
|
||||
public void setDefaultOutputChannel(MessageChannel defaultOutputChannel) {
|
||||
this.defaultOutputChannel = defaultOutputChannel;
|
||||
}
|
||||
@@ -147,10 +134,6 @@ public class RouterFactoryBean extends AbstractStandardMessageHandlerFactoryBean
|
||||
if (this.resolutionRequired != null) {
|
||||
router.setResolutionRequired(this.resolutionRequired);
|
||||
}
|
||||
if (this.channelResolver != null) {
|
||||
logger.warn("'channel-resolver' attribute has been deprecated in favor of using SpEL via 'expression' attribute");
|
||||
router.setChannelResolver(this.channelResolver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,7 +144,7 @@ public class RouterFactoryBean extends AbstractStandardMessageHandlerFactoryBean
|
||||
private boolean noRouterAttributesProvided() {
|
||||
return this.channelMappings == null && this.defaultOutputChannel == null
|
||||
&& this.timeout == null && this.resolutionRequired == null && this.applySequence == null
|
||||
&& this.ignoreSendFailures == null && this.channelResolver == null;
|
||||
&& this.ignoreSendFailures == null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -119,17 +119,6 @@ public abstract class AbstractOutboundChannelAdapterParser extends AbstractChann
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to control the registration process and return the bean name.
|
||||
* If parsing a bean definition whose name can be auto-generated, consider using
|
||||
* {@link #parseConsumer(Element, ParserContext)} instead.
|
||||
* @deprecated Use {@link #doParseAndRegisterConsumer(Element, ParserContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected String parseAndRegisterConsumer(Element element, ParserContext parserContext) {
|
||||
return doParseAndRegisterConsumer(element, parserContext).getBeanName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to control the registration process and return the bean name.
|
||||
* If parsing a bean definition whose name can be auto-generated, consider using
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* 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.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.xml.DomUtils;
|
||||
|
||||
/**
|
||||
* Base parser for routers.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public abstract class AbstractRouterParser extends AbstractConsumerEndpointParser {
|
||||
@@ -43,7 +43,6 @@ public abstract class AbstractRouterParser extends AbstractConsumerEndpointParse
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "resolution-required");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "apply-sequence");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-send-failures");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "channel-resolver");
|
||||
BeanDefinition targetRouterBeanDefinition = this.parseRouter(element, parserContext);
|
||||
builder.addPropertyValue("targetObject", targetRouterBeanDefinition);
|
||||
return builder;
|
||||
|
||||
@@ -83,19 +83,10 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
|
||||
Element dispatcherElement = DomUtils.getChildElementByTagName(element, "dispatcher");
|
||||
|
||||
// check for the dispatcher attribute (deprecated)
|
||||
String dispatcherAttribute = element.getAttribute("dispatcher");
|
||||
boolean hasDispatcherAttribute = StringUtils.hasText(dispatcherAttribute);
|
||||
if (hasDispatcherAttribute && logger.isWarnEnabled()) {
|
||||
logger.warn("The 'dispatcher' attribute on the 'channel' element is deprecated. "
|
||||
+ "Please use the 'dispatcher' sub-element instead.");
|
||||
}
|
||||
|
||||
// verify that a dispatcher is not provided if a queue sub-element exists
|
||||
if (queueElement != null && (dispatcherElement != null || hasDispatcherAttribute)) {
|
||||
if (queueElement != null && dispatcherElement != null) {
|
||||
parserContext.getReaderContext().error(
|
||||
"The 'dispatcher' attribute or sub-element " + "and any queue sub-element are mutually exclusive.",
|
||||
element);
|
||||
"The 'dispatcher' sub-element and any queue sub-element are mutually exclusive.", element);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -103,24 +94,7 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
return builder;
|
||||
}
|
||||
|
||||
if (dispatcherElement != null && hasDispatcherAttribute) {
|
||||
parserContext.getReaderContext().error(
|
||||
"The 'dispatcher' attribute and 'dispatcher' "
|
||||
+ "sub-element are mutually exclusive. NOTE: the attribute is DEPRECATED. "
|
||||
+ "Please use the dispatcher sub-element instead.", element);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (hasDispatcherAttribute) {
|
||||
// this attribute is deprecated, but if set, we need to create a DirectChannel
|
||||
// without any LoadBalancerStrategy and the failover flag set to true (default).
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
|
||||
if ("failover".equals(dispatcherAttribute)) {
|
||||
// round-robin dispatcher is used by default, the "failover" value simply disables it
|
||||
builder.addConstructorArgValue(null);
|
||||
}
|
||||
}
|
||||
else if (dispatcherElement == null) {
|
||||
if (dispatcherElement == null) {
|
||||
// configure the default DirectChannel with a RoundRobinLoadBalancingStrategy
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class JsonPropertyAccessor implements PropertyAccessor {
|
||||
/**
|
||||
* The kind of types this can work with.
|
||||
*/
|
||||
private static final Class<?>[] SUPPORTED_CLASSES = new Class[] { String.class, ToStringFriendlyJsonNode.class,
|
||||
private static final Class<?>[] SUPPORTED_CLASSES = new Class<?>[] { String.class, ToStringFriendlyJsonNode.class,
|
||||
ObjectNode.class, ArrayNode.class };
|
||||
|
||||
// Note: ObjectMapper is thread-safe
|
||||
|
||||
@@ -485,27 +485,6 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="dispatcher">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
This attribute is DEPRECATED. Please use the dispatcher sub-element
|
||||
instead.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="failover">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Enables failover, but disables load-balancing.
|
||||
See the dispatcher sub-element for more
|
||||
information.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="gateway">
|
||||
@@ -3195,20 +3174,6 @@
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="channel-resolver" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
[DEPRECATED]Provides a reference to a ChannelResolver that resolves the return value
|
||||
to the name of a MessageChannel within the application context. If none
|
||||
is provided, the return value is expected to match a channel name exactly.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.integration.support.channel.ChannelResolver" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="ignore-send-failures">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ChannelParserTests {
|
||||
public void channelWithFailoverDispatcherAttribute() throws Exception {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("channelParserTests.xml", this
|
||||
.getClass());
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channelWithFailoverAttribute");
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channelWithFailover");
|
||||
assertEquals(DirectChannel.class, channel.getClass());
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(channel);
|
||||
Object dispatcher = accessor.getPropertyValue("dispatcher");
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<channel id="dispatcherAttribute" dispatcher="failover"/>
|
||||
|
||||
<channel id="taskExecutorOnly">
|
||||
<dispatcher task-executor="taskExecutor"/>
|
||||
</channel>
|
||||
|
||||
@@ -28,10 +28,8 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.ExecutorChannel;
|
||||
@@ -54,20 +52,6 @@ public class DispatchingChannelParserTests {
|
||||
@Autowired
|
||||
private Map<String, MessageChannel> channels;
|
||||
|
||||
|
||||
@Test(expected = FatalBeanException.class)
|
||||
public void dispatcherAttributeAndSubElement() {
|
||||
new ClassPathXmlApplicationContext("dispatcherAttributeAndSubElement.xml", this.getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dispatcherAttribute() {
|
||||
MessageChannel channel = channels.get("dispatcherAttribute");
|
||||
assertEquals(DirectChannel.class, channel.getClass());
|
||||
assertTrue((Boolean) getDispatcherProperty("failover", channel));
|
||||
assertNull(getDispatcherProperty("loadBalancingStrategy", channel));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void taskExecutorOnly() {
|
||||
MessageChannel channel = channels.get("taskExecutorOnly");
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
</channel>
|
||||
|
||||
<channel id="defaultChannel" />
|
||||
|
||||
<channel id="channelWithFailoverAttribute" dispatcher="failover"/>
|
||||
|
||||
<channel id="channelWithFailover">
|
||||
<dispatcher failover="true" load-balancer="none"/>
|
||||
</channel>
|
||||
|
||||
<channel id="channelWithCustomQueue">
|
||||
<queue ref="customQueue"/>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
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">
|
||||
|
||||
<channel id="dispatcherAttributeAndSubElement" dispatcher="failover">
|
||||
<dispatcher/>
|
||||
</channel>
|
||||
|
||||
</beans:beans>
|
||||
@@ -19,9 +19,10 @@
|
||||
<channel id="channel4">
|
||||
<queue capacity="1" />
|
||||
</channel>
|
||||
|
||||
|
||||
<channel id="routingChannel" />
|
||||
<payload-type-router id="routerWithChannelResolver" input-channel="routingChannel" channel-resolver="cr">
|
||||
|
||||
<payload-type-router id="router" input-channel="routingChannel">
|
||||
<mapping type="java.lang.String" channel="channel1" />
|
||||
<mapping type="java.lang.Integer" channel="channel2" />
|
||||
<mapping type="java.lang.Number[]" channel="channel3" />
|
||||
@@ -32,5 +33,4 @@
|
||||
service-interface="org.springframework.integration.router.config.PayloadTypeRouterParserTests$TestService"
|
||||
default-request-channel="routingChannel" />
|
||||
|
||||
<beans:bean id="cr" class="org.springframework.integration.router.config.PayloadTypeRouterParserTests.MyChannelResolver"/>
|
||||
</beans:beans>
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PayloadTypeRouterParserTests {
|
||||
|
||||
@Autowired
|
||||
private TestService testService;
|
||||
|
||||
|
||||
@Test
|
||||
public void testPayloadTypeRouter() {
|
||||
context.start();
|
||||
@@ -68,12 +68,9 @@ public class PayloadTypeRouterParserTests {
|
||||
PollableChannel chanel3 = (PollableChannel) context.getBean("channel3");
|
||||
PollableChannel chanel4 = (PollableChannel) context.getBean("channel4");
|
||||
assertTrue(chanel1.receive(100).getPayload() instanceof String);
|
||||
assertTrue(chanel2.receive(100).getPayload() instanceof Integer);
|
||||
assertTrue(chanel3.receive(100).getPayload().getClass().isArray());
|
||||
assertTrue(chanel2.receive(100).getPayload() instanceof Integer);
|
||||
assertTrue(chanel3.receive(100).getPayload().getClass().isArray());
|
||||
assertTrue(chanel4.receive(100).getPayload().getClass().isArray());
|
||||
|
||||
EventDrivenConsumer edc = context.getBean("routerWithChannelResolver", EventDrivenConsumer.class);
|
||||
assertEquals(context.getBean("cr"), TestUtils.getPropertyValue(edc, "handler.channelResolver"));
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionStoreException.class)
|
||||
@@ -84,9 +81,9 @@ public class PayloadTypeRouterParserTests {
|
||||
reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
|
||||
reader.loadBeanDefinitions(new InputStreamResource(stream));
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private String routerConfigFakeType =
|
||||
private String routerConfigFakeType =
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
||||
"<beans:beans xmlns=\"http://www.springframework.org/schema/integration\"" +
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:beans=\"http://www.springframework.org/schema/beans\"" +
|
||||
@@ -99,8 +96,8 @@ public class PayloadTypeRouterParserTests {
|
||||
" <mapping type=\"FAKE_TYPE\" channel=\"channel1\" />" +
|
||||
" </payload-type-router>" +
|
||||
"</beans:beans>";
|
||||
|
||||
private String routerConfigNoMaping =
|
||||
|
||||
private String routerConfigNoMaping =
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
||||
"<beans:beans xmlns=\"http://www.springframework.org/schema/integration\"" +
|
||||
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:beans=\"http://www.springframework.org/schema/beans\"" +
|
||||
@@ -117,5 +114,4 @@ public class PayloadTypeRouterParserTests {
|
||||
public void foo(Message<?> message);
|
||||
}
|
||||
|
||||
public static class MyChannelResolver extends BeanFactoryChannelResolver{}
|
||||
}
|
||||
|
||||
@@ -677,7 +677,8 @@ public class ParserUnitTests {
|
||||
|
||||
TcpConnectionSupport connection = mock(TcpConnectionSupport.class);
|
||||
TcpConnectionEvent event = new TcpConnectionOpenEvent(connection, "foo");
|
||||
this.eventAdapter.setEventTypes(new Class[] {TcpConnectionEvent.class});
|
||||
Class<TcpConnectionEvent>[] types = (Class<TcpConnectionEvent>[]) new Class<?>[]{TcpConnectionEvent.class};
|
||||
this.eventAdapter.setEventTypes(types);
|
||||
this.eventAdapter.onApplicationEvent(event);
|
||||
assertNull(this.eventChannel.receive(0));
|
||||
this.eventAdapter.start();
|
||||
|
||||
@@ -236,7 +236,7 @@ public class TcpOutboundGatewayTests {
|
||||
gateway.setRequiresReply(true);
|
||||
gateway.setOutputChannel(replyChannel);
|
||||
@SuppressWarnings("unchecked")
|
||||
Future<Integer>[] results = new Future[2];
|
||||
Future<Integer>[] results = (Future<Integer>[]) new Future<?>[2];
|
||||
for (int i = 0; i < 2; i++) {
|
||||
final int j = i;
|
||||
results[j] = (Executors.newSingleThreadExecutor().submit(new Callable<Integer>(){
|
||||
@@ -364,7 +364,7 @@ public class TcpOutboundGatewayTests {
|
||||
gateway.setOutputChannel(replyChannel);
|
||||
gateway.setRemoteTimeout(500);
|
||||
@SuppressWarnings("unchecked")
|
||||
Future<Integer>[] results = new Future[2];
|
||||
Future<Integer>[] results = (Future<Integer>[]) new Future<?>[2];
|
||||
for (int i = 0; i < 2; i++) {
|
||||
final int j = i;
|
||||
results[j] = (Executors.newSingleThreadExecutor().submit(new Callable<Integer>() {
|
||||
|
||||
@@ -65,7 +65,8 @@ public class TcpConnectionEventListenerTests {
|
||||
TcpConnectionEventListeningMessageProducer eventProducer = new TcpConnectionEventListeningMessageProducer();
|
||||
QueueChannel outputChannel = new QueueChannel();
|
||||
eventProducer.setOutputChannel(outputChannel);
|
||||
eventProducer.setEventTypes(new Class[] {FooEvent.class, BarEvent.class});
|
||||
Class<?>[] eventTypes = new Class<?>[]{FooEvent.class, BarEvent.class};
|
||||
eventProducer.setEventTypes((Class<? extends TcpConnectionEvent>[]) eventTypes);
|
||||
eventProducer.afterPropertiesSet();
|
||||
eventProducer.start();
|
||||
TcpConnectionSupport connection = Mockito.mock(TcpConnectionSupport.class);
|
||||
|
||||
@@ -94,9 +94,9 @@ public class TcpNioConnectionReadTests {
|
||||
assertTrue(semaphore.tryAcquire(1, 10000, TimeUnit.MILLISECONDS));
|
||||
assertEquals("Did not receive data", 2, responses.size());
|
||||
assertEquals("Data", SocketTestUtils.TEST_STRING + SocketTestUtils.TEST_STRING,
|
||||
new String(((Message<byte[]>) responses.get(0)).getPayload()));
|
||||
new String((byte[]) responses.get(0).getPayload()));
|
||||
assertEquals("Data", SocketTestUtils.TEST_STRING + SocketTestUtils.TEST_STRING,
|
||||
new String(((Message<byte[]>) responses.get(1)).getPayload()));
|
||||
new String((byte[]) responses.get(1).getPayload()));
|
||||
scf.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -490,19 +490,6 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
this.usePayloadAsParameterSource = usePayloadAsParameterSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether a Stored Procedure or a Function is being executed.
|
||||
* The default value is false.
|
||||
*
|
||||
* @param isFunction If set to true an Sql Function is executed rather than a Stored Procedure.
|
||||
*
|
||||
* @deprecated Please use {@link #setIsFunction(boolean)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setFunction(boolean isFunction) {
|
||||
this.isFunction = isFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether a Stored Procedure or a Function is being executed.
|
||||
* The default value is false.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* 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
|
||||
@@ -13,19 +13,12 @@
|
||||
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.handler.AbstractMessageHandler;
|
||||
import org.springframework.integration.jdbc.storedproc.ProcedureParameter;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcCallOperations;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
@@ -55,27 +48,6 @@ public class StoredProcMessageHandler extends AbstractMessageHandler implements
|
||||
|
||||
private final StoredProcExecutor executor;
|
||||
|
||||
/**
|
||||
* Constructor taking {@link DataSource} from which the DB Connection can be
|
||||
* obtained and the name of the stored procedure or function to
|
||||
* execute to retrieve new rows.
|
||||
*
|
||||
* @param dataSource Must not be null.
|
||||
* @param storedProcedureName The name of the Stored Procedure or Function. Must not be null.
|
||||
*
|
||||
* @deprecated Since 2.2 use the constructor that expects a {@link StoredProcExecutor} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public StoredProcMessageHandler(DataSource dataSource, String storedProcedureName) {
|
||||
|
||||
Assert.notNull(dataSource, "dataSource must not be null.");
|
||||
Assert.hasText(storedProcedureName, "storedProcedureName must not be null and cannot be empty.");
|
||||
|
||||
this.executor = new StoredProcExecutor(dataSource);
|
||||
this.executor.setStoredProcedureName(storedProcedureName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Constructor passing in the {@link StoredProcExecutor}.
|
||||
@@ -84,22 +56,11 @@ public class StoredProcMessageHandler extends AbstractMessageHandler implements
|
||||
*
|
||||
*/
|
||||
public StoredProcMessageHandler(StoredProcExecutor storedProcExecutor) {
|
||||
|
||||
Assert.notNull(storedProcExecutor, "storedProcExecutor must not be null.");
|
||||
this.executor = storedProcExecutor;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies parameters, sets the parameters on {@link SimpleJdbcCallOperations}
|
||||
* and ensures the appropriate {@link SqlParameterSourceFactory} is defined
|
||||
* when {@link ProcedureParameter} are passed in.
|
||||
*/
|
||||
@Override
|
||||
protected void onInit() throws Exception {
|
||||
super.onInit();
|
||||
};
|
||||
|
||||
/**
|
||||
* Executes the Stored procedure, delegates to executeStoredProcedure(...).
|
||||
* Any return values from the Stored procedure are ignored.
|
||||
@@ -115,121 +76,11 @@ public class StoredProcMessageHandler extends AbstractMessageHandler implements
|
||||
|
||||
if (resultMap != null && !resultMap.isEmpty()) {
|
||||
logger.debug(String.format("The StoredProcMessageHandler ignores return "
|
||||
+ "values, but the called Stored Procedure returned data: '%s'", executor.getStoredProcedureName(), resultMap));
|
||||
+ "values, but the called Stored Procedure '%s' returned data: '%s'", executor.getStoredProcedureName(), resultMap));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the Stored Procedure or Stored Function to be executed.
|
||||
* If {@link StoredProcExecutor#isFunction} is set to "true", then this
|
||||
* property specifies the Stored Function name.
|
||||
*
|
||||
* Alternatively you can also specify the Stored Procedure name via
|
||||
* {@link StoredProcExecutor#setStoredProcedureNameExpression(Expression)}.
|
||||
*
|
||||
* @param storedProcedureName Must not be null and must not be empty
|
||||
*
|
||||
* @see StoredProcExecutor#setStoredProcedureNameExpression(Expression)
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setStoredProcedureName(String)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setStoredProcedureName(String storedProcedureName) {
|
||||
this.executor.setStoredProcedureName(storedProcedureName);
|
||||
}
|
||||
|
||||
/**
|
||||
* For fully supported databases, the underlying {@link SimpleJdbcCall} can
|
||||
* retrieve the parameter information for the to be invoked Stored Procedure
|
||||
* from the JDBC Meta-data. However, if the used database does not support
|
||||
* meta data lookups or if you like to provide customized parameter definitions,
|
||||
* this flag can be set to <code>true</code>. It defaults to <code>false</code>.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setIgnoreColumnMetaData(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setIgnoreColumnMetaData(boolean ignoreColumnMetaData) {
|
||||
this.executor.setIgnoreColumnMetaData(ignoreColumnMetaData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Stored Procedure parameters that may contain static values
|
||||
* or Strings representing an {@link Expression}.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setProcedureParameters(List)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setProcedureParameters(List<ProcedureParameter> procedureParameters) {
|
||||
this.executor.setProcedureParameters(procedureParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* If your database system is not fully supported by Spring and thus obtaining
|
||||
* parameter definitions from the JDBC Meta-data is not possible, you must define
|
||||
* the {@link SqlParameter} explicitly.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSqlParameters(List)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSqlParameters(List<SqlParameter> sqlParameters) {
|
||||
this.executor.setSqlParameters(sqlParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the ability to set a custom {@link SqlParameterSourceFactory}.
|
||||
* Keep in mind that if {@link ProcedureParameter} are set explicitly and
|
||||
* you would like to provide a custom {@link SqlParameterSourceFactory},
|
||||
* then you must provide an instance of {@link ExpressionEvaluatingSqlParameterSourceFactory}.
|
||||
*
|
||||
* If not the SqlParameterSourceFactory will be replaced by the default
|
||||
* {@link ExpressionEvaluatingSqlParameterSourceFactory}.
|
||||
*
|
||||
* @param sqlParameterSourceFactory
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSqlParameterSourceFactory(SqlParameterSourceFactory)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
|
||||
this.executor.setSqlParameterSourceFactory(sqlParameterSourceFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* If set to 'true', the payload of the Message will be used as a source for
|
||||
* providing parameters. If false the entire Message will be available as a
|
||||
* source for parameters.
|
||||
*
|
||||
* If no {@link ProcedureParameter} are passed in, this property will default to
|
||||
* 'true'. This means that using a default {@link BeanPropertySqlParameterSourceFactory}
|
||||
* the bean properties of the payload will be used as a source for parameter values for
|
||||
* the to-be-executed Stored Procedure or Function.
|
||||
*
|
||||
* However, if {@link ProcedureParameter} are passed in, then this property
|
||||
* will by default evaluate to 'false'. {@link ProcedureParameter} allow for
|
||||
* SpEl Expressions to be provided and therefore it is highly beneficial to
|
||||
* have access to the entire {@link Message}.
|
||||
*
|
||||
* @param usePayloadAsParameterSource If false the entire {@link Message} is used as parameter source.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setUsePayloadAsParameterSource(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setUsePayloadAsParameterSource(boolean usePayloadAsParameterSource) {
|
||||
this.executor.setUsePayloadAsParameterSource(usePayloadAsParameterSource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,24 +17,13 @@
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.jdbc.storedproc.ProcedureParameter;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.core.SqlOutParameter;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcCallOperations;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -48,27 +37,6 @@ public class StoredProcOutboundGateway extends AbstractReplyProducingMessageHand
|
||||
|
||||
private volatile boolean expectSingleResult = false;
|
||||
|
||||
/**
|
||||
* Constructor taking {@link DataSource} from which the DB Connection can be
|
||||
* obtained and the name of the stored procedure or function to
|
||||
* execute to retrieve new rows.
|
||||
*
|
||||
* @param dataSource used to create a {@link SimpleJdbcCall} instance
|
||||
* @param storedProcedureName Must not be null.
|
||||
*
|
||||
* @deprecated Since 2.2 use the constructor that expects a {@link StoredProcExecutor} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public StoredProcOutboundGateway(DataSource dataSource, String storedProcedureName) {
|
||||
|
||||
Assert.notNull(dataSource, "dataSource must not be null.");
|
||||
Assert.hasText(storedProcedureName, "storedProcedureName must not be null and cannot be empty.");
|
||||
|
||||
this.executor = new StoredProcExecutor(dataSource);
|
||||
this.executor.setStoredProcedureName(storedProcedureName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor taking {@link StoredProcExecutor}.
|
||||
*
|
||||
@@ -82,15 +50,6 @@ public class StoredProcOutboundGateway extends AbstractReplyProducingMessageHand
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies parameters, sets the parameters on {@link SimpleJdbcCallOperations}
|
||||
* and ensures the appropriate {@link SqlParameterSourceFactory} is defined
|
||||
* when {@link ProcedureParameter} are passed in.
|
||||
*/
|
||||
@Override
|
||||
protected void doInit() {
|
||||
};
|
||||
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
|
||||
@@ -123,136 +82,6 @@ public class StoredProcOutboundGateway extends AbstractReplyProducingMessageHand
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the Stored Procedure or Stored Function to be executed.
|
||||
* If {@link StoredProcExecutor#isFunction} is set to "true", then this
|
||||
* property specifies the Stored Function name.
|
||||
*
|
||||
* Alternatively you can also specify the Stored Procedure name via
|
||||
* {@link StoredProcExecutor#setStoredProcedureNameExpression(Expression)}.
|
||||
*
|
||||
* @param storedProcedureName Must not be null and must not be empty
|
||||
*
|
||||
* @see StoredProcExecutor#setStoredProcedureNameExpression(Expression)
|
||||
* @see StoredProcExecutor#setStoredProcedureName(String)
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public void setStoredProcedureName(String storedProcedureName) {
|
||||
this.executor.setStoredProcedureName(storedProcedureName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicit declarations are necessary if the database you use is not a
|
||||
* Spring-supported database. Currently Spring supports metadata lookup of
|
||||
* stored procedure calls for the following databases:
|
||||
*
|
||||
* <ul>
|
||||
* <li>Apache Derby</li>
|
||||
* <li>DB2</li>
|
||||
* <li>MySQL</li>
|
||||
* <li>Microsoft SQL Server</li>
|
||||
* <li>Oracle</li>
|
||||
* <li>Sybase</li>
|
||||
* <li>PostgreSQL</li>
|
||||
* </ul>
|
||||
* , ,
|
||||
* We also support metadata lookup of stored functions for the following
|
||||
* databases:
|
||||
*
|
||||
* <ul>
|
||||
* <li>MySQL</li>
|
||||
* <li>Microsoft SQL Server</li>
|
||||
* <li>Oracle</li>
|
||||
* <li>PostgreSQL</li>
|
||||
* </ul>
|
||||
*
|
||||
* See also: http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/jdbc.html
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSqlParameters(List)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSqlParameters(List<SqlParameter> sqlParameters) {
|
||||
this.executor.setSqlParameters(sqlParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does your stored procedure return one or more result sets? If so, you
|
||||
* can use the provided method for setting the respective RowMappers.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setReturningResultSetRowMappers(Map)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setReturningResultSetRowMappers(
|
||||
Map<String, RowMapper<?>> returningResultSetRowMappers) {
|
||||
this.executor.setReturningResultSetRowMappers(returningResultSetRowMappers);
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, the JDBC parameter definitions for the stored procedure are not
|
||||
* automatically derived from the underlying JDBC connection. In that case
|
||||
* you must pass in {@link SqlParameter} explicitly..
|
||||
*
|
||||
* @param ignoreColumnMetaData Defaults to <code>false</code>.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setIgnoreColumnMetaData(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setIgnoreColumnMetaData(boolean ignoreColumnMetaData) {
|
||||
this.executor.setIgnoreColumnMetaData(ignoreColumnMetaData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the procedure's return value should be included in the results
|
||||
* returned.
|
||||
*
|
||||
* @param returnValueRequired
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setReturnValueRequired(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setReturnValueRequired(boolean returnValueRequired) {
|
||||
this.executor.setReturnValueRequired(returnValueRequired);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Stored Procedure parameters that may contain static values
|
||||
* or Strings representing an {@link Expression}.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setProcedureParameters(List)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setProcedureParameters(List<ProcedureParameter> procedureParameters) {
|
||||
this.executor.setProcedureParameters(procedureParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether a Stored Procedure or a Function is being executed.
|
||||
* The default value is false.
|
||||
*
|
||||
* @param isFunction If set to true an Sql Function is executed rather than a Stored Procedure.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setIsFunction(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setIsFunction(boolean isFunction) {
|
||||
this.executor.setIsFunction(isFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* This parameter indicates that only one result object shall be returned from
|
||||
* the Stored Procedure/Function Call. If set to true, a resultMap that contains
|
||||
@@ -277,73 +106,4 @@ public class StoredProcOutboundGateway extends AbstractReplyProducingMessageHand
|
||||
this.expectSingleResult = expectSingleResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the ability to set a custom {@link SqlParameterSourceFactory}.
|
||||
* Keep in mind that if {@link ProcedureParameter} are set explicitly and
|
||||
* you would like to provide a custom {@link SqlParameterSourceFactory},
|
||||
* then you must provide an instance of {@link ExpressionEvaluatingSqlParameterSourceFactory}.
|
||||
*
|
||||
* If not the SqlParameterSourceFactory will be replaced by the default
|
||||
* {@link ExpressionEvaluatingSqlParameterSourceFactory}.
|
||||
*
|
||||
* @param sqlParameterSourceFactory
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSqlParameterSourceFactory(SqlParameterSourceFactory)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
|
||||
this.executor.setSqlParameterSourceFactory(sqlParameterSourceFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* If set to 'true', the payload of the Message will be used as a source for
|
||||
* providing parameters. If false the entire Message will be available as a
|
||||
* source for parameters.
|
||||
*
|
||||
* If no {@link ProcedureParameter} are passed in, this property will default to
|
||||
* 'true'. This means that using a default {@link BeanPropertySqlParameterSourceFactory}
|
||||
* the bean properties of the payload will be used as a source for parameter values for
|
||||
* the to-be-executed Stored Procedure or Function.
|
||||
*
|
||||
* However, if {@link ProcedureParameter} are passed in, then this property
|
||||
* will by default evaluate to 'false'. {@link ProcedureParameter} allow for
|
||||
* SpEl Expressions to be provided and therefore it is highly beneficial to
|
||||
* have access to the entire {@link Message}.
|
||||
*
|
||||
* @param usePayloadAsParameterSource If false the entire {@link Message} is used as parameter source.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setUsePayloadAsParameterSource(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setUsePayloadAsParameterSource(boolean usePayloadAsParameterSource) {
|
||||
this.executor.setUsePayloadAsParameterSource(usePayloadAsParameterSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this variable is set to <code>true</code> then all results from a stored
|
||||
* procedure call that don't have a corresponding {@link SqlOutParameter}
|
||||
* declaration will be bypassed.
|
||||
*
|
||||
* E.g. Stored Procedures may return an update count value, even though your
|
||||
* Stored Procedure only declared a single result parameter. The exact behavior
|
||||
* depends on the used database.
|
||||
*
|
||||
* The value is set on the underlying {@link JdbcTemplate}.
|
||||
*
|
||||
* Only few developers will probably ever like to process update counts, thus
|
||||
* the value defaults to <code>true</code>.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSkipUndeclaredResults(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSkipUndeclaredResults(boolean skipUndeclaredResults) {
|
||||
this.executor.setSkipUndeclaredResults(skipUndeclaredResults);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,23 +16,13 @@
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.context.IntegrationObjectSupport;
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.jdbc.storedproc.ProcedureParameter;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.core.SqlOutParameter;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -50,26 +40,6 @@ public class StoredProcPollingChannelAdapter extends IntegrationObjectSupport im
|
||||
|
||||
private volatile boolean expectSingleResult = false;
|
||||
|
||||
/**
|
||||
* Constructor taking {@link DataSource} from which the DB Connection can be
|
||||
* obtained and the stored procedure name to execute.
|
||||
*
|
||||
* @param dataSource used to create a {@link SimpleJdbcCall}
|
||||
* @param storedProcedureName Name of the Stored Procedure or Function to execute
|
||||
*
|
||||
* @deprecated Since 2.2 use the constructor that expects a {@link StoredProcExecutor} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public StoredProcPollingChannelAdapter(DataSource dataSource, String storedProcedureName) {
|
||||
|
||||
Assert.notNull(dataSource, "dataSource must not be null.");
|
||||
Assert.hasText(storedProcedureName, "storedProcedureName must not be null and cannot be empty.");
|
||||
|
||||
this.executor = new StoredProcExecutor(dataSource);
|
||||
this.executor.setStoredProcedureName(storedProcedureName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor taking {@link StoredProcExecutor}.
|
||||
*
|
||||
@@ -83,11 +53,6 @@ public class StoredProcPollingChannelAdapter extends IntegrationObjectSupport im
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() throws Exception {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the query. If a query result set contains one or more rows, the
|
||||
* Message payload will contain either a List of Maps for each row or, if a
|
||||
@@ -146,154 +111,6 @@ public class StoredProcPollingChannelAdapter extends IntegrationObjectSupport im
|
||||
return "stored-proc:inbound-channel-adapter";
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the Stored Procedure or Stored Function to be executed.
|
||||
* If {@link StoredProcExecutor#isFunction} is set to "true", then this
|
||||
* property specifies the Stored Function name.
|
||||
*
|
||||
* Alternatively you can also specify the Stored Procedure name via
|
||||
* {@link StoredProcExecutor#setStoredProcedureNameExpression(Expression)}.
|
||||
*
|
||||
* @param storedProcedureName Must not be null and must not be empty
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setStoredProcedureName(String)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setStoredProcedureName(String storedProcedureName) {
|
||||
this.executor.setStoredProcedureName(storedProcedureName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the ability to set a custom {@link SqlParameterSourceFactory}.
|
||||
* Keep in mind that if {@link ProcedureParameter} are set explicitly and
|
||||
* you would like to provide a custom {@link SqlParameterSourceFactory},
|
||||
* then you must provide an instance of {@link ExpressionEvaluatingSqlParameterSourceFactory}.
|
||||
*
|
||||
* If not the SqlParameterSourceFactory will be replaced by the default
|
||||
* {@link ExpressionEvaluatingSqlParameterSourceFactory}.
|
||||
*
|
||||
* @param sqlParameterSourceFactory
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSqlParameterSourceFactory(SqlParameterSourceFactory)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSqlParameterSourceFactory(SqlParameterSourceFactory sqlParameterSourceFactory) {
|
||||
this.executor.setSqlParameterSourceFactory(sqlParameterSourceFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicit declarations are necessary if the database you use is not a
|
||||
* Spring-supported database. Currently Spring supports metadata lookup of
|
||||
* stored procedure calls for the following databases:
|
||||
*
|
||||
* <ul>
|
||||
* <li>Apache Derby</li>
|
||||
* <li>DB2</li>
|
||||
* <li>MySQL</li>
|
||||
* <li>Microsoft SQL Server</li>
|
||||
* <li>Oracle</li>
|
||||
* <li>Sybase</li>
|
||||
* <li>PostgreSQL</li>
|
||||
* </ul>
|
||||
* , ,
|
||||
* We also support metadata lookup of stored functions for the following
|
||||
* databases:
|
||||
*
|
||||
* <ul>
|
||||
* <li>MySQL</li>
|
||||
* <li>Microsoft SQL Server</li>
|
||||
* <li>Oracle</li>
|
||||
* <li>PostgreSQL</li>
|
||||
* </ul>
|
||||
*
|
||||
* See also: http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/jdbc.html
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSqlParameters(List)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSqlParameters(List<SqlParameter> sqlParameters) {
|
||||
this.executor.setSqlParameters(sqlParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does your stored procedure return one or more result sets? If so, you
|
||||
* can use the provided method for setting the respective Rowmappers.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setReturningResultSetRowMappers(Map)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setReturningResultSetRowMappers(
|
||||
Map<String, RowMapper<?>> returningResultSetRowMappers) {
|
||||
this.executor.setReturningResultSetRowMappers(returningResultSetRowMappers);
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, the JDBC parameter definitions for the stored procedure are not
|
||||
* automatically derived from the underlying JDBC connection. In that case
|
||||
* you must pass in {@link SqlParameter} explicitly..
|
||||
*
|
||||
* @param ignoreColumnMetaData Defaults to <code>false</code>.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setIgnoreColumnMetaData(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setIgnoreColumnMetaData(boolean ignoreColumnMetaData) {
|
||||
this.executor.setIgnoreColumnMetaData(ignoreColumnMetaData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the procedure's return value should be included in the results
|
||||
* returned.
|
||||
*
|
||||
* @param returnValueRequired
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setReturnValueRequired(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setReturnValueRequired(boolean returnValueRequired) {
|
||||
this.executor.setReturnValueRequired(returnValueRequired);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Stored Procedure parameters that may contain static values
|
||||
* or Strings representing an {@link Expression}.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setProcedureParameters(List)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setProcedureParameters(List<ProcedureParameter> procedureParameters) {
|
||||
this.executor.setProcedureParameters(procedureParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether a Stored Procedure or a Function is being executed.
|
||||
* The default value is false.
|
||||
*
|
||||
* @param isFunction If set to true an Sql Function is executed rather than a Stored Procedure.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setIsFunction(boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setFunction(boolean isFunction) {
|
||||
this.executor.setIsFunction(isFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* This parameter indicates that only one result object shall be returned from
|
||||
* the Stored Procedure/Function Call. If set to true, a resultMap that contains
|
||||
@@ -318,28 +135,4 @@ public class StoredProcPollingChannelAdapter extends IntegrationObjectSupport im
|
||||
this.expectSingleResult = expectSingleResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this variable is set to <code>true</code> then all results from a stored
|
||||
* procedure call that don't have a corresponding {@link SqlOutParameter}
|
||||
* declaration will be bypassed.
|
||||
*
|
||||
* E.g. Stored Procedures may return an update count value, even though your
|
||||
* Stored Procedure only declared a single result parameter. The exact behavior
|
||||
* depends on the used database.
|
||||
*
|
||||
* The value is set on the underlying {@link JdbcTemplate}.
|
||||
*
|
||||
* Only few developers will probably ever like to process update counts, thus
|
||||
* the value defaults to <code>true</code>.
|
||||
*
|
||||
* @deprecated Since 2.2 set the respective property on the passed-in {@link StoredProcExecutor}
|
||||
*
|
||||
* @see StoredProcExecutor#setSkipUndeclaredResults(boolean)
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSkipUndeclaredResults(boolean skipUndeclaredResults) {
|
||||
this.executor.setSkipUndeclaredResults(skipUndeclaredResults);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<bean id="storedProcExecutor" class="org.springframework.integration.jdbc.StoredProcExecutor">
|
||||
<constructor-arg name="dataSource" ref="dataSource" />
|
||||
<property name="storedProcedureName" value="GET_PRIME_NUMBERS"/>
|
||||
<property name="function" value="false"/>
|
||||
<property name="isFunction" value="false"/>
|
||||
<property name="procedureParameters" >
|
||||
<util:list>
|
||||
<bean class="org.springframework.integration.jdbc.storedproc.ProcedureParameter">
|
||||
|
||||
@@ -268,6 +268,4 @@ public class XPathRouterParserTests {
|
||||
}
|
||||
}
|
||||
|
||||
public static class MyChannelResolver extends BeanFactoryChannelResolver{}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,34 +8,34 @@
|
||||
http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd">
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterEmpty" input-channel="xpathRouterEmptyChannel">
|
||||
<int-xml:xpath-expression expression="/name"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterAsString" input-channel="xpathStringChannel" evaluate-as-string="true">
|
||||
<int-xml:xpath-expression expression="name(./node())"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterWithMapping" input-channel="xpathRouterWithMappingChannel">
|
||||
<int-xml:xpath-expression expression="/name"/>
|
||||
<int-xml:mapping value="channelA" channel="channelB"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterWithMappingMultiChannel" input-channel="multiChannelRouterChannel">
|
||||
<int-xml:xpath-expression expression="/root/name" />
|
||||
<int-xml:mapping value="channelA" channel="channelA"/>
|
||||
<int-xml:mapping value="channelB" channel="channelA"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterWithCustomConverter"
|
||||
input-channel="customConverterChannel" evaluate-as-string="true"
|
||||
converter="testConverter" channel-resolver="cr">
|
||||
<int-xml:xpath-router id="xpathRouterAsString" input-channel="xpathStringChannel" evaluate-as-string="true">
|
||||
<int-xml:xpath-expression expression="name(./node())"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterWithMapping" input-channel="xpathRouterWithMappingChannel">
|
||||
<int-xml:xpath-expression expression="/name"/>
|
||||
<int-xml:mapping value="channelA" channel="channelB"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterWithMappingMultiChannel" input-channel="multiChannelRouterChannel">
|
||||
<int-xml:xpath-expression expression="/root/name" />
|
||||
<int-xml:mapping value="channelA" channel="channelA"/>
|
||||
<int-xml:mapping value="channelB" channel="channelA"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
<int-xml:xpath-router id="xpathRouterWithCustomConverter"
|
||||
input-channel="customConverterChannel" evaluate-as-string="true"
|
||||
converter="testConverter">
|
||||
<int-xml:xpath-expression expression="/name"/>
|
||||
</int-xml:xpath-router>
|
||||
|
||||
|
||||
<int:channel id="channelA">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
|
||||
<int:channel id="channelB">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
@@ -46,5 +46,4 @@
|
||||
|
||||
<bean id="testConverter" class="org.springframework.integration.xml.config.XPathRouterParserTests$TestXmlPayloadConverter"/>
|
||||
|
||||
<bean id="cr" class="org.springframework.integration.xml.config.XPathRouterParserTests.MyChannelResolver"/>
|
||||
</beans>
|
||||
|
||||
@@ -33,22 +33,10 @@ public class XmppHeaders {
|
||||
|
||||
public static final String TO = PREFIX + "to";
|
||||
|
||||
/**
|
||||
* {@link Deprecated} use {@link #TO} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String CHAT_TO = TO;
|
||||
|
||||
public static final String FROM = PREFIX + "from";
|
||||
|
||||
public static final String THREAD = PREFIX + "thread";
|
||||
|
||||
/**
|
||||
* {@link Deprecated} use {@link #THREAD} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String CHAT_THREAD_ID = THREAD;
|
||||
|
||||
public static final String SUBJECT = PREFIX + "subject";
|
||||
|
||||
public static final String TYPE = PREFIX + "type";
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.integration.xmpp.core;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.endpoint.MessageProducerSupport;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -43,15 +42,6 @@ public abstract class AbstractXmppConnectionAwareEndpoint extends MessageProduce
|
||||
this.xmppConnection = xmppConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Deprecated} This method will be eligible for removal in 2.1.
|
||||
* Use {@link #setOutputChannel(MessageChannel)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setRequestChannel(MessageChannel requestChannel) {
|
||||
this.setOutputChannel(requestChannel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
|
||||
Reference in New Issue
Block a user