org.activemq.store.jdbc.adapter
Class DefaultJDBCAdapter

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

public class DefaultJDBCAdapter
extends java.lang.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.1 $

Nested Class Summary
 
Nested classes inherited from class org.activemq.store.jdbc.JDBCAdapter
JDBCAdapter.MessageListResultHandler
 
Field Summary
protected  LongSequenceGenerator sequenceGenerator
           
protected  StatementProvider statementProvider
           
 
Constructor Summary
DefaultJDBCAdapter()
           
DefaultJDBCAdapter(StatementProvider provider)
           
 
Method Summary
 void doAddMessage(java.sql.Connection c, long seq, java.lang.String messageID, java.lang.String destinationName, byte[] data, long expiration)
           
 void doAddXid(java.sql.Connection c, ActiveMQXid xid)
           
 void doCreateTables(java.sql.Connection c)
           
 void doDeleteOldMessages(java.sql.Connection c)
           
 void doDeleteSubscription(java.sql.Connection c, java.lang.String destinationName, java.lang.String subscription)
           
 void doDropTables(java.sql.Connection c)
           
 byte[] doGetMessage(java.sql.Connection c, long seq)
           
 SubscriberEntry doGetSubscriberEntry(java.sql.Connection c, java.lang.String destinationName, java.lang.String sub)
           
 void doLoadPreparedTransactions(java.sql.Connection c, TransactionStore.RecoveryListener listener)
           
 void doRecover(java.sql.Connection c, java.lang.String destinationName, JDBCAdapter.MessageListResultHandler listener)
           
 void doRecoverSubscription(java.sql.Connection c, java.lang.String destinationName, java.lang.String subscriptionID, JDBCAdapter.MessageListResultHandler listener)
           
 void doRemoveAllMessages(java.sql.Connection c, java.lang.String destinationName)
           
 void doRemoveMessage(java.sql.Connection c, long seq)
           
 void doRemoveXid(java.sql.Connection c, ActiveMQXid xid)
           
 void doSetLastAck(java.sql.Connection c, java.lang.String destinationName, java.lang.String subscriptionID, long seq)
           
 void doSetSubscriberEntry(java.sql.Connection c, java.lang.String destinationName, java.lang.String sub, SubscriberEntry subscriberEntry)
           
protected  byte[] getBinaryData(java.sql.ResultSet rs, int index)
           
 java.lang.Long getMessageSequenceId(java.sql.Connection c, java.lang.String messageID)
           
 LongSequenceGenerator getSequenceGenerator()
           
 void initSequenceGenerator(java.sql.Connection c)
           
protected  void setBinaryData(java.sql.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 LongSequenceGenerator sequenceGenerator
Constructor Detail

DefaultJDBCAdapter

public DefaultJDBCAdapter(StatementProvider provider)
Parameters:
provider -

DefaultJDBCAdapter

public DefaultJDBCAdapter()
Method Detail

setBinaryData

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

getBinaryData

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

getSequenceGenerator

public LongSequenceGenerator getSequenceGenerator()
Specified by:
getSequenceGenerator in interface JDBCAdapter

doCreateTables

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

doDropTables

public void doDropTables(java.sql.Connection c)
                  throws java.sql.SQLException
Specified by:
doDropTables in interface JDBCAdapter
Throws:
java.sql.SQLException

initSequenceGenerator

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

doAddMessage

public void doAddMessage(java.sql.Connection c,
                         long seq,
                         java.lang.String messageID,
                         java.lang.String destinationName,
                         byte[] data,
                         long expiration)
                  throws java.sql.SQLException,
                         javax.jms.JMSException
Specified by:
doAddMessage in interface JDBCAdapter
Throws:
java.sql.SQLException
javax.jms.JMSException

getMessageSequenceId

public java.lang.Long getMessageSequenceId(java.sql.Connection c,
                                           java.lang.String messageID)
                                    throws java.sql.SQLException,
                                           javax.jms.JMSException
Specified by:
getMessageSequenceId in interface JDBCAdapter
Throws:
java.sql.SQLException
javax.jms.JMSException

doGetMessage

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

doRemoveMessage

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

doRecover

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

doRemoveXid

public void doRemoveXid(java.sql.Connection c,
                        ActiveMQXid xid)
                 throws java.sql.SQLException,
                        javax.transaction.xa.XAException
Specified by:
doRemoveXid in interface JDBCAdapter
Throws:
java.sql.SQLException
javax.transaction.xa.XAException

doAddXid

public void doAddXid(java.sql.Connection c,
                     ActiveMQXid xid)
              throws java.sql.SQLException,
                     javax.transaction.xa.XAException
Specified by:
doAddXid in interface JDBCAdapter
Throws:
java.sql.SQLException
javax.transaction.xa.XAException

doLoadPreparedTransactions

public void doLoadPreparedTransactions(java.sql.Connection c,
                                       TransactionStore.RecoveryListener listener)
                                throws java.sql.SQLException
Specified by:
doLoadPreparedTransactions in interface JDBCAdapter
Throws:
java.sql.SQLException

doSetLastAck

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

doRecoverSubscription

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

doSetSubscriberEntry

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

doGetSubscriberEntry

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

doRemoveAllMessages

public void doRemoveAllMessages(java.sql.Connection c,
                                java.lang.String destinationName)
                         throws java.sql.SQLException,
                                javax.jms.JMSException
Specified by:
doRemoveAllMessages in interface JDBCAdapter
Throws:
java.sql.SQLException
javax.jms.JMSException

doDeleteSubscription

public void doDeleteSubscription(java.sql.Connection c,
                                 java.lang.String destinationName,
                                 java.lang.String subscription)
                          throws java.sql.SQLException,
                                 javax.jms.JMSException
Specified by:
doDeleteSubscription in interface JDBCAdapter
Throws:
java.sql.SQLException
javax.jms.JMSException

doDeleteOldMessages

public void doDeleteOldMessages(java.sql.Connection c)
                         throws java.sql.SQLException,
                                javax.jms.JMSException
Specified by:
doDeleteOldMessages in interface JDBCAdapter
Throws:
java.sql.SQLException
javax.jms.JMSException


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