Merge remote-tracking branch 'upstream/master' into 4.0.0-WIP
Conflicts: build.gradle gradle.properties spring-integration-core/src/main/java/org/springframework/integration/config/RouterFactoryBean.java spring-integration-core/src/test/java/org/springframework/integration/channel/config/DispatchingChannelParserTests.java spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java spring-integration-core/src/test/java/org/springframework/integration/router/config/PayloadTypeRouterParserTests.java spring-integration-core/src/test/java/org/springframework/integration/transformer/MessageTransformingChannelInterceptorTests.java spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/ConnectionFactoryShutDownTests.java spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionReadTests.java spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/DatagramPacketSendingHandlerTests.java spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/MultiClientTests.java spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/UdpChannelAdapterTests.java spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcMessageHandler.java spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcOutboundGateway.java spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapter.java spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/core/AbstractXmppConnectionAwareEndpoint.java Resolved.
This commit is contained in:
@@ -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.messaging.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.messaging.Message;
|
||||
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.messaging.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.messaging.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.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
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.messaging.Message;
|
||||
import org.springframework.messaging.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.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
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
|
||||
@@ -142,158 +107,11 @@ public class StoredProcPollingChannelAdapter extends IntegrationObjectSupport im
|
||||
return this.executor.executeStoredProcedure();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentType(){
|
||||
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 +136,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">
|
||||
|
||||
Reference in New Issue
Block a user