Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/store/jdbc/JDBCAdapter.java


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.activemq.store.jdbc;
19  
20  import java.sql.Connection;
21  import java.sql.SQLException;
22  
23  import javax.jms.JMSException;
24  import javax.transaction.xa.XAException;
25  
26  import org.activemq.message.ActiveMQXid;
27  import org.activemq.service.SubscriberEntry;
28  import org.activemq.store.TransactionStore.RecoveryListener;
29  import org.activemq.util.LongSequenceGenerator;
30  import org.activemq.service.MessageIdentity;
31  
32  /**
33   * @version $Revision: 1.1 $
34   */
35  public interface JDBCAdapter {
36      
37      public interface MessageListResultHandler {
38          public void onMessage(long seq, String messageID) throws JMSException;
39      }
40      
41      public interface ExpiredMessageResultHandler {
42          public void onMessage(long seq, String container, String messageID, boolean isSentToDeadLetter) throws JMSException;
43      }
44      
45      public abstract LongSequenceGenerator getSequenceGenerator();
46      public abstract void doCreateTables(Connection c) throws SQLException;
47      public abstract void doDropTables(Connection c) throws SQLException;
48      public abstract void initSequenceGenerator(Connection c);
49      public abstract void doAddMessage(Connection c, long seq, String messageID,
50              String destinationName, byte[] data, long expiration) throws SQLException,
51              JMSException;
52      public abstract byte[] doGetMessage(Connection c, long seq)
53              throws SQLException;
54      public abstract void doGetMessageForUpdate(Connection c, long seq, boolean useLocking, ExpiredMessageResultHandler handler)
55          throws SQLException, JMSException;
56      public abstract void doRemoveMessage(Connection c, long seq)
57              throws SQLException;
58      public abstract void doRecover(Connection c, String destinationName, MessageListResultHandler listener)
59              throws SQLException, JMSException;
60      public abstract void doRemoveXid(Connection c, ActiveMQXid xid)
61              throws SQLException, XAException;
62      public abstract void doAddXid(Connection c, ActiveMQXid xid)
63              throws SQLException, XAException;
64      public abstract void doLoadPreparedTransactions(Connection c,
65              RecoveryListener listener) throws SQLException;
66      public abstract void doSetLastAck(Connection c, String destinationName, String sub, long seq) 
67          throws SQLException, JMSException;
68      public abstract void doRecoverSubscription(Connection c, String destinationName, String sub, MessageListResultHandler listener)
69          throws SQLException, JMSException;
70      public abstract void doSetSubscriberEntry(Connection c, String destinationName, String sub, SubscriberEntry subscriberEntry) 
71          throws SQLException, JMSException;
72      public abstract SubscriberEntry doGetSubscriberEntry(Connection c, String destinationName, String sub) 
73          throws SQLException, JMSException;
74    public abstract Long getMessageSequenceId(Connection c, String messageID)
75        throws SQLException, JMSException;
76      public abstract void doRemoveAllMessages(Connection c, String destinationName)
77          throws SQLException, JMSException;
78      public abstract void doDeleteSubscription(Connection c, String destinationName, String subscription)
79          throws SQLException, JMSException;
80      public abstract void doDeleteOldMessages(Connection c)
81          throws SQLException, JMSException;
82      public abstract void doGetExpiredMessages(Connection c, ExpiredMessageResultHandler handler)
83      throws SQLException, JMSException;
84      public abstract void doDeleteExpiredMessage(Connection c, MessageIdentity messageIdentity)
85      throws SQLException, JMSException;
86      public void doSetDeadLetterFlag(Connection c, long seq)
87      throws SQLException, JMSException;
88      
89      public StatementProvider getStatementProvider();
90  
91  }