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    * A channel for communication. This can be a channel on an underlying transport -
10   * like HTTP - or wrap another channel and provide additional functions - like
11   * reliable messaging.
12   * 
13   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
14   */
15  public interface Channel
16  {
17      /*** 
18       * The URI which represents that a message should be sent over a back channel, i.e.
19       * an HttpServletResponse, instead of opening a new connection.
20       */
21      String BACKCHANNEL_URI = "urn:xfire:channel:backchannel";
22  
23      void open() throws Exception;
24      
25      /***
26       * Sends a message.
27       * @param context
28       * @param message
29       * @throws XFireException Occurs if there was an error an error sending the message.
30       */
31      void send(MessageContext context, OutMessage message) 
32          throws XFireException;
33      
34      void receive(MessageContext context, InMessage message);
35  
36      void setEndpoint(ChannelEndpoint receiver);
37  
38      ChannelEndpoint getEndpoint();
39      
40      void close();
41      
42      Transport getTransport();
43  
44      /***
45       * @return The URI which represents this Channel's endpoint.
46       */
47      String getUri();
48  }