View Javadoc
1   /*
2    * Created on 16-Apr-2004
3    */
4   package ca.uhn.hl7v2.protocol;
5   
6   import java.io.InputStream;
7   import java.io.OutputStream;
8   
9   /**
10   * A source of input and output streams for use with stream-based 
11   * <code>TransportLayer</code>s.  Implementations should contain the 
12   * necessary information for reconnecting streams as necessary.  For 
13   * example a ServerSocket-based implementation should be able to listen  
14   * for fresh connections and get new streams from them (this must be 
15   * done when refresh() is called).  
16   *  
17   * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
18   * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $
19   */
20  public interface StreamSource {
21  
22      /**
23       * Gets new streams.  This should be called only if one of the streams 
24       * is dead.  
25       * @throws TransportException
26       */
27      void connect() throws TransportException;
28      
29      /**
30       * Closes streams and underlying connections.  
31       * @throws TransportException
32       */
33      void disconnect() throws TransportException;
34      
35      /**
36       * @return the stream to which we write outbound messages.   
37       * @throws TransportException
38       */
39      OutputStream getOutboundStream() throws TransportException;
40  
41      /**
42       * @return the stream to which we expect the remote server to send messages.  
43       * @throws TransportException
44       */
45      InputStream getInboundStream() throws TransportException;
46      
47  }