View Javadoc

    1   /***
    2    *
    3    * Copyright 2004 Protique Ltd
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    * http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   **/
    18  package org.codehaus.activemq.service.impl;
    19
    20  import org.codehaus.activemq.broker.BrokerClient;
    21  import org.codehaus.activemq.message.ActiveMQMessage;
    22  import org.codehaus.activemq.message.ConsumerInfo;
    23  import org.codehaus.activemq.message.MessageAck;
    24  import org.codehaus.activemq.service.MessageContainer;
    25  import org.codehaus.activemq.service.MessageContainerManager;
    26
    27  import javax.jms.JMSException;
    28
    29  /***
    30   * A Proxy implementation of {@link MessageContainerManager} which
    31   * delegates to some other implementation which is useful for writing
    32   * Facade implementations
    33   *
    34   * @version $Revision: 1.4 $
    35   */
    36  public abstract class ProxyMessageContainerManager implements MessageContainerManager {
    37      private MessageContainerManager delegate;
    38
    39      public ProxyMessageContainerManager() {
    40      }
    41
    42      public ProxyMessageContainerManager(MessageContainerManager delegate) {
    43          this.delegate = delegate;
    44      }
    45
    46      public void acknowledgeMessage(BrokerClient client, MessageAck ack) throws JMSException {
    47          getDelegate().acknowledgeMessage(client, ack);
    48      }
    49
    50      public void acknowledgeTransactedMessage(BrokerClient client, String transactionId, MessageAck ack) throws JMSException {
    51          getDelegate().acknowledgeTransactedMessage(client, transactionId, ack);
    52      }
    53
    54      public void redeliverMessage(BrokerClient client, MessageAck ack) throws JMSException {
    55          getDelegate().redeliverMessage(client, ack);
    56      }
    57
    58      public void addMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
    59          getDelegate().addMessageConsumer(client, info);
    60      }
    61
    62      public void commitTransaction(BrokerClient client, String transactionId) throws JMSException {
    63          getDelegate().commitTransaction(client, transactionId);
    64      }
    65
    66      public void deleteSubscription(String clientId, String subscriberName) throws JMSException {
    67          getDelegate().deleteSubscription(clientId, subscriberName);
    68      }
    69
    70      public void poll() throws JMSException {
    71          getDelegate().poll();
    72      }
    73
    74      public void removeMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
    75          getDelegate().removeMessageConsumer(client, info);
    76      }
    77
    78      public void rollbackTransaction(BrokerClient client, String transactionId) {
    79          getDelegate().rollbackTransaction(client, transactionId);
    80      }
    81
    82      public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException {
    83          getDelegate().sendMessage(client, message);
    84      }
    85
    86      public MessageContainer getContainer(String physicalName) throws JMSException {
    87          return getDelegate().getContainer(physicalName);
    88      }
    89
    90      public void start() throws JMSException {
    91          getDelegate().start();
    92      }
    93
    94      public void stop() throws JMSException {
    95          getDelegate().stop();
    96      }
    97
    98      // Implementation methods
    99      //-------------------------------------------------------------------------
    100     protected MessageContainerManager getDelegate() {
    101         return delegate;
    102     }
    103
    104     protected void setDelegate(MessageContainerManager delegate) {
    105         this.delegate = delegate;
    106     }
    107 }