org.codehaus.activemq.store.jdbc.adapter
Class DefaultJDBCAdapter

java.lang.Object
  extended byorg.codehaus.activemq.store.jdbc.adapter.DefaultJDBCAdapter
All Implemented Interfaces:
JDBCAdapter
Direct Known Subclasses:
BlobJDBCAdapter, BytesJDBCAdapter, ImageBasedJDBCAdaptor, OracleJDBCAdapter, StreamJDBCAdapter

public class DefaultJDBCAdapter
extends Object
implements JDBCAdapter

Implements all the default JDBC operations that are used by the JDBCPersistenceAdapter.

Subclassing is encouraged to override the default implementation of methods to account for differences in JDBC Driver implementations.

The JDBCAdapter inserts and extracts BLOB data using the getBytes()/setBytes() operations.

The databases/JDBC drivers that use this adapter are:

Version:
$Revision: 1.3 $

Nested Class Summary
 
Nested classes inherited from class org.codehaus.activemq.store.jdbc.JDBCAdapter
JDBCAdapter.MessageListResultHandler
 
Field Summary
protected  org.codehaus.activemq.util.LongSequenceGenerator sequenceGenerator
           
protected  StatementProvider statementProvider
           
 
Constructor Summary
DefaultJDBCAdapter()
           
DefaultJDBCAdapter(StatementProvider provider)
           
 
Method Summary
 void doAddMessage(Connection c, long seq, String messageID, String destinationName, byte[] data)
           
 void doAddXid(Connection c, org.codehaus.activemq.message.ActiveMQXid xid, byte[] data)
           
 void doCreateTables(Connection c)
           
 byte[] doGetMessage(Connection c, long seq)
           
 org.codehaus.activemq.service.SubscriberEntry doGetSubscriberEntry(Connection c, String destinationName, String sub)
           
 void doGetXids(Connection c, List list)
           
 void doLoadPreparedTransactions(Connection c, org.codehaus.activemq.service.TransactionManager transactionManager)
           
 void doRecover(Connection c, String destinationName, JDBCAdapter.MessageListResultHandler listener)
           
 void doRecoverSubscription(Connection c, String destinationName, String subscriptionID, JDBCAdapter.MessageListResultHandler listener)
           
 void doRemoveAllMessages(Connection c, String destinationName)
           
 void doRemoveMessage(Connection c, long seq)
           
 void doRemoveXid(Connection c, org.codehaus.activemq.message.ActiveMQXid xid)
           
 void doSetLastAck(Connection c, String destinationName, String subscriptionID, long seq)
           
 void doSetSubscriberEntry(Connection c, String destinationName, String sub, org.codehaus.activemq.service.SubscriberEntry subscriberEntry)
           
protected  byte[] getBinaryData(ResultSet rs, int index)
           
 Long getMessageSequenceId(Connection c, String messageID)
           
 org.codehaus.activemq.util.LongSequenceGenerator getSequenceGenerator()
           
 void initSequenceGenerator(Connection c)
           
