View Javadoc

    1   /***
    2    *
    3    * Copyright 2004 Hiram Chirino
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    * http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   **/
    18  package org.codehaus.activemq.store.jdbc;
    19
    20  import java.sql.Connection;
    21  import java.sql.SQLException;
    22  import java.util.List;
    23
    24  import javax.jms.JMSException;
    25  import javax.transaction.xa.XAException;
    26
    27  import org.codehaus.activemq.message.ActiveMQXid;
    28  import org.codehaus.activemq.service.SubscriberEntry;
    29  import org.codehaus.activemq.service.TransactionManager;
    30  import org.codehaus.activemq.util.LongSequenceGenerator;
    31
    32  /***
    33   * @version $Revision: 1.4 $
    34   */
    35  public interface JDBCAdapter {
    36
    37      public interface MessageListResultHandler {
    38          public void onMessage(long seq, String messageID) throws JMSException;
    39      }
    40
    41      public abstract LongSequenceGenerator getSequenceGenerator();
    42      public abstract void doCreateTables(Connection c) throws SQLException;
    43      public abstract void initSequenceGenerator(Connection c);
    44      public abstract void doAddMessage(Connection c, long seq, String messageID,
    45              String destinationName, byte[] data) throws SQLException,
    46              JMSException;
    47      public abstract byte[] doGetMessage(Connection c, long seq)
    48              throws SQLException;
    49      public abstract void doRemoveMessage(Connection c, long seq)
    50              throws SQLException;
    51      public abstract void doRecover(Connection c, String destinationName, MessageListResultHandler listener)
    52              throws SQLException, JMSException;
    53      public abstract void doGetXids(Connection c, List list) throws SQLException;
    54      public abstract void doRemoveXid(Connection c, ActiveMQXid xid)
    55              throws SQLException, XAException;
    56      public abstract void doAddXid(Connection c, ActiveMQXid xid, byte[] data)
    57              throws SQLException, XAException;
    58      public abstract void doLoadPreparedTransactions(Connection c,
    59              TransactionManager transactionManager) throws SQLException;
    60      public abstract void doSetLastAck(Connection c, String destinationName, String sub, long seq)
    61      		throws SQLException, JMSException;
    62      public abstract void doRecoverSubscription(Connection c, String destinationName, String sub, MessageListResultHandler listener)
    63      		throws SQLException, JMSException;
    64      public abstract void doSetSubscriberEntry(Connection c, String destinationName, String sub, SubscriberEntry subscriberEntry)
    65      		throws SQLException, JMSException;
    66      public abstract SubscriberEntry doGetSubscriberEntry(Connection c, String destinationName, String sub)
    67      		throws SQLException, JMSException;
    68  	public abstract Long getMessageSequenceId(Connection c, String messageID)
    69  			throws SQLException, JMSException;
    70  }