[jboss-svn-commits] JBL Code SVN: r17064 - labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Dec 6 08:05:27 EST 2007
Author: mark.little at jboss.com
Date: 2007-12-06 08:05:27 -0500 (Thu, 06 Dec 2007)
New Revision: 17064
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1380, http://jira.jboss.com/jira/browse/JBESB-1381 and http://jira.jboss.com/jira/browse/JBESB-1383
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2007-12-06 12:58:49 UTC (rev 17063)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2007-12-06 13:05:27 UTC (rev 17064)
@@ -158,7 +158,7 @@
_logger.debug(roll);
}
}
-
+
_logger.debug("SQL exception during deliver", e);
throw new CourierException(e);
}
@@ -192,6 +192,7 @@
return result;
}
}
+
catch (SQLException e) {
_logger.debug("SQL Exception during pickup", e);
return null;
@@ -276,7 +277,6 @@
deleteStatement().setString(iParm++, messageId);
_conn.execUpdWait(deleteStatement(), 3);
_conn.commit();
-
}
private void changeStatus(String messageId, State to) throws SQLException {
@@ -285,7 +285,6 @@
updateStatusStatement().setString(iParm++, messageId);
_conn.execUpdWait(updateStatusStatement(), 3);
_conn.commit();
-
}
private ResultSet getRowList() throws CourierException {
@@ -356,36 +355,47 @@
return _conn;
} // ________________________________
- protected PreparedStatement listStatement() {
+ protected PreparedStatement listStatement() throws SQLException
+ {
if (null == _prepGetList)
try {
String[] columns =
{_epr.getMessageIdColumn(), _epr.getTimestampColumn()};
- StringBuilder sb = new StringBuilder("select");
- int i1 = 0;
- for (String col : columns)
- sb.append((i1++ < 1) ? " " : ",").append(col);
- sb.append(" from ").append(_epr.getTableName());
- sb.append(" where ").append(_epr.getStatusColumn())
- .append("='").append(State.Pending.getColumnValue())
- .append("'").append(" order by 2");
- _prepGetList = getConn().prepareStatement(sb.toString());
- }
- catch (Exception e) {
- _logger.debug("Unable to prepare SQL statement", e);
- return null;
- }
- return _prepGetList;
- } // ________________________________
+ StringBuilder sb = new StringBuilder("select");
+ int i1 = 0;
+ for (String col : columns)
+ sb.append((i1++ < 1) ? " " : ",").append(col);
+ sb.append(" from ").append(_epr.getTableName());
+ sb.append(" where ").append(_epr.getStatusColumn())
+ .append("='").append(State.Pending.getColumnValue())
+ .append("'").append(" order by 2");
+ _prepGetList = getConn().prepareStatement(sb.toString());
+ }
+ catch (SQLException ex)
+ {
+ throw ex;
+ }
+ catch (Exception e)
+ {
+ _logger.warn("Unable to prepare SQL statement", e);
+
+ throw new SQLException("Unable to prepare SQL statement: "+e);
+ }
+
+ return _prepGetList;
+ } // ________________________________
- protected PreparedStatement select4UpdateStatement() {
- if (_prepSel4Upd == null) {
- try {
- /*
- * TODO make this dynamic using a factory pattern.
- */
+ protected PreparedStatement select4UpdateStatement() throws SQLException
+ {
+ if (_prepSel4Upd == null)
+ {
+ try
+ {
+ /*
+ * TODO make this dynamic using a factory pattern.
+ */
StringBuilder sb = null;
@@ -401,8 +411,7 @@
* HSQL does not support FOR UPDATE! All tables appear to
* be inherently updatable!
*/
-
- sb = new StringBuilder("select ").append(
+ sb = new StringBuilder("select ").append(
_epr.getDataColumn()).append(" from ").append(
_epr.getTableName()).append(" where ").append(
_epr.getMessageIdColumn()).append("=?").append(
@@ -410,70 +419,97 @@
.append("=?");
}
- _prepSel4Upd = getConn().prepareStatement(sb.toString());
- }
- catch (Exception e) {
- _logger.debug(e);
- return null;
- }
- }
+ _prepSel4Upd = getConn().prepareStatement(sb.toString());
+ }
+ catch (SQLException ex)
+ {
+ throw ex;
+ }
+ catch (Exception e)
+ {
+ _logger.warn(e);
+
+ throw new SQLException("Caught exception during prepared statement: "+e);
+ }
+ }
+
+ return _prepSel4Upd;
+ }
+
+ protected PreparedStatement updateStatusStatement() throws SQLException
+ {
+ if (null == _prepUpdateStatus)
+ try
+ {
+ StringBuilder sb = new StringBuilder("update ").append(
+ _epr.getTableName()).append(" set ").append(
+ _epr.getStatusColumn()).append("= ?").append(" where ")
+ .append(_epr.getMessageIdColumn()).append("=?");
+ _prepUpdateStatus = getConn().prepareStatement(sb.toString());
+ }
+ catch (SQLException ex)
+ {
+ throw ex;
+ }
+ catch (Exception e)
+ {
+ _logger.warn(e);
+
+ throw new SQLException("Caught exception during prepared statement: "+e);
+ }
+ return _prepUpdateStatus;
+ } // ________________________________
- return _prepSel4Upd;
- } // ________________________________
+ protected PreparedStatement insertStatement() throws SQLException {
+ if (null == _prepInsert)
+ try {
+ String[] columns =
+ {_epr.getMessageIdColumn(), _epr.getDataColumn(),
+ _epr.getStatusColumn(), _epr.getTimestampColumn()};
+ StringBuilder sb = new StringBuilder("insert into ").append(
+ _epr.getTableName()).append("(");
+ int i1 = 0;
+ for (String col : columns)
+ sb.append((i1++ < 1) ? " " : ",").append(col);
+ sb.append(") values (?,?,?,?)");
+ _prepInsert = getConn().prepareStatement(sb.toString());
+ }
+ catch (SQLException ex)
+ {
+ throw ex;
+ }
+ catch (Exception e)
+ {
+ _logger.warn(e);
+
+ throw new SQLException("Caught exception during prepared statement: "+e);
+ }
+ return _prepInsert;
+ } // ________________________________
- protected PreparedStatement updateStatusStatement() {
- if (null == _prepUpdateStatus)
- try {
- StringBuilder sb = new StringBuilder("update ").append(
- _epr.getTableName()).append(" set ").append(
- _epr.getStatusColumn()).append("= ?").append(" where ")
- .append(_epr.getMessageIdColumn()).append("=?");
- _prepUpdateStatus = getConn().prepareStatement(sb.toString());
- }
- catch (Exception e) {
- _logger.debug(e);
- return null;
- }
- return _prepUpdateStatus;
- } // ________________________________
+ protected PreparedStatement deleteStatement() throws SQLException
+ {
+ if (null == _prepDelete)
+ try
+ {
+ StringBuilder sb = new StringBuilder("delete from ").append(
+ _epr.getTableName()).append(" where ").append(
+ _epr.getMessageIdColumn()).append(" =?");
+ _prepDelete = getConn().prepareStatement(sb.toString());
+ }
+ catch (SQLException ex)
+ {
+ throw ex;
+ }
+ catch (Exception e)
+ {
+ _logger.warn(e);
+
+ throw new SQLException("Caught exception during prepared statement: "+e);
+ }
+ return _prepDelete;
+ } // ________________________________
- protected PreparedStatement insertStatement() {
- if (null == _prepInsert)
- try {
- String[] columns =
- {_epr.getMessageIdColumn(), _epr.getDataColumn(),
- _epr.getStatusColumn(), _epr.getTimestampColumn()};
-
- StringBuilder sb = new StringBuilder("insert into ").append(
- _epr.getTableName()).append("(");
- int i1 = 0;
- for (String col : columns)
- sb.append((i1++ < 1) ? " " : ",").append(col);
- sb.append(") values (?,?,?,?)");
- _prepInsert = getConn().prepareStatement(sb.toString());
- }
- catch (Exception e) {
- _logger.debug(e);
- return null;
- }
- return _prepInsert;
- } // ________________________________
-
- protected PreparedStatement deleteStatement() {
- if (null == _prepDelete)
- try {
- StringBuilder sb = new StringBuilder("delete from ").append(
- _epr.getTableName()).append(" where ").append(
- _epr.getMessageIdColumn()).append(" =?");
- _prepDelete = getConn().prepareStatement(sb.toString());
- }
- catch (Exception e) {
- _logger.debug(e);
- return null;
- }
- return _prepDelete;
- } // ________________________________
-
protected enum State {
Pending, WorkInProgress, Done, Error;
More information about the jboss-svn-commits
mailing list