protected  void setBinaryData(PreparedStatement s, int index, byte[] data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statementProvider

protected final StatementProvider statementProvider

sequenceGenerator

protected org.codehaus.activemq.util.LongSequenceGenerator sequenceGenerator
Constructor Detail

DefaultJDBCAdapter

public DefaultJDBCAdapter(StatementProvider provider)
Parameters:
provider -

DefaultJDBCAdapter

public DefaultJDBCAdapter()
Method Detail

setBinaryData

protected void setBinaryData(PreparedStatement s,
                             int index,
                             byte[] data)
                      throws SQLException
Throws:
SQLException

getBinaryData

protected byte[] getBinaryData(ResultSet rs,
                               int index)
                        throws SQLException
Throws:
SQLException

getSequenceGenerator

public org.codehaus.activemq.util.LongSequenceGenerator getSequenceGenerator()
Specified by:
getSequenceGenerator in interface JDBCAdapter

doCreateTables

public void doCreateTables(Connection c)
                    throws SQLException
Specified by:
doCreateTables in interface JDBCAdapter
Throws:
SQLException

initSequenceGenerator

public void initSequenceGenerator(Connection c)
Specified by:
initSequenceGenerator in interface JDBCAdapter

doAddMessage

public void doAddMessage(Connection c,
                         long seq,
                         String messageID,
                         String destinationName,
                         byte[] data)
                  throws SQLException,
                         JMSException
Specified by:
doAddMessage in interface JDBCAdapter
Throws:
SQLException
JMSException

getMessageSequenceId

public Long getMessageSequenceId(Connection c,
                                 String messageID)
                          throws SQLException,
                                 JMSException
Specified by:
getMessageSequenceId in interface JDBCAdapter
Throws:
SQLException
JMSException

doGetMessage

public byte[] doGetMessage(Connection c,
                           long seq)
                    throws SQLException
Specified by:
doGetMessage in interface JDBCAdapter
Throws:
SQLException

doRemoveMessage

public void doRemoveMessage(Connection c,
                            long seq)
                     throws SQLException
Specified by:
doRemoveMessage in interface JDBCAdapter
Throws:
SQLException

doRecover

public void doRecover(Connection c,
                      String destinationName,
                      JDBCAdapter.MessageListResultHandler listener)
               throws SQLException,
                      JMSException
Specified by:
doRecover in interface JDBCAdapter
Throws:
SQLException
JMSException

doGetXids

public void doGetXids(Connection c,
                      List list)
               throws SQLException
Specified by:
doGetXids in interface JDBCAdapter
Throws:
SQLException

doRemoveXid

public void doRemoveXid(Connection c,
                        org.codehaus.activemq.message.ActiveMQXid xid)
                 throws SQLException,
                        XAException
Specified by:
doRemoveXid in interface JDBCAdapter
Throws:
SQLException
XAException

doAddXid

public void doAddXid(Connection c,
                     org.codehaus.activemq.message.ActiveMQXid xid,
                     byte[] data)
              throws SQLException,
                     XAException
Specified by:
doAddXid in interface JDBCAdapter
Throws:
SQLException
XAException

doLoadPreparedTransactions

public void doLoadPreparedTransactions(Connection c,
                                       org.codehaus.activemq.service.TransactionManager transactionManager)
                                throws SQLException
Specified by:
doLoadPreparedTransactions in interface JDBCAdapter
Throws:
SQLException

doSetLastAck

public void doSetLastAck(Connection c,
                         String destinationName,
                         String subscriptionID,
                         long seq)
                  throws SQLException,
                         JMSException
Specified by:
doSetLastAck in interface JDBCAdapter
Throws:
JMSException
SQLException
See Also:
JDBCAdapter.doSetLastAck(java.sql.Connection, java.lang.String, java.lang.String, long)

doRecoverSubscription

public void doRecoverSubscription(Connection c,
                                  String destinationName,
                                  String subscriptionID,
                                  JDBCAdapter.MessageListResultHandler listener)
                           throws SQLException,
                                  JMSException
Specified by:
doRecoverSubscription in interface JDBCAdapter
Throws:
JMSException
SQLException
See Also:
JDBCAdapter.doRecoverSubscription(java.sql.Connection, java.lang.String, java.lang.String, org.codehaus.activemq.store.jdbc.JDBCAdapter.MessageListResultHandler)

doSetSubscriberEntry

public void doSetSubscriberEntry(Connection c,
                                 String destinationName,
                                 String sub,
                                 org.codehaus.activemq.service.SubscriberEntry subscriberEntry)
                          throws SQLException
Specified by:
doSetSubscriberEntry in interface JDBCAdapter
Throws:
SQLException
See Also:
org.codehaus.activemq.store.jdbc.JDBCAdapter#doSetSubscriberEntry(java.sql.Connection, java.lang.Object, org.codehaus.activemq.service.SubscriberEntry)

doGetSubscriberEntry

public org.codehaus.activemq.service.SubscriberEntry doGetSubscriberEntry(Connection c,
                                                                          String destinationName,
                                                                          String sub)
                                                                   throws SQLException
Specified by:
doGetSubscriberEntry in interface JDBCAdapter
Throws:
SQLException
See Also:
org.codehaus.activemq.store.jdbc.JDBCAdapter#doGetSubscriberEntry(java.sql.Connection, java.lang.Object)

doRemoveAllMessages

public void doRemoveAllMessages(Connection c,
                                String destinationName)
                         throws SQLException,
                                JMSException
Specified by:
doRemoveAllMessages in interface JDBCAdapter
Throws:
SQLException
JMSException


Copyright © 2004-2005 Protique, Ltd.. All Rights Reserved.