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;
020
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 extends ProxyMessageStore implements TopicMessageStore  {
033
034    public ProxyTopicMessageStore(TopicMessageStore delegate) {
035        super(delegate);
036    }
037
038    public MessageStore getDelegate() {
039        return delegate;
040    }
041
042    @Override
043    public void addMessage(ConnectionContext context, Message message) throws IOException {
044        delegate.addMessage(context, message);
045    }
046
047    @Override
048    public void addMessage(ConnectionContext context, Message message, boolean canOptimizeHint) throws IOException {
049       delegate.addMessage(context, message, canOptimizeHint);
050    }
051
052    @Override
053    public Message getMessage(MessageId identity) throws IOException {
054        return delegate.getMessage(identity);
055    }
056
057    @Override
058    public void recover(MessageRecoveryListener listener) throws Exception {
059        delegate.recover(listener);
060    }
061
062    @Override
063    public void removeAllMessages(ConnectionContext context) throws IOException {
064        delegate.removeAllMessages(context);
065    }
066
067    @Override
068    public void removeMessage(ConnectionContext context, MessageAck ack) throws IOException {
069        delegate.removeMessage(context, ack);
070    }
071
072    @Override
073    public void start() throws Exception {
074        delegate.start();
075    }
076
077    @Override
078    public void stop() throws Exception {
079        delegate.stop();
080    }
081
082    @Override
083    public SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException {
084        return ((TopicMessageStore)delegate).lookupSubscription(clientId, subscriptionName);
085    }
086
087    @Override
088    public void acknowledge(ConnectionContext context, String clientId, String subscriptionName,
089                            MessageId messageId, MessageAck ack) throws IOException {
090        ((TopicMessageStore)delegate).acknowledge(context, clientId, subscriptionName, messageId, ack);
091    }
092
093    @Override
094    public void addSubscription(SubscriptionInfo subscriptionInfo, boolean retroactive) throws IOException {
095        ((TopicMessageStore)delegate).addSubscription(subscriptionInfo, retroactive);
096    }
097
098    @Override
099    public void deleteSubscription(String clientId, String subscriptionName) throws IOException {
100        ((TopicMessageStore)delegate).deleteSubscription(clientId, subscriptionName);
101    }
102
103    @Override
104    public void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener)
105        throws Exception {
106        ((TopicMessageStore)delegate).recoverSubscription(clientId, subscriptionName, listener);
107    }
108
109    @Override
110    public void recoverNextMessages(String clientId, String subscriptionName, int maxReturned,
111                                    MessageRecoveryListener listener) throws Exception {
112        ((TopicMessageStore)delegate).recoverNextMessages(clientId, subscriptionName, maxReturned, listener);
113    }
114
115    @Override
116    public void resetBatching(String clientId, String subscriptionName) {
117        ((TopicMessageStore)delegate).resetBatching(clientId, subscriptionName);
118    }
119
120    @Override
121    public ActiveMQDestination getDestination() {
122        return delegate.getDestination();
123    }
124
125    @Override
126    public SubscriptionInfo[] getAllSubscriptions() throws IOException {
127        return ((TopicMessageStore)delegate).getAllSubscriptions();
128    }
129
130    @Override
131    public void setMemoryUsage(MemoryUsage memoryUsage) {
132        delegate.setMemoryUsage(memoryUsage);
133    }
134
135    @Override
136    public int getMessageCount(String clientId, String subscriberName) throws IOException {
137        return ((TopicMessageStore)delegate).getMessageCount(clientId, subscriberName);
138    }
139
140    @Override
141    public int getMessageCount() throws IOException {
142        return delegate.getMessageCount();
143    }
144
145    @Override
146    public long getMessageSize() throws IOException {
147        return delegate.getMessageSize();
148    }
149
150    @Override
151    public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception {
152        delegate.recoverNextMessages(maxReturned, listener);
153    }
154
155    @Override
156    public void dispose(ConnectionContext context) {
157        delegate.dispose(context);
158    }
159
160    @Override
161    public void resetBatching() {
162        delegate.resetBatching();
163    }
164
165    @Override
166    public void setBatch(MessageId messageId) throws Exception {
167        delegate.setBatch(messageId);
168    }
169
170    @Override
171    public boolean isEmpty() throws Exception {
172        return delegate.isEmpty();
173     }
174
175    @Override
176    public ListenableFuture<Object> asyncAddTopicMessage(ConnectionContext context, Message message) throws IOException {
177        return delegate.asyncAddTopicMessage(context, message);
178     }
179
180    @Override
181    public ListenableFuture<Object> asyncAddTopicMessage(ConnectionContext context, Message message, boolean canOptimizeHint) throws IOException {
182        return delegate.asyncAddTopicMessage(context,message, canOptimizeHint);
183    }
184
185    @Override
186    public ListenableFuture<Object> asyncAddQueueMessage(ConnectionContext context, Message message) throws IOException {
187        return delegate.asyncAddQueueMessage(context, message);
188    }
189
190    @Override
191    public ListenableFuture<Object> asyncAddQueueMessage(ConnectionContext context, Message message, boolean canOptimizeHint) throws IOException {
192        return delegate.asyncAddQueueMessage(context,message, canOptimizeHint);
193    }
194
195    @Override
196    public void removeAsyncMessage(ConnectionContext context, MessageAck ack) throws IOException {
197        delegate.removeAsyncMessage(context, ack);
198    }
199
200    @Override
201    public void setPrioritizedMessages(boolean prioritizedMessages) {
202        delegate.setPrioritizedMessages(prioritizedMessages);
203    }
204
205    @Override
206    public boolean isPrioritizedMessages() {
207        return delegate.isPrioritizedMessages();
208    }
209
210    @Override
211    public void updateMessage(Message message) throws IOException {
212        delegate.updateMessage(message);
213    }
214
215    @Override
216    public void registerIndexListener(IndexListener indexListener) {
217        delegate.registerIndexListener(indexListener);
218    }
219
220    @Override
221    public MessageStoreStatistics getMessageStoreStatistics() {
222        return delegate.getMessageStoreStatistics();
223    }
224
225    /* (non-Javadoc)
226     * @see org.apache.activemq.store.TopicMessageStore#getMessageSize(java.lang.String, java.lang.String)
227     */
228    @Override
229    public long getMessageSize(String clientId, String subscriberName)
230            throws IOException {
231        return ((TopicMessageStore)delegate).getMessageSize(clientId, subscriberName);
232    }
233
234    @Override
235    public MessageStoreSubscriptionStatistics getMessageStoreSubStatistics() {
236        return ((TopicMessageStore)delegate).getMessageStoreSubStatistics();
237    }
238}