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;
018    
019    import java.io.IOException;
020    import org.apache.activemq.broker.ConnectionContext;
021    import org.apache.activemq.command.ActiveMQDestination;
022    import org.apache.activemq.command.Message;
023    import org.apache.activemq.command.MessageAck;
024    import org.apache.activemq.command.MessageId;
025    import org.apache.activemq.usage.MemoryUsage;
026    
027    /**
028     * A simple proxy that delegates to another MessageStore.
029     */
030    public class ProxyMessageStore implements MessageStore {
031    
032        final MessageStore delegate;
033    
034        public ProxyMessageStore(MessageStore delegate) {
035            this.delegate = delegate;
036        }
037    
038        public MessageStore getDelegate() {
039            return delegate;
040        }
041    
042        public void addMessage(ConnectionContext context, Message message) throws IOException {
043            delegate.addMessage(context, message);
044        }
045    
046        public Message getMessage(MessageId identity) throws IOException {
047            return delegate.getMessage(identity);
048        }
049    
050        public void recover(MessageRecoveryListener listener) throws Exception {
051            delegate.recover(listener);
052        }
053    
054        public void removeAllMessages(ConnectionContext context) throws IOException {
055            delegate.removeAllMessages(context);
056        }
057    
058        public void removeMessage(ConnectionContext context, MessageAck ack) throws IOException {
059            delegate.removeMessage(context, ack);
060        }
061    
062        public void start() throws Exception {
063            delegate.start();
064        }
065    
066        public void stop() throws Exception {
067            delegate.stop();
068        }
069    
070        public void dispose(ConnectionContext context) {
071            delegate.dispose(context);
072        }
073    
074        public ActiveMQDestination getDestination() {
075            return delegate.getDestination();
076        }
077    
078        public void setMemoryUsage(MemoryUsage memoryUsage) {
079            delegate.setMemoryUsage(memoryUsage);
080        }
081    
082        public int getMessageCount() throws IOException {
083            return delegate.getMessageCount();
084        }
085    
086        public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception {
087            delegate.recoverNextMessages(maxReturned, listener);
088    
089        }
090    
091        public void resetBatching() {
092            delegate.resetBatching();
093    
094        }
095    
096        public void setBatch(MessageId messageId) throws Exception {
097            delegate.setBatch(messageId);
098        }
099    
100        public boolean isEmpty() throws Exception {
101           return delegate.isEmpty();
102        }
103    }