[jboss-svn-commits] JBL Code SVN: r15477 - labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 1 07:04:59 EDT 2007
Author: mark.little at jboss.com
Date: 2007-10-01 07:04:59 -0400 (Mon, 01 Oct 2007)
New Revision: 15477
Modified:
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
Log:
http://jira.jboss.com/jira/browse/JBESB-808
Modified: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2007-10-01 10:44:50 UTC (rev 15476)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2007-10-01 11:04:59 UTC (rev 15477)
@@ -35,6 +35,8 @@
import org.jboss.internal.soa.esb.message.urigen.DefaultMessageURIGenerator;
import org.jboss.soa.esb.Service;
import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.common.ModulePropertyManager;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.urigen.MessageURIGenerator;
@@ -49,17 +51,22 @@
public class DBMessageStoreImpl implements RedeliverStore
{
+ public static final String DEFAULT_TABLE_NAME = "message";
+
private Logger logger = Logger.getLogger(this.getClass());
protected ConnectionManager mgr = null;
private Integer maxRedeliverCount = 10;
+ private String tableName = DEFAULT_TABLE_NAME;
protected MessageURIGenerator uriGenerator = new DefaultMessageURIGenerator();
public DBMessageStoreImpl() throws ConnectionManagerException
{
mgr = ConnectionManagerFactory.getConnectionManager();
+
+ tableName = ModulePropertyManager.getPropertyManager(ModulePropertyManager.DBSTORE_MODULE).getProperty(Environment.MSG_STORE_DB_TABLE_NAME, DEFAULT_TABLE_NAME);
}
/* (non-Javadoc)
@@ -75,7 +82,6 @@
*/
public synchronized URI addMessage (Message message, String classification) throws MessageStoreException
{
- // String messageString = null;
URI uid = null;
Connection conn=null;
try{
@@ -162,7 +168,7 @@
*/
public void setUndelivered(URI uid) throws MessageStoreException
{
- String sql = "update message set delivered = 'FALSE' where uuid=?";
+ String sql = "update "+tableName+" set delivered = 'FALSE' where uuid=?";
Connection conn=null;
try {
conn = mgr.getConnection();
@@ -178,7 +184,7 @@
}
public void setDelivered(URI uid) throws MessageStoreException{
- String sql = "update message set delivered = 'TRUE' where uuid=?";
+ String sql = "update "+tableName+" set delivered = 'TRUE' where uuid=?";
Connection conn=null;
try {
conn = mgr.getConnection();
@@ -200,7 +206,7 @@
*/
public Map<URI, Message> getUndeliveredMessages(String classification) throws MessageStoreException {
HashMap<URI, Message> messages = new HashMap<URI, Message>();
- String sql = "select uuid from message where delivered='FALSE'";
+ String sql = "select uuid from "+tableName+" where delivered='FALSE'";
if (classification!=null) {
sql += " and classification='" + classification + "'";
}
@@ -243,7 +249,7 @@
*/
public Map<URI, Message> getAllMessages(String classification) throws MessageStoreException {
HashMap<URI, Message> messages = new HashMap<URI, Message>();
- String sql = "select uuid, message from message";
+ String sql = "select uuid, message from "+tableName;
if (classification!=null) {
sql += " where classification='" + classification + "'";
}
@@ -382,7 +388,7 @@
throws SQLException, MessageStoreException
{
Message message=null;
- String selectSql = "select * from message where uuid=?";
+ String selectSql = "select * from "+tableName+" where uuid=?";
PreparedStatement selectStmt = connection.prepareStatement(selectSql);
selectStmt.setObject(1, uid.toString());
ResultSet rs = selectStmt.executeQuery();
@@ -402,7 +408,7 @@
throws SQLException, MessageStoreException
{
Message message=null;
- String selectSql = "select * from message where uuid=? and classification=?";
+ String selectSql = "select * from "+tableName+" where uuid=? and classification=?";
PreparedStatement selectStmt = connection.prepareStatement(selectSql);
selectStmt.setObject(1, uid.toString());
selectStmt.setObject(2, classification);
@@ -422,7 +428,7 @@
private int delete(URI uid, String classification, Connection connection)
throws SQLException
{
- String deleteSql = "delete from message where uuid=? and classification=?";
+ String deleteSql = "delete from "+tableName+" where uuid=? and classification=?";
PreparedStatement stmt = connection.prepareStatement(deleteSql);
stmt.setObject(1, uid.toString());
stmt.setObject(2, classification);
@@ -434,7 +440,7 @@
private void insert(URI uid, Message message, String classification, String delivered, Connection conn)
throws SQLException, MessageStoreException
{
- String sql = "insert into message(uuid, type, message, delivered, classification) values(?,?,?,?,?)";
+ String sql = "insert into "+tableName+"(uuid, type, message, delivered, classification) values(?,?,?,?,?)";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, uid.toString());
More information about the jboss-svn-commits
mailing list