Use jndi name for parameter metadata cache key when URL is null

master
Vitaliy Filippov 2015-12-18 18:15:48 +03:00
parent b4ea34f05e
commit b73094216d
3 changed files with 83 additions and 193 deletions

View File

@ -108,7 +108,7 @@ public class JDBCDenormalizer {
* @throws MessagingException * @throws MessagingException
*/ */
protected void denormalizeOutbound(final NormalizedMessage normalizedMessage, protected void denormalizeOutbound(final NormalizedMessage normalizedMessage,
String dbName, final OperationMetaData opMetaData, final PreparedStatement ps) String dbName, final String jndiName, final OperationMetaData opMetaData, final PreparedStatement ps)
throws MessagingException { throws MessagingException {
if (opMetaData != null) { if (opMetaData != null) {
final JDBCOperationInput mJdbcOperationInput = opMetaData. final JDBCOperationInput mJdbcOperationInput = opMetaData.
@ -120,7 +120,7 @@ public class JDBCDenormalizer {
Element element = Element element =
transformMessage(normalizedMessage, opMetaData); transformMessage(normalizedMessage, opMetaData);
if (element != null) if (element != null)
populatePreparedStatement(element, dbName, opMetaData, ps); populatePreparedStatement(element, dbName, jndiName, opMetaData, ps);
} catch (final SQLException ex) { } catch (final SQLException ex) {
final String msg = final String msg =
JDBCDenormalizer.mMessages.getString( JDBCDenormalizer.mMessages.getString(
@ -147,7 +147,7 @@ public class JDBCDenormalizer {
* @throws MessagingException * @throws MessagingException
*/ */
protected void denormalizeOutboundProc(final NormalizedMessage normalizedMessage, protected void denormalizeOutboundProc(final NormalizedMessage normalizedMessage,
final OperationMetaData opMetaData, final DatabaseMetaData dbmeta, final CallableStatement cs) final OperationMetaData opMetaData, final DatabaseMetaData dbmeta, final String jndiName, final CallableStatement cs)
throws MessagingException { throws MessagingException {
if (opMetaData != null) { if (opMetaData != null) {
final SPOperationInput mJdbcOperationInput = opMetaData. final SPOperationInput mJdbcOperationInput = opMetaData.
@ -158,7 +158,7 @@ public class JDBCDenormalizer {
Element element = Element element =
transformMessage(normalizedMessage, opMetaData); transformMessage(normalizedMessage, opMetaData);
if (element != null) if (element != null)
populateProcedure(element, opMetaData, dbmeta, cs); populateProcedure(element, opMetaData, dbmeta, jndiName, cs);
} catch (final SQLException ex) { } catch (final SQLException ex) {
final String msg = final String msg =
JDBCDenormalizer.mMessages.getString( JDBCDenormalizer.mMessages.getString(
@ -186,7 +186,7 @@ public class JDBCDenormalizer {
*/ */
@SuppressWarnings("empty-statement") @SuppressWarnings("empty-statement")
private void populateProcedure(final Element tableElem, private void populateProcedure(final Element tableElem,
final OperationMetaData opMetaData, final DatabaseMetaData dbmeta, CallableStatement cs) final OperationMetaData opMetaData, final DatabaseMetaData dbmeta, final String jndiName, CallableStatement cs)
throws SQLException, MessagingException, Exception { throws SQLException, MessagingException, Exception {
final SPOperationInput jdbcSql = opMetaData.getJDBCSPOperationInput(); final SPOperationInput jdbcSql = opMetaData.getJDBCSPOperationInput();
driverName_ = dbmeta.getDriverName(); driverName_ = dbmeta.getDriverName();
@ -206,7 +206,9 @@ public class JDBCDenormalizer {
mLogger.log(Level.INFO, JDBCDenormalizer.mMessages.getString( mLogger.log(Level.INFO, JDBCDenormalizer.mMessages.getString(
"DBBC_R00716.JDBCDN_StartPopulateProc")); "DBBC_R00716.JDBCDN_StartPopulateProc"));
if (jdbcSql != null) { if (jdbcSql != null) {
final String dbURL = dbmeta.getURL(); String dbURL = dbmeta.getURL();
if (dbURL == null)
dbURL = "jndi:"+jndiName;
ParamMetadataCache paramsCache = ParamMetadataCache.instance(); ParamMetadataCache paramsCache = ParamMetadataCache.instance();
ArrayList<CachedQueryParameter> params = paramsCache.getMetadata( ArrayList<CachedQueryParameter> params = paramsCache.getMetadata(
dbURL, opMetaData); dbURL, opMetaData);
@ -409,7 +411,7 @@ public class JDBCDenormalizer {
* @throws MessagingException * @throws MessagingException
* @throws Exception * @throws Exception
*/ */
private void populatePreparedStatement(final Element tableElem, String dbName, private void populatePreparedStatement(final Element tableElem, String dbName, String jndiName,
final OperationMetaData opMetaData, final PreparedStatement ps) final OperationMetaData opMetaData, final PreparedStatement ps)
throws SQLException, MessagingException, Exception { throws SQLException, MessagingException, Exception {
/* /*
@ -452,9 +454,11 @@ public class JDBCDenormalizer {
} }
//113494 end //113494 end
String dbURL = dbMeta.getURL();
if (dbURL == null)
dbURL = "jndi:"+jndiName;
ArrayList<CachedQueryParameter> paramsList = ArrayList<CachedQueryParameter> paramsList =
ParamMetadataCache.instance().getMetadata(dbMeta.getURL(), ParamMetadataCache.instance().getMetadata(dbURL, opMetaData);
opMetaData);
if (paramsList == null) { if (paramsList == null) {
ParameterMetaData paramMetaData = null; ParameterMetaData paramMetaData = null;
try { try {
@ -504,7 +508,7 @@ public class JDBCDenormalizer {
} else } else
paramsList = cacheEmptyQueryParams(); paramsList = cacheEmptyQueryParams();
ParamMetadataCache.instance().storeMetadata(dbMeta.getURL(), ParamMetadataCache.instance().storeMetadata(dbURL,
opMetaData, paramsList); opMetaData, paramsList);
} }
} }

View File

@ -562,8 +562,13 @@ public class OutboundMessageProcessor implements Runnable {
NormalizedMessage outMsg = mExchange.createMessage(); NormalizedMessage outMsg = mExchange.createMessage();
//boolean success = true; //boolean success = true;
String statusMessage = ""; String statusMessage = "";
String jndiName = "";
try { try {
Object[] jndiConn = getDatabaseConnection(inMsg, inout.getExchangeId(), epb);
jndiName = (String)jndiConn[0];
connection = (Connection)jndiConn[1];
rs = null; rs = null;
int rowsUpdated = -1; int rowsUpdated = -1;
/* /*
@ -576,48 +581,12 @@ public class OutboundMessageProcessor implements Runnable {
JDBCOperationInput input = meta.getJDBCSql(); JDBCOperationInput input = meta.getJDBCSql();
if (input != null) { if (input != null) {
final String sql = input.getSql(); final String sql = input.getSql();
Object jndiNameObj =
inMsg.getProperty(
JDBCComponentContext.NM_PROP_DATABASEBC_CONNECTION_JNDI_NAME);
try {
if (jndiNameObj != null) {
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiNameObj.toString());
connection = getDatabaseConnection(inMsg);
} else {
String jndiName = epb.getValue(
EndpointBean.JDBC_DATABASE_JNDI_NAME);
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiName);
connection = getDatabaseConnection(epb);
}
} catch (Exception e) {
faultCode = SERVER;
faultDetail = "Unable to get connection : " + e.toString();
String faultString = mMessages.getString(
"DBBC_E00627.OMP_Failed_LookUp_JNDI", new Object[]{
inout.getExchangeId(), epb.getValue(
EndpointBean.ENDPOINT_NAME),
mExchange.getOperation().toString()});
AlertsUtil.getAlerter().warning(faultString,
JDBCBindingLifeCycle.SHORT_DISPLAY_NAME,
null,
AlertsUtil.getServerType(),
AlertsUtil.COMPONENT_TYPE_BINDING,
NotificationEvent.OPERATIONAL_STATE_RUNNING,
NotificationEvent.EVENT_TYPE_ALERT,
"DBBC_E00627");
throw new Exception(faultString, e);
}
if (meta.getJDBCOperationInput().getOperationType(). if (meta.getJDBCOperationInput().getOperationType().
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_SELECT.toString()) || equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_SELECT.toString()) ||
meta.getJDBCOperationInput().getOperationType(). meta.getJDBCOperationInput().getOperationType().
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_FIND.toString())) { equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_FIND.toString())) {
try { try {
rs = executeOutboundSQLSelect(inMsg, epb, meta, rs = executeOutboundSQLSelect(inMsg, epb, meta, jndiName, connection);
connection);
} catch (final SQLException ex) { } catch (final SQLException ex) {
faultCode = SERVER; faultCode = SERVER;
faultDetail = mMessages.getString( faultDetail = mMessages.getString(
@ -697,15 +666,12 @@ public class OutboundMessageProcessor implements Runnable {
if (meta.getJDBCOperationInput().getOperationType(). if (meta.getJDBCOperationInput().getOperationType().
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_INSERT.toString()) && equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_INSERT.toString()) &&
generatedKey != null && !"".equals(generatedKey)) { generatedKey != null && !"".equals(generatedKey)) {
generatedKeyValue = generatedKeyValue = executeOutboundSQLWithGeneratedKeys(inMsg, epb, meta, jndiName, connection);
executeOutboundSQLWithGeneratedKeys(
inMsg, epb, meta, connection);
outputValue = generatedKeyValue; outputValue = generatedKeyValue;
statusMessage = statusMessage =
"Success : Generated Key = " + generatedKeyValue; "Success : Generated Key = " + generatedKeyValue;
} else { } else {
rowsUpdated = executeOutboundSQL(inMsg, epb, rowsUpdated = executeOutboundSQL(inMsg, epb, meta, jndiName, connection);
meta, connection);
statusMessage = statusMessage =
"Success : " + rowsUpdated + " are updated ."; "Success : " + rowsUpdated + " are updated .";
outputValue = String.valueOf(rowsUpdated); outputValue = String.valueOf(rowsUpdated);
@ -787,45 +753,7 @@ public class OutboundMessageProcessor implements Runnable {
SPOperationInput spInput = SPOperationInput spInput =
meta.getJDBCSPOperationInput(); meta.getJDBCSPOperationInput();
if (spInput != null) { if (spInput != null) {
Object jndiNameObj = cs = executeOutboundProc(inMsg, epb, meta, jndiName, connection);
inMsg.getProperty(
JDBCComponentContext.NM_PROP_DATABASEBC_CONNECTION_JNDI_NAME);
try {
if (jndiNameObj != null) {
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiNameObj.toString());
connection = getDatabaseConnection(inMsg);
} else {
String jndiName =
epb.getValue(
EndpointBean.JDBC_DATABASE_JNDI_NAME);
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiName);
connection = getDatabaseConnection(epb);
}
} catch (Exception e) {
faultCode = SERVER;
faultDetail = "Unable to get connection : " + e.toString();
String faultString =
mMessages.getString(
"DBBC_E00627.OMP_Failed_LookUp_JNDI", new Object[]{
inout.getExchangeId(), epb.getValue(
EndpointBean.ENDPOINT_NAME),
mExchange.getOperation().toString()});
AlertsUtil.getAlerter().warning(faultString,
JDBCBindingLifeCycle.SHORT_DISPLAY_NAME,
null,
AlertsUtil.getServerType(),
AlertsUtil.COMPONENT_TYPE_BINDING,
NotificationEvent.OPERATIONAL_STATE_RUNNING,
NotificationEvent.EVENT_TYPE_ALERT,
"DBBC_E00627");
throw new Exception(faultString, e);
}
cs = executeOutboundProc(inMsg, epb, meta,
connection);
final JDBCNormalizer normalizer = final JDBCNormalizer normalizer =
new JDBCNormalizer(); new JDBCNormalizer();
final JDBCDenormalizer denormalizer = final JDBCDenormalizer denormalizer =
@ -1083,6 +1011,10 @@ public class OutboundMessageProcessor implements Runnable {
String jndiName = null; String jndiName = null;
try { try {
Object[] jndiConn = getDatabaseConnection(inMsg, inout.getExchangeId(), epb);
jndiName = (String)jndiConn[0];
connection = (Connection)jndiConn[1];
rs = null; rs = null;
int rowsUpdated = -1; int rowsUpdated = -1;
@ -1093,8 +1025,6 @@ public class OutboundMessageProcessor implements Runnable {
JDBCOperationInput input = meta.getJDBCSql(); JDBCOperationInput input = meta.getJDBCSql();
if (input != null) { if (input != null) {
final String sql = input.getSql(); final String sql = input.getSql();
jndiName = epb.getValue(
EndpointBean.JDBC_DATABASE_JNDI_NAME);
if (inout.isTransacted()) if (inout.isTransacted())
// Removing manual enlistment. Moving to automatic resource enlistment // Removing manual enlistment. Moving to automatic resource enlistment
@ -1106,30 +1036,8 @@ public class OutboundMessageProcessor implements Runnable {
if (transaction != null) if (transaction != null)
resumeThreadTx(transaction); resumeThreadTx(transaction);
try {
connection = getDatabaseConnection(epb);
} catch (Exception e) {
faultCode = SERVER;
faultDetail = "Unable to get connection : " + e.toString();
String faultString = mMessages.getString(
"DBBC_E00627.OMP_Failed_LookUp_JNDI", new Object[]{
inout.getExchangeId(), epb.getValue(
EndpointBean.ENDPOINT_NAME),
mExchange.getOperation().toString()});
AlertsUtil.getAlerter().warning(mMessages.getString(
"DBBC_E00627.OMP_Failed_LookUp_JNDI"),
JDBCBindingLifeCycle.SHORT_DISPLAY_NAME,
null,
AlertsUtil.getServerType(),
AlertsUtil.COMPONENT_TYPE_BINDING,
NotificationEvent.OPERATIONAL_STATE_RUNNING,
NotificationEvent.EVENT_TYPE_ALERT,
"DBBC_E00627");
throw new Exception(faultString, e);
}
connection.setAutoCommit(true); connection.setAutoCommit(true);
/* PP: Glassfish does not return a XADataSource and always returns /* PP: Glassfish does not return a XADataSource and always returns
* a DataSource30 object which does not implement getXAResource() method * a DataSource30 object which does not implement getXAResource() method
xaconnection = getXADatabaseConnection(epb); xaconnection = getXADatabaseConnection(epb);
@ -1142,8 +1050,7 @@ public class OutboundMessageProcessor implements Runnable {
meta.getJDBCOperationInput().getOperationType(). meta.getJDBCOperationInput().getOperationType().
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_FIND.toString())) { equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_FIND.toString())) {
try { try {
rs = executeOutboundSQLSelect(inMsg, epb, meta, rs = executeOutboundSQLSelect(inMsg, epb, meta, jndiName, connection);
connection);
} catch (final SQLException ex) { } catch (final SQLException ex) {
faultCode = SERVER; faultCode = SERVER;
faultDetail = mMessages.getString( faultDetail = mMessages.getString(
@ -1227,8 +1134,7 @@ public class OutboundMessageProcessor implements Runnable {
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_EXECUTE. equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_EXECUTE.
toString())) { toString())) {
try { try {
cs = executeOutboundProc(inMsg, epb, meta, cs = executeOutboundProc(inMsg, epb, meta, jndiName, connection);
connection);
} catch (final SQLException ex) { } catch (final SQLException ex) {
faultCode = SERVER; faultCode = SERVER;
faultDetail = mMessages.getString( faultDetail = mMessages.getString(
@ -1311,15 +1217,12 @@ public class OutboundMessageProcessor implements Runnable {
if (meta.getJDBCOperationInput().getOperationType(). if (meta.getJDBCOperationInput().getOperationType().
equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_INSERT.toString()) && equalsIgnoreCase(JDBCOperations.OPERATION_TYPE_INSERT.toString()) &&
generatedKey != null && !"".equals(generatedKey)) { generatedKey != null && !"".equals(generatedKey)) {
generatedKeyValue = generatedKeyValue = executeOutboundSQLWithGeneratedKeys(inMsg, epb, meta, jndiName, connection);
executeOutboundSQLWithGeneratedKeys(
inMsg, epb, meta, connection);
outputValue = generatedKeyValue; outputValue = generatedKeyValue;
statusMessage = statusMessage =
"Success : Generated Key = " + generatedKeyValue; "Success : Generated Key = " + generatedKeyValue;
} else { } else {
rowsUpdated = executeOutboundSQL(inMsg, rowsUpdated = executeOutboundSQL(inMsg, epb, meta, jndiName, connection);
epb, meta, connection);
statusMessage = statusMessage =
"Success : " + rowsUpdated + " are updated ."; "Success : " + rowsUpdated + " are updated .";
outputValue = outputValue =
@ -1403,9 +1306,6 @@ public class OutboundMessageProcessor implements Runnable {
SPOperationInput spInput = SPOperationInput spInput =
meta.getJDBCSPOperationInput(); meta.getJDBCSPOperationInput();
if (spInput != null) { if (spInput != null) {
Object jndiNameObj =
inMsg.getProperty(
JDBCComponentContext.NM_PROP_DATABASEBC_CONNECTION_JNDI_NAME);
if (inout.isTransacted()) if (inout.isTransacted())
// Removing manual enlistment. Moving to automatic resource enlistment // Removing manual enlistment. Moving to automatic resource enlistment
// mtxHelper.handleOutbound(mExchange); // mtxHelper.handleOutbound(mExchange);
@ -1415,37 +1315,8 @@ public class OutboundMessageProcessor implements Runnable {
MessageExchange.JTA_TRANSACTION_PROPERTY_NAME); MessageExchange.JTA_TRANSACTION_PROPERTY_NAME);
if (transaction != null) if (transaction != null)
resumeThreadTx(transaction); resumeThreadTx(transaction);
try {
if (jndiNameObj != null) {
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiNameObj.toString());
connection = getDatabaseConnection(inMsg);
} else {
jndiName =
epb.getValue(
EndpointBean.JDBC_DATABASE_JNDI_NAME);
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiName);
connection = getDatabaseConnection(epb);
}
} catch (Exception e) {
faultCode = SERVER;
faultDetail = "Unable to get connection : " + e.toString();
String faultString =
mMessages.getString(
"DBBC_E00627.OMP_Failed_LookUp_JNDI", new Object[]{
inout.getExchangeId(), epb.getValue(
EndpointBean.ENDPOINT_NAME),
mExchange.getOperation().toString()});
processException(e, transaction, inout, epb,
faultCode, faultDetail);
throw new Exception(faultString, e);
}
connection.setAutoCommit(true); connection.setAutoCommit(true);
cs = executeOutboundProc(inMsg, epb, meta, cs = executeOutboundProc(inMsg, epb, meta, jndiName, connection);
connection);
final JDBCNormalizer normalizer = final JDBCNormalizer normalizer =
new JDBCNormalizer(); new JDBCNormalizer();
final JDBCDenormalizer denormalizer = final JDBCDenormalizer denormalizer =
@ -1693,33 +1564,9 @@ public class OutboundMessageProcessor implements Runnable {
try { try {
if (transaction != null) if (transaction != null)
getTransactionManager().resume(transaction); getTransactionManager().resume(transaction);
Object jndiNameObj = Object[] jndiConn = getDatabaseConnection(inMsg, inonly.getExchangeId(), epb);
inMsg.getProperty( String jndiName = (String)jndiConn[0];
JDBCComponentContext.NM_PROP_DATABASEBC_CONNECTION_JNDI_NAME); connection = (Connection)jndiConn[1];
try {
if (jndiNameObj != null) {
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiNameObj.toString());
connection = getDatabaseConnection(inMsg);
} else {
String jndiName = epb.getValue(
EndpointBean.JDBC_DATABASE_JNDI_NAME);
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiName);
connection = getDatabaseConnection(epb);
}
} catch (Exception e) {
faultCode = SERVER;
faultDetail = "Unable to get connection : " + e.toString();
String faultString = mMessages.getString(
"DBBC_E00627.OMP_Failed_LookUp_JNDI", new Object[]{
inonly.getExchangeId(), epb.getValue(
EndpointBean.ENDPOINT_NAME),
mExchange.getOperation().toString()});
throw new Exception(faultString, e);
}
if (transaction != null) if (transaction != null)
connection.setAutoCommit(true); connection.setAutoCommit(true);
@ -1727,13 +1574,11 @@ public class OutboundMessageProcessor implements Runnable {
if (meta.getJDBCOperationInput().getOperationType(). if (meta.getJDBCOperationInput().getOperationType().
equalsIgnoreCase( equalsIgnoreCase(
JDBCOperations.OPERATION_TYPE_EXECUTE.toString())) JDBCOperations.OPERATION_TYPE_EXECUTE.toString()))
// executeOutboundProc(inMsg, epb, meta);
// Auto enlistment: pass the transaction retrieved from the Message exchange. // Auto enlistment: pass the transaction retrieved from the Message exchange.
cs = executeOutboundProc(inMsg, epb, meta, connection); cs = executeOutboundProc(inMsg, epb, meta, jndiName, connection);
else else
// executeOutboundSQL(inMsg, epb, meta);
// Auto enlistment: pass the transaction retrieved from the Message exchange. // Auto enlistment: pass the transaction retrieved from the Message exchange.
executeOutboundSQL(inMsg, epb, meta, connection); executeOutboundSQL(inMsg, epb, meta, jndiName, connection);
inonly.setStatus(ExchangeStatus.DONE); inonly.setStatus(ExchangeStatus.DONE);
} catch (final SQLException ex) { } catch (final SQLException ex) {
processException(ex, transaction, inonly, epb, faultCode, processException(ex, transaction, inonly, epb, faultCode,
@ -1797,6 +1642,7 @@ public class OutboundMessageProcessor implements Runnable {
protected ResultSet executeOutboundSQLSelect(final NormalizedMessage nMsg, protected ResultSet executeOutboundSQLSelect(final NormalizedMessage nMsg,
final EndpointBean eBean, final EndpointBean eBean,
final OperationMetaData opMetaData, final OperationMetaData opMetaData,
final String jndiName,
Connection connection) throws SQLException, MessagingException { Connection connection) throws SQLException, MessagingException {
String sql = null; String sql = null;
try { try {
@ -1812,7 +1658,7 @@ public class OutboundMessageProcessor implements Runnable {
eBean.getUniqueName(), eBean.getUniqueName(),
JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION); JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION);
denormalizer.denormalizeOutbound(nMsg, getDBName(eBean, nMsg), denormalizer.denormalizeOutbound(nMsg, getDBName(eBean, nMsg), jndiName,
opMetaData, ps); opMetaData, ps);
if (denormalizationMeasurement != null) if (denormalizationMeasurement != null)
@ -1849,6 +1695,7 @@ public class OutboundMessageProcessor implements Runnable {
protected int executeOutboundSQL(final NormalizedMessage nMsg, protected int executeOutboundSQL(final NormalizedMessage nMsg,
final EndpointBean eBean, final EndpointBean eBean,
final OperationMetaData opMetaData, final OperationMetaData opMetaData,
final String jndiName,
Connection connection) throws SQLException, MessagingException { Connection connection) throws SQLException, MessagingException {
String sql = null; String sql = null;
int rowsUpdated = -1; int rowsUpdated = -1;
@ -1865,7 +1712,7 @@ public class OutboundMessageProcessor implements Runnable {
eBean.getUniqueName(), eBean.getUniqueName(),
JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION); JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION);
denormalizer.denormalizeOutbound(nMsg, getDBName(eBean, nMsg), denormalizer.denormalizeOutbound(nMsg, getDBName(eBean, nMsg), jndiName,
opMetaData, ps); opMetaData, ps);
if (denormalizationMeasurement != null) if (denormalizationMeasurement != null)
denormalizationMeasurement.end(); denormalizationMeasurement.end();
@ -1904,6 +1751,7 @@ public class OutboundMessageProcessor implements Runnable {
protected String executeOutboundSQLWithGeneratedKeys(final NormalizedMessage nMsg, protected String executeOutboundSQLWithGeneratedKeys(final NormalizedMessage nMsg,
final EndpointBean eBean, final EndpointBean eBean,
final OperationMetaData opMetaData, final OperationMetaData opMetaData,
final String jndiName,
Connection connection) throws SQLException, MessagingException { Connection connection) throws SQLException, MessagingException {
mLogger.log(Level.INFO, "Entering executeOutboundSQLWithGeneratedKeys"); mLogger.log(Level.INFO, "Entering executeOutboundSQLWithGeneratedKeys");
String sql = null; String sql = null;
@ -1924,7 +1772,7 @@ public class OutboundMessageProcessor implements Runnable {
eBean.getUniqueName(), eBean.getUniqueName(),
JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION); JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION);
denormalizer.denormalizeOutbound(nMsg, getDBName(eBean, nMsg), denormalizer.denormalizeOutbound(nMsg, getDBName(eBean, nMsg), jndiName,
opMetaData, ps); opMetaData, ps);
if (denormalizationMeasurement != null) if (denormalizationMeasurement != null)
denormalizationMeasurement.end(); denormalizationMeasurement.end();
@ -1965,6 +1813,7 @@ public class OutboundMessageProcessor implements Runnable {
protected CallableStatement executeOutboundProc(final NormalizedMessage nMsg, protected CallableStatement executeOutboundProc(final NormalizedMessage nMsg,
final EndpointBean eBean, final EndpointBean eBean,
final OperationMetaData opMetaData, final OperationMetaData opMetaData,
final String jndiName,
Connection connnection) throws SQLException, MessagingException { Connection connnection) throws SQLException, MessagingException {
String sql = null; String sql = null;
int rowsUpdated = -1; int rowsUpdated = -1;
@ -1985,7 +1834,7 @@ public class OutboundMessageProcessor implements Runnable {
Probe denormalizationMeasurement = Probe.info(getClass(), Probe denormalizationMeasurement = Probe.info(getClass(),
eBean.getUniqueName(), eBean.getUniqueName(),
JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION); JDBCBindingLifeCycle.PERF_CAT_DENORMALIZATION);
denormalizer.denormalizeOutboundProc(nMsg, opMetaData, dbmeta, cs); denormalizer.denormalizeOutboundProc(nMsg, opMetaData, dbmeta, jndiName, cs);
if (denormalizationMeasurement != null) if (denormalizationMeasurement != null)
denormalizationMeasurement.end(); denormalizationMeasurement.end();
@ -2085,6 +1934,43 @@ public class OutboundMessageProcessor implements Runnable {
return conn; return conn;
} }
private Object[] getDatabaseConnection(NormalizedMessage inMsg, String exchangeId, EndpointBean epb) throws Exception
{
String jndiName = null;
Connection connection = null;
String faultDetail = null;
try {
jndiName = (String)inMsg.getProperty(JDBCComponentContext.NM_PROP_DATABASEBC_CONNECTION_JNDI_NAME);
if (jndiName != null) {
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiName);
connection = getDatabaseConnection(inMsg);
} else {
jndiName = epb.getValue(EndpointBean.JDBC_DATABASE_JNDI_NAME);
mLogger.log(Level.INFO,
OutboundMessageProcessor.mMessages.getString(
"DBBC_R00629.OMP_UsedJNDI") + jndiName);
connection = getDatabaseConnection(epb);
}
} catch (Exception e) {
String faultString = mMessages.getString(
"DBBC_E00627.OMP_Failed_LookUp_JNDI", new Object[]{
jndiName, exchangeId, epb.getValue(EndpointBean.ENDPOINT_NAME),
mExchange.getOperation().toString()});
AlertsUtil.getAlerter().warning(faultString,
JDBCBindingLifeCycle.SHORT_DISPLAY_NAME,
null,
AlertsUtil.getServerType(),
AlertsUtil.COMPONENT_TYPE_BINDING,
NotificationEvent.OPERATIONAL_STATE_RUNNING,
NotificationEvent.EVENT_TYPE_ALERT,
"DBBC_E00627");
throw e;
}
return new Object[] { jndiName, connection };
}
private XAConnection getXADatabaseConnection(final EndpointBean epbean) throws Exception { private XAConnection getXADatabaseConnection(final EndpointBean epbean) throws Exception {
try { try {
final DataSource ds = (DataSource) getDataSourceFromContext(epbean. final DataSource ds = (DataSource) getDataSourceFromContext(epbean.

View File

@ -143,7 +143,7 @@ DBBC_E00624.OMP_Failed_inonly=Exception in processing reply for InOnly.
DBBC_R00624.OMP_Failed_Exec_SQL=Exception in processing SQL. DBBC_R00624.OMP_Failed_Exec_SQL=Exception in processing SQL.
DBBC_R00625.OMP_Exec_SQL=Executing SQL.... DBBC_R00625.OMP_Exec_SQL=Executing SQL....
DBBC_E00626.OMP_Failed_Exec_SQL=Error occured while executing SQL. DBBC_E00626.OMP_Failed_Exec_SQL=Error occured while executing SQL.
DBBC_E00627.OMP_Failed_LookUp_JNDI=Error occured while looking up jndi resource with jndi name. DBBC_E00627.OMP_Failed_LookUp_JNDI=Error occured while looking up jndi resource with jndi name {0}.
DBBC_E00628.OMP_Cleanup_Failure=Falied to close the Connection, ResultSet, Callable Statement in OutboundMessage Processor. DBBC_E00628.OMP_Cleanup_Failure=Falied to close the Connection, ResultSet, Callable Statement in OutboundMessage Processor.
DBBC_R00629.OMP_UsedJNDI=Using Jndi Name:: DBBC_R00629.OMP_UsedJNDI=Using Jndi Name::
DBBC_R00630.OMP_Accept_msg=Accepted message in DBBC outbound message processor. DBBC_R00630.OMP_Accept_msg=Accepted message in DBBC outbound message processor.