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
31 /***
32 * @version $Revision: 1.2 $
33 */
34 public interface JDBCAdapter {
35
36 public interface MessageListResultHandler {
37 public void onMessage(long seq, String messageID) throws JMSException;
38 }
39
40 public abstract SequenceGenerator getSequenceGenerator();
41 public abstract void doCreateTables(Connection c) throws SQLException;
42 public abstract void initSequenceGenerator(Connection c);
43 public abstract void doAddMessage(Connection c, long seq, String messageID,
44 String destinationName, byte[] data) throws SQLException,
45 JMSException;
46 public abstract byte[] doGetMessage(Connection c, long seq)
47 throws SQLException;
48 public abstract void doRemoveMessage(Connection c, long seq)
49 throws SQLException;
50 public abstract void doRecover(Connection c, String destinationName, MessageListResultHandler listener)
51 throws SQLException, JMSException;
52 public abstract void doGetXids(Connection c, List list) throws SQLException;
53 public abstract void doRemoveXid(Connection c, ActiveMQXid xid)
54 throws SQLException, XAException;
55 public abstract void doAddXid(Connection c, ActiveMQXid xid, byte[] data)
56 throws SQLException, XAException;
57 public abstract void doLoadPreparedTransactions(Connection c,
58 TransactionManager transactionManager) throws SQLException;
59 public abstract void doSetLastAck(Connection c, String destinationName, String sub, long seq)
60 throws SQLException, JMSException;
61 public abstract void doRecoverSubscription(Connection c, String destinationName, String sub, MessageListResultHandler listener)
62 throws SQLException, JMSException;
63 public abstract void doSetSubscriberEntry(Connection c, String destinationName, String sub, SubscriberEntry subscriberEntry)
64 throws SQLException, JMSException;
65 public abstract SubscriberEntry doGetSubscriberEntry(Connection c, String destinationName, String sub)
66 throws SQLException, JMSException;
67 }