001 /** 002 * 003 * Copyright 2004 Protique Ltd 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * 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 **/ 018 package org.activemq.service.impl; 019 020 import java.util.Map; 021 022 import javax.jms.JMSException; 023 024 import org.activemq.broker.BrokerClient; 025 import org.activemq.message.ActiveMQDestination; 026 import org.activemq.message.ActiveMQMessage; 027 import org.activemq.message.ConsumerInfo; 028 import org.activemq.message.MessageAck; 029 import org.activemq.service.DeadLetterPolicy; 030 import org.activemq.service.MessageContainer; 031 import org.activemq.service.MessageContainerManager; 032 033 /** 034 * A Proxy implementation of {@link MessageContainerManager} which 035 * delegates to some other implementation which is useful for writing 036 * Facade implementations 037 * 038 * @version $Revision: 1.1.1.1 $ 039 */ 040 public abstract class ProxyMessageContainerManager implements MessageContainerManager { 041 private MessageContainerManager delegate; 042 043 public ProxyMessageContainerManager() { 044 } 045 046 public ProxyMessageContainerManager(MessageContainerManager delegate) { 047 this.delegate = delegate; 048 } 049 050 public Map getDestinations() { 051 return getDelegate().getDestinations(); 052 } 053 054 public Map getLocalDestinations() { 055 return getDelegate().getDestinations(); 056 } 057 058 public void acknowledgeMessage(BrokerClient client, MessageAck ack) throws JMSException { 059 getDelegate().acknowledgeMessage(client, ack); 060 } 061 062 public void addMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException { 063 getDelegate().addMessageConsumer(client, info); 064 } 065 066 public void deleteSubscription(String clientId, String subscriberName) throws JMSException { 067 getDelegate().deleteSubscription(clientId, subscriberName); 068 } 069 070 public void poll() throws JMSException { 071 getDelegate().poll(); 072 } 073 074 public void removeMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException { 075 getDelegate().removeMessageConsumer(client, info); 076 } 077 078 public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException { 079 getDelegate().sendMessage(client, message); 080 } 081 082 public MessageContainer getContainer(String physicalName) throws JMSException { 083 return getDelegate().getContainer(physicalName); 084 } 085 086 public void start() throws JMSException { 087 getDelegate().start(); 088 } 089 090 public void stop() throws JMSException { 091 getDelegate().stop(); 092 } 093 094 public void createMessageContainer(ActiveMQDestination destination) throws JMSException { 095 getDelegate().createMessageContainer(destination); 096 } 097 098 public void destroyMessageContainer(ActiveMQDestination destination) throws JMSException { 099 getDelegate().destroyMessageContainer(destination); 100 } 101 102 public Map getMessageContainerAdmins() throws JMSException { 103 return getDelegate().getMessageContainerAdmins(); 104 } 105 106 /** 107 * @return the DeadLetterPolicy for this Container Manager 108 */ 109 public DeadLetterPolicy getDeadLetterPolicy(){ 110 return getDelegate().getDeadLetterPolicy(); 111 } 112 113 /** 114 * Set the DeadLetterPolicy for this Container Manager 115 * @param policy 116 */ 117 public void setDeadLetterPolicy(DeadLetterPolicy policy){ 118 getDelegate().setDeadLetterPolicy(policy); 119 } 120 121 // Implementation methods 122 //------------------------------------------------------------------------- 123 protected MessageContainerManager getDelegate() { 124 return delegate; 125 } 126 127 protected void setDelegate(MessageContainerManager delegate) { 128 this.delegate = delegate; 129 } 130 }