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 */ 017package org.apache.activemq.store; 018 019import java.io.IOException; 020import java.util.concurrent.Future; 021import org.apache.activemq.broker.ConnectionContext; 022import org.apache.activemq.command.ActiveMQDestination; 023import org.apache.activemq.command.Message; 024import org.apache.activemq.command.MessageAck; 025import org.apache.activemq.command.MessageId; 026import org.apache.activemq.command.SubscriptionInfo; 027import org.apache.activemq.usage.MemoryUsage; 028 029/** 030 * A simple proxy that delegates to another MessageStore. 031 */ 032public class ProxyTopicMessageStore implements TopicMessageStore { 033 034 final TopicMessageStore delegate; 035 036 public ProxyTopicMessageStore(TopicMessageStore delegate) { 037 this.delegate = delegate; 038 } 039 040 public MessageStore getDelegate() { 041 return delegate; 042 } 043 044 public void addMessage(ConnectionContext context, Message message) throws IOException { 045 delegate.addMessage(context, message); 046 } 047 048 public Message getMessage(MessageId identity) throws IOException { 049 return delegate.getMessage(identity); 050 } 051 052 public void recover(MessageRecoveryListener listener) throws Exception { 053 delegate.recover(listener); 054 } 055 056 public void removeAllMessages(ConnectionContext context) throws IOException { 057 delegate.removeAllMessages(context); 058 } 059 060 public void removeMessage(ConnectionContext context, MessageAck ack) throws IOException { 061 delegate.removeMessage(context, ack); 062 } 063 064 public void start() throws Exception { 065 delegate.start(); 066 } 067 068 public void stop() throws Exception { 069 delegate.stop(); 070 } 071 072 public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException { 073 return delegate.lookupSubscription(clientId, subscriptionName); 074 } 075 076 public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, 077 MessageId messageId, MessageAck ack) throws IOException { 078 delegate.acknowledge(context, clientId, subscriptionName, messageId, ack); 079 } 080 081 public void addSubsciption(SubscriptionInfo subscriptionInfo, boolean retroactive) throws IOException { 082 delegate.addSubsciption(subscriptionInfo, retroactive); 083 } 084 085 public void deleteSubscription(String clientId, String subscriptionName) throws IOException { 086 delegate.deleteSubscription(clientId, subscriptionName); 087 } 088 089 public void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) 090 throws Exception { 091 delegate.recoverSubscription(clientId, subscriptionName, listener); 092 } 093 094 public void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, 095 MessageRecoveryListener listener) throws Exception { 096 delegate.recoverNextMessages(clientId, subscriptionName, maxReturned, listener); 097 } 098 099 public void resetBatching(String clientId, String subscriptionName) { 100 delegate.resetBatching(clientId, subscriptionName); 101 } 102 103 public ActiveMQDestination getDestination() { 104 return delegate.getDestination(); 105 } 106 107 public SubscriptionInfo[] getAllSubscriptions() throws IOException { 108 return delegate.getAllSubscriptions(); 109 } 110 111 public void setMemoryUsage(MemoryUsage memoryUsage) { 112 delegate.setMemoryUsage(memoryUsage); 113 } 114 115 public int getMessageCount(String clientId, String subscriberName) throws IOException { 116 return delegate.getMessageCount(clientId, subscriberName); 117 } 118 119 public int getMessageCount() throws IOException { 120 return delegate.getMessageCount(); 121 } 122 123 public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception { 124 delegate.recoverNextMessages(maxReturned, listener); 125 126 } 127 128 public void dispose(ConnectionContext context) { 129 delegate.dispose(context); 130 } 131 132 public void resetBatching() { 133 delegate.resetBatching(); 134 135 } 136 137 public void setBatch(MessageId messageId) throws Exception { 138 delegate.setBatch(messageId); 139 } 140 141 public boolean isEmpty() throws Exception { 142 return delegate.isEmpty(); 143 } 144 145 public Future<Object> asyncAddTopicMessage(ConnectionContext context, Message message) throws IOException { 146 return delegate.asyncAddTopicMessage(context, message); 147 } 148 149 public Future<Object> asyncAddQueueMessage(ConnectionContext context, Message message) throws IOException { 150 return delegate.asyncAddQueueMessage(context, message); 151 } 152 153 public void removeAsyncMessage(ConnectionContext context, MessageAck ack) throws IOException { 154 delegate.removeAsyncMessage(context, ack); 155 } 156 157 public void setPrioritizedMessages(boolean prioritizedMessages) { 158 delegate.setPrioritizedMessages(prioritizedMessages); 159 } 160 161 public boolean isPrioritizedMessages() { 162 return delegate.isPrioritizedMessages(); 163 } 164}