001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.activemq.store.jdbc; 018 019 import java.io.IOException; 020 import java.sql.SQLException; 021 import java.util.Set; 022 import org.apache.activemq.command.ActiveMQDestination; 023 import org.apache.activemq.command.MessageId; 024 import org.apache.activemq.command.SubscriptionInfo; 025 026 /** 027 * @version $Revision: 1.5 $ 028 */ 029 public interface JDBCAdapter { 030 031 void setStatements(Statements statementProvider); 032 033 void doCreateTables(TransactionContext c) throws SQLException, IOException; 034 035 void doDropTables(TransactionContext c) throws SQLException, IOException; 036 037 void doAddMessage(TransactionContext c, long sequence, MessageId messageID, ActiveMQDestination destination, byte[] data, long expiration) throws SQLException, IOException; 038 039 void doAddMessageReference(TransactionContext c, long sequence, MessageId messageId, ActiveMQDestination destination, long expirationTime, String messageRef) throws SQLException, IOException; 040 041 byte[] doGetMessage(TransactionContext c, MessageId id) throws SQLException, IOException; 042 043 byte[] doGetMessageById(TransactionContext c, long storeSequenceId) throws SQLException, IOException; 044 045 String doGetMessageReference(TransactionContext c, long id) throws SQLException, IOException; 046 047 void doRemoveMessage(TransactionContext c, long seq) throws SQLException, IOException; 048 049 void doRecover(TransactionContext c, ActiveMQDestination destination, JDBCMessageRecoveryListener listener) throws Exception; 050 051 void doSetLastAck(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName, long seq) throws SQLException, IOException; 052 053 void doRecoverSubscription(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName, JDBCMessageRecoveryListener listener) 054 throws Exception; 055 056 void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName, long seq, int maxReturned, 057 JDBCMessageRecoveryListener listener) throws Exception; 058 059 void doSetSubscriberEntry(TransactionContext c, SubscriptionInfo subscriptionInfo, boolean retroactive) throws SQLException, IOException; 060 061 SubscriptionInfo doGetSubscriberEntry(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName) throws SQLException, IOException; 062 063 long getStoreSequenceId(TransactionContext c, MessageId messageID) throws SQLException, IOException; 064 065 void doRemoveAllMessages(TransactionContext c, ActiveMQDestination destinationName) throws SQLException, IOException; 066 067 void doDeleteSubscription(TransactionContext c, ActiveMQDestination destinationName, String clientId, String subscriptionName) throws SQLException, IOException; 068 069 void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException; 070 071 long doGetLastMessageStoreSequenceId(TransactionContext c) throws SQLException, IOException; 072 073 Set<ActiveMQDestination> doGetDestinations(TransactionContext c) throws SQLException, IOException; 074 075 void setUseExternalMessageReferences(boolean useExternalMessageReferences); 076 077 SubscriptionInfo[] doGetAllSubscriptions(TransactionContext c, ActiveMQDestination destination) throws SQLException, IOException; 078 079 int doGetDurableSubscriberMessageCount(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriptionName) throws SQLException, IOException; 080 081 int doGetMessageCount(TransactionContext c, ActiveMQDestination destination) throws SQLException, IOException; 082 083 void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, long nextSeq, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception; 084 085 long doGetLastAckedDurableSubscriberMessageId(TransactionContext c, ActiveMQDestination destination, String clientId, String subscriberName) throws SQLException, IOException; 086 087 void doMessageIdScan(TransactionContext c, int limit, JDBCMessageIdScanListener listener) throws SQLException, IOException; 088 }