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.command.SubscriptionInfo; 026 import org.apache.activemq.usage.MemoryUsage; 027 028 /** 029 * A simple proxy that delegates to another MessageStore. 030 */ 031 public class ProxyTopicMessageStore implements TopicMessageStore { 032 033 final TopicMessageStore delegate; 034 035 public ProxyTopicMessageStore(TopicMessageStore 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 SubscriptionInfo lookupSubscription(String clientId, String subscriptionName) throws IOException { 072 return delegate.lookupSubscription(clientId, subscriptionName); 073 } 074 075 public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, 076 MessageId messageId) throws IOException { 077 delegate.acknowledge(context, clientId, subscriptionName, messageId); 078 } 079 080 public void addSubsciption(SubscriptionInfo subscriptionInfo, boolean retroactive) throws IOException { 081 delegate.addSubsciption(subscriptionInfo, retroactive); 082 } 083 084 public void deleteSubscription(String clientId, String subscriptionName) throws IOException { 085 delegate.deleteSubscription(clientId, subscriptionName); 086 } 087 088 public void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) 089 throws Exception { 090 delegate.recoverSubscription(clientId, subscriptionName, listener); 091 } 092 093 public void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, 094 MessageRecoveryListener listener) throws Exception { 095 delegate.recoverNextMessages(clientId, subscriptionName, maxReturned, listener); 096 } 097 098 public void resetBatching(String clientId, String subscriptionName) { 099 delegate.resetBatching(clientId, subscriptionName); 100 } 101 102 public ActiveMQDestination getDestination() { 103 return delegate.getDestination(); 104 } 105 106 public SubscriptionInfo[] getAllSubscriptions() throws IOException { 107 return delegate.getAllSubscriptions(); 108 } 109 110 public void setMemoryUsage(MemoryUsage memoryUsage) { 111 delegate.setMemoryUsage(memoryUsage); 112 } 113 114 public int getMessageCount(String clientId, String subscriberName) throws IOException { 115 return delegate.getMessageCount(clientId, subscriberName); 116 } 117 118 public int getMessageCount() throws IOException { 119 return delegate.getMessageCount(); 120 } 121 122 public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception { 123 delegate.recoverNextMessages(maxReturned, listener); 124 125 } 126 127 public void dispose(ConnectionContext context) { 128 delegate.dispose(context); 129 } 130 131 public void resetBatching() { 132 delegate.resetBatching(); 133 134 } 135 136 public void setBatch(MessageId messageId) throws Exception { 137 delegate.setBatch(messageId); 138 } 139 140 public boolean isEmpty() throws Exception { 141 return delegate.isEmpty(); 142 } 143 }