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