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