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