View Javadoc

    1   package org.codehaus.xfire.transport;
    2
    3   import org.codehaus.xfire.MessageContext;
    4   import org.codehaus.xfire.XFireException;
    5   import org.codehaus.xfire.exchange.InMessage;
    6   import org.codehaus.xfire.exchange.OutMessage;
    7
    8   /***
    9    * Wraps another channel so it is easy to add another layer of functionality.
    10   *
    11   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    12   */
    13  public class DelegatedChannel
    14      implements Channel
    15  {
    16      private Channel channel;
    17      private Transport transport;
    18
    19      public DelegatedChannel(Transport transport, Channel channel)
    20      {
    21          this.transport = transport;
    22          this.channel = channel;
    23      }
    24
    25      public void open()
    26          throws Exception
    27      {
    28          channel.open();
    29      }
    30
    31      public void send(MessageContext context, OutMessage message)
    32          throws XFireException
    33      {
    34          channel.send(context, message);
    35      }
    36
    37      public void receive(MessageContext context, InMessage message)
    38      {
    39          channel.receive(context, message);
    40      }
    41
    42      public void setEndpoint(ChannelEndpoint receiver)
    43      {
    44          channel.setEndpoint(receiver);
    45      }
    46
    47      public void close()
    48      {
    49          channel.close();
    50      }
    51
    52      public Transport getTransport()
    53      {
    54          return transport;
    55      }
    56
    57      public String getUri()
    58      {
    59          return channel.getUri();
    60      }
    61
    62      public ChannelEndpoint getEndpoint()
    63      {
    64          return channel.getEndpoint();
    65      }
    66  